By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,948 Members | 900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

Dotnet Client fails to deserialize message from AXIS web service if the message maps two elements to the same multiRef element. What do I do?

P: n/a
GT
I have a .NET client that consumes an Axis web service. A change was
made recently to the AXIS web service, and ever since then my .NET
proxy class has been throwing an InvalidCastException. The proxy class
was auto-generated by Visual Studio from WSDL provided by people who
provide the Axis service, and I have not modified it (except to add
code for a build that includes a SOAP trace). The only difference I
see in the messages is that in the latest version of the Axis service,
two elements refer to the same multiRef element, as in the example
below

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

Previous versions of this message looked like this:
<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="#id2" />
<amountThree href="#id3" />
<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/">0</multiRef>
<multiRef id="id3" 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>

Is it valid to have two elements map to the same multiRef element in a
SOAP response? If so, how do I modify the deserialization behavior to
handle it?

I suspect that the deserializer thingy is using a forward-only stream
so it blows up if it has to read an element twice. Am I on the right
track here?

Any insight is greatly appreciated.

Mar 21 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"GT" <sm*****@hotmail.com> a écrit dans le message de news:
11*********************@i39g2000cwa.googlegroups.c om...
I have a .NET client that consumes an Axis web service. A change was
made recently to the AXIS web service, and ever since then my .NET
proxy class has been throwing an InvalidCastException. The proxy class
was auto-generated by Visual Studio from WSDL provided by people who
provide the Axis service, and I have not modified it (except to add
code for a build that includes a SOAP trace). The only difference I
see in the messages is that in the latest version of the Axis service,
two elements refer to the same multiRef element, as in the example
below

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

Previous versions of this message looked like this:
<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="#id2" />
<amountThree href="#id3" />
<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/">0</multiRef>
<multiRef id="id3" 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>

Is it valid to have two elements map to the same multiRef element in a
SOAP response? If so, how do I modify the deserialization behavior to
handle it?

I suspect that the deserializer thingy is using a forward-only stream
so it blows up if it has to read an element twice. Am I on the right
track here?

Any insight is greatly appreciated.


Can you also post difference between the two WSDL ?

We have encountered a similar problem, that seem related to code generation
from the WSDL.

You can have a look to the generated code too, and see if there is something
wrong.

Rémy
Mar 21 '06 #2

P: n/a
GT
Here is the WSDL (Sorry for the delay): Thoughts?
<?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>

Mar 30 '06 #3

P: n/a

"GT" <sm*****@hotmail.com> a écrit dans le message de news:
11**********************@e56g2000cwe.googlegroups. com...
Here is the WSDL (Sorry for the delay): Thoughts?

....


Somewhat simple WSDL.

I don't see anything, wrong (except that we usually try to avoid the
nillable="true", and replace it with minOccurs="0") but i think that the
problem cannot be there.

Note that Axis can be configured to not send multirefs (in your case, the
SOAP message would be a lot smaller).

Mar 31 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.