Ali is larger than SMS return XML

Source: Internet
Author: User

Returns the exception and succeeds two different, the XML returns directly takes Alibaba_aliqin_fc_sms_num_send_response to judge whether the node has this name

Official API Address:

https://api.alidayu.com/doc2/apiDetail?spm=a3142.7629140.1999205496.19.fs37Yu&apiId=25450

<?XML version= "1.0" encoding= "Utf-8"?><Alibaba_aliqin_fc_sms_num_send_response>    <result>        <Err_code>0</Err_code>        <Model>102330458199^1102997158000</Model>        <Success>True</Success>    </result>    <request_id>Z28wpa7p4jz3</request_id></Alibaba_aliqin_fc_sms_num_send_response><!--Top010178001118.n.et2 -
return Success

<?XML version= "1.0" encoding= "Utf-8"?><Error_response>    <Code>50</Code>    <msg>Remote Service error</msg>    <Sub_code>Isv.invalid-parameter</Sub_code>    <sub_msg>Illegal parameters</sub_msg></Error_response>
return Exception

 Public Staticsorteddictionary<string,Object> Alidayufromxml (stringxml) {sorteddictionary<string,Object> obj =Newsorteddictionary<string,Object>(); if(!string. IsNullOrEmpty (XML)) {XmlDocument xmldoc=NewXmlDocument ();                Xmldoc.loadxml (XML); //if the number of incoming nodes is larger than index, otherwise it means that the node does not exist .                if(XmlDoc.ChildNodes.Count >1) {XmlNode XmlNode= xmldoc.childnodes[1];//get to the root node <xml>XmlElement Xeinit =(XmlElement) XmlNode; if(XmlNode.ChildNodes.Count = =2|| Xeinit. Name = ="Alibaba_aliqin_fc_sms_num_send_response") {XmlNode Xmlnodenext= xmlnode.childnodes[0]; XmlNodeList nodes=Xmlnodenext.childnodes; foreach(XmlNode xninchnodes) {XmlElement XE=(XmlElement) xn; Obj[xe. Name]= Xe. InnerText;//gets the key value of the XML into the data inside the Wxpaydata                        }                    }                    Else{XmlNodeList Nodes=Xmlnode.childnodes; foreach(XmlNode xninchnodes) {XmlElement XE=(XmlElement) xn; Obj[xe. Name]= Xe. InnerText;//gets the key value of the XML into the data inside the Wxpaydata                        }                    }                }            }            returnobj; }
XML Return Object

After returning an object

var model = Alidayufromxml (RSP). Body.tostring ());            if (model. ContainsKey ("Success"))            {                //transaction to be made after successful writing            }else{}

Ali is larger than SMS return XML

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.