I'm one. I am writing NET web application, which needs to call external server service. I have been provided with the documentation, in which PHP examples are included in the code.
I can successfully create a web reference in VS2010 which is the WSDL address I provided, and by using Fidler I can see that the expected XML is being sent and received. However, there is a problem parsing the returned XML.
I only accept an array of user names and it is used to revert some of the users' nested hash array (with each user) to its array name, type, etc. field) and errors An array (for any usernames that do not match). I would say it in 'PHP-ish':
array ('users' => array (array ('id' => 11, 'username' = & gt; 'Mike', 'first name' = & gt; 'mick', 'last name' = & gt; 'bayern'), ...) 'errors' => array (array ('username' = & gt; ; 'Whatever', 'error code' = & gt; 'NOSUCHUSER'))) I'm getting SOAP XML that will be analogous to this. However, when .NET tries to convert it into a result, it throws an exception:
type can not specify the object of the System.Xml.XmlNode [] type of an object System.String Interestingly, the method used by NAT for me based on WSDL says that it gives a plain old string which states that it The WSDL defines the return type as it can not. Full WSDL is available here:
Here is a sample of XML received and sent from the basic names:
& lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Soap: Envelope xmlns: Soap = "http://schemas.xmlsoap.org/soap/envelope/" xmlns: soapenc = "http://schemas.xmlsoap.org/soap/encoding/" xmlns: TNS = "http: //www.elearning.psychology.org.au/webservice/soap/server.php?wstoken=dc45858adb6f28b7feae87014d46d9b3 "xmlns: type =" http://www.elearning.psychology.org.au/webservice/soap/server .php Wstoken = dc45858adb6f28b7feae87014d46d9b3 / encodedTypes "xmlns: xsi =" http://www.w3.org/2001/XMLSchema-instance "xmlns: XSD =" http://www.w3.org/2001/XMLSchema "& gt; & Lt; Soap: body soap: encoding style = "http://schemas.xmlsoap.org/soap/encoding/" & gt; & Lt; TNS: netspot_user_get_users_by_username & gt; & Lt; Username = "# id1" /> & Lt; / TNS: netspot_user_get_users_by_username & gt; & Lt; Soapenc: array id = "id1" soapnake: array type = "xsd: string [1]" & gt; & Lt; Item & gt; 557788 & lt; / Item & gt; & Lt; / Soapenc: array & gt; & Lt; / Soap: Body & gt; & Lt; / Soap: Envelope & gt; and response:
& lt ;? XML version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Soap-ENV: Envelope xmlns: SOAP-ENV = "http://schemas.xmlsoap.org/soap/envelope/" xmlns: Ns1 also = "http://www.elearning.psychology.org.au/webservice/ Soap / Server.php wstoken = dc45858adb6f28b7feae87014d46d9b3 "xmlns: xsi =" http://www.w3.org/2001/XMLSchema-instance "xmlns: ns2 =" http://xml.apache.org/xml-soap "xmlns : SOAP-ENC = "http://schemas.xmlsoap.org/soap/encoding/" xmlns: XSD = "http://www.w3.org/2001/XMLSchema" SOAP-ENV: encodingStyle = "http: / /schemas.xmlsoap.org/soap/encoding/"> & Lt; Soap-ENV: Body & gt; & Lt; Ns1 also: netspot_user_get_users_by_usernameResponse & gt; & Lt; Return xsi: type = "ns2: map" & gt; & Lt; Items & gt; & Lt; Key xsi: type = "xsd: string" & gt; Errors & lt; / Key & gt; & Lt; Value SOAP-ENC: arrayType = "ns2: map [1]" xsi: type = "SOAP-ENC: Array" & gt; & Lt; Item xsi: type = "ns2: map" & gt; & Lt; Items & gt; & Lt; Key xsi: type = "xsd: string" & gt; Username & lt; / Key & gt; & Lt; Value xsi: type = "xsd: string" & gt; 557788 & lt; / Value & gt; & Lt; / Item & gt; & Lt; Items & gt; & Lt; Key xsi: type = "xsd: string" & gt; Error code & lt; / Key & gt; & Lt; Value xsi: type = "xsd: string" & gt; NOSUCHUSER & lt; / Value & gt; & Lt; / Item & gt; & Lt; / Item & gt; & Lt; / Pricing & gt; & Lt; / Item & gt; & Lt; / Return & gt; & Lt; / Ns1 also: netspot_user_get_users_by_usernameResponse & gt; & Lt; / SOAP-ENV: Body & gt; & Lt; / SOAP-ENV: envelope & gt; Any help would be greatly appreciated.
These can help:
< / P>
Comments
Post a Comment