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