views:

140

answers:

2

Hi,

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/"&gt;
    <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;
        <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,

+1  A: 

.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.

DreamSonic
Thx. But why does it break? We have specified xsd, which points to http://www.w3.org/2001/XMLSchema. So this should be valid.
SharePoint Newbie
http://www.w3.org/2001/XMLSchema is not YOUR schema, which serializer is supposed to understand. YOUR schema should go under default xmlns, where http://tempuri.org/ is now.
DreamSonic
+1  A: 

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" ?

John Saunders
Yes, It was sent by k-soap. Apprently we were using the wrong k-soap build and have updated our code to use the latest build. This has solved the issue.
SharePoint Newbie