.NET Framework Bookmark and Share   
 index > ASMX Web Services and XML Serialization > Problem deserializing response from an Axis web service
 

Problem deserializing response from an Axis web service

I have a VB.NET application that calls an Axis web service. WSDL.EXE gneerates this class from the WSDL provided by the AxisPeople organization (names have been changed to protect the guilty)

'<remarks/>
<System.Xml.Serialization.SoapTypeAttribute("Thing", "
http://thingservice.axispeople.org")> _
Public Class Thing

'<remarks/>
Public amountOne As Decimal

'<remarks/>
Public amountTwo As Decimal

'<remarks/>
Public amountThree As Decimal

'<remarks/>
Public statusCode As String
End Class

When a call to the thingservice.getThing produces the response below, the VB.NET proxy class throws an InvalidCastException. Note that in this response, amountOne and amountTwo both refer to the multiref node #id1.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:getThingResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://thingservice.axispeople.org">
<getThingReturn href="#id0" />
</ns1:getThingResponse>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:Thing" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="urn:Thing">
<amountOne href="#id1" />
<amountTwo href="#id1" />
<amountThree href="#id2" />
<statusCode xsi:type="soapenc:string">O</statusCode>
</multiRef>
<multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:decimal" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef>
<multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:decimal" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">28890</multiRef>
</soapenv:Body>
</soapenv:Envelope>

This is a new development. In the past each of the return elements had its own multiref node and the proxy class did not throw an exception. So here is my question: Is this business of referring more than one schema element to the same multiref node allowed? If so, how do I change the deserialization behavior to handle it correctly?

Any insight is greatly appreciated

sm1else

AXIS send an invalid message: it has a reference to non-existent type “Thing�from “urn:Thing�namespace:

<ns1:getThingResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://thingservice.axispeople.org">

<getThingReturn href="#id0" />

</ns1:getThingResponse>

<multiRef id="id0" xsi:type="ns2:Thing" xmlns:ns2="urn:Thing">

It should be type “ThingModel�from “http://thingservice.axispeople.org�namespace.

After fixing the above issue, you will run into couple of .net limitations

  1. we do not support simple type restrictions
  2. we do not support href syntax for the value types.

So even after you fix the incoming message, the ,Net client will fail to Deserialize the individual members of the ThingModel class (no exception, just missing data). To deal with the .net limitations you would need to change the type of the ThingModel members from decimal to object:

<System.Xml.Serialization.SoapTypeAttribute("Thing", "http://thingservice.axispeople.org")> _

Public Class Thing

'<remarks/>

Public amountOne As Object

'<remarks/>

Public amountTwo As Object

'<remarks/>

Public amountThree As Object

'<remarks/>

Public statusCode As String

End Class

Thanks,
Elena

Elena Kharitidi

Hi

Were you able to solve this issue?

I'm having a similar issue.

Thanks

Murali

Murali T N

Please provide service description for the AXIS service.

Thanks,
Elena

Elena Kharitidi

Here is the WSDL: (Sorry for the delay)

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:http="
http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://service.axispeople.org" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="https://service.axispeople.org/service/services/ThingService" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="https://service.axispeople.org/service/services/ThingService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema xmlns="
http://www.w3.org/2001/XMLSchema" targetNamespace="http://service.axispeople.org">
<s:import namespace="
http://schemas.xmlsoap.org/soap/encoding/" />
<s:simpleType name="thingNum">
<s:restriction base="s:string">
<s:pattern value="[A-Z0-9]{14}" />
</s:restriction>
</s:simpleType>
<s:simpleType name="valCode">
<s:restriction base="s:string">
<s:pattern value="[ABC]{1}" />
</s:restriction>
</s:simpleType>
<s:simpleType name="amount">
<s:restriction base="s:decimal">
<s:pattern value="[0-9]{1,10}\\.[0-9]{2}" />
</s:restriction>
</s:simpleType>
<s:complexType name="ThingModel">
<s:sequence>
<s:element name="amountOne" nillable="true" type="s0:amount" />
<s:element name="amountTwo" nillable="true" type="s0:amount" />
<s:element name="amountThree" nillable="true" type="s0:amount" />
<s:element name="statusCode" nillable="true" type="s0:valCode" />
</s:sequence>
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name="getThingRequest">
<wsdl:part name="thingNumber" type="s0:thingNum" />
</wsdl:message>
<wsdl:message name="getThingResponse">
<wsdl:part name="getThingReturn" type="s0:ThingModel" />
</wsdl:message>
<wsdl:portType name="ThingService">
<wsdl:operation name="getThing" parameterOrder="thingNumber">
<wsdl:input name="getThingRequest" message="tns:getThingRequest" />
<wsdl:output name="getThingResponse" message="tns:getThingResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ThingSoapBinding" type="tns:ThingService">
<soap:binding transport="
http://schemas.xmlsoap.org/soap/http" style="rpc" />
<wsdl:operation name="getThing">
<soap:operation soapAction="" />
<wsdl:input name="getThingRequest">
<soap:body use="encoded" namespace="
http://service.axispeople.org" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:input>
<wsdl:output name="getThingResponse">
<soap:body use="encoded" namespace="
https://service.axispeople.org/service/services/ThingService" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ThingService">
<wsdl:port name="Thing" binding="tns:ThingSoapBinding">
<soap:address location="
https://service.axispeople.org/service/services/ThingService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

sm1else

See my reply downthread. Sorry for the delay.

Gerry

sm1else

AXIS send an invalid message: it has a reference to non-existent type “Thing�from “urn:Thing�namespace:

<ns1:getThingResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://thingservice.axispeople.org">

<getThingReturn href="#id0" />

</ns1:getThingResponse>

<multiRef id="id0" xsi:type="ns2:Thing" xmlns:ns2="urn:Thing">

It should be type “ThingModel�from “http://thingservice.axispeople.org�namespace.

After fixing the above issue, you will run into couple of .net limitations

  1. we do not support simple type restrictions
  2. we do not support href syntax for the value types.

So even after you fix the incoming message, the ,Net client will fail to Deserialize the individual members of the ThingModel class (no exception, just missing data). To deal with the .net limitations you would need to change the type of the ThingModel members from decimal to object:

<System.Xml.Serialization.SoapTypeAttribute("Thing", "http://thingservice.axispeople.org")> _

Public Class Thing

'<remarks/>

Public amountOne As Object

'<remarks/>

Public amountTwo As Object

'<remarks/>

Public amountThree As Object

'<remarks/>

Public statusCode As String

End Class

Thanks,
Elena

Elena Kharitidi

The object name difference was my fault. That was a typo. I had to change the WSDL and the response so I don't disclose proprietary information. Will try changing the data types of the member fields to Object and see if that fixes it. Will reply as soon as I know something. Thanks for all your help!

Best,

Gerry

sm1else

You can use google to search for other answers

Custom Search

More Threads

• WSE 3.0 Routing, ClientActor, ServiceActor properties
• Server response with header attribute mustunderstand="1"
• [Web Service] Receiving GET request instead of POST
• XML Parser failure
• WSE 2.0 SP2 Installer Error
• Why installing dot net creates a new user account on my computer??
• Extending Web Services Functionality (Client Side)
• Can timeouts be overcome by progress indicator of some sort?
• Web Service Input Always 0
• permissions