Reputation: 6082
We are sending the following request to a .Net 3.5 ASMX web service.
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<Login xmlns="http://tempuri.org/" id="o0" SOAP-ENC:root="1">
<password xsi:type="xsd:string">1234</password>
<userName xsi:type="xsd:string">Developer</userName>
</Login>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
On debugging, the web-service, we find that the parametr values available to the web method (login and method) are null.
However if we remove the xsi:type= "xsd:string" attribute from the password and username, everything works.
The namespace xsd points to http://www.w3.org/2001/XMLSchema, which is valid.
Why can't .Net deserialize the response? and why does it not throw an exception?
BTW: Our service definition aliases http://www.w3.org/2001/XMLSchema as "s". Could that be an issue?
Kind regards,
Upvotes: 0
Views: 788
Reputation: 161831
Is your ASMX service decorated with the [SoapRpcService] attribute? If not, then it is a document / literal service, and does not want the XML in that format.
How was this XML sent? Was it built by hand? Was it sent by a Java client that was created based on the WSDL derived from "service.asmx?WSDL" ?
Upvotes: 1
Reputation: 1472
.NET serializers rely on the underlying schema to deserialize stuff. When you specify xsi:type attribute, you basically break the schema contract.
BTW. Don't use http://tempuri.org/, make up your own URI.
Upvotes: 1