471,088 Members | 1,263 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,088 software developers and data experts.

array deserialization in Axis webservice repsonses

I tried to post this question before, but there was an error when posting.
I case it did get posted and in order to avoid duplication, I'll just repost
a summary.

I have written a dotnet client that accesses a Axis provided web service.
The client uses the code generated, using wsdl.exe, from the wsdl file
provided by the web service provider.

The web response has the following schema (roughly):

public class response {

public string elem1;
public thing[] elem2;


public class thing {
public string thingy1;
public string thingy2;

i.e. the response has an array of custom objects within a custom object.

I do not have access to the server, I can't make changes to it. I may be
able to convince service provider to make changes, though.

When processing the response, I the following is thrown:
System.InvalidOperationException: There is an error in XML document (12,
19). ---> System.InvalidCastException: Cannot assign object of type
System.Object[] to an object of type customertransactions.thing[].
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read3_ResponseModel()
System.Xml.Serialization.XmlSerializationReader.Re adReferencingElement(String
name, String ns, Boolean elementCanBeType, String& fixupReference)
at System.Xml.Serialization.XmlSerializationReader.Re adReferencedElements()
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read6_walletPaymentResponse()

I've read at
http://www.mail-archive.com/ax******.../msg00195.html that there
are deserialization issues with certain elements. e.g. if the element is an
array of other stuff, but the element is defined as anyType[n], then the
contents may get put into an object array (object[]) instead of into the
appropriate array (thing[]). I would guess from the exception that this is
happening (an that the exception is thrown when the application tries to
assign the object[] to the Response.elem2 property).

I have managed to intercept and modify the SOAP response prior to
The SOAP response does define the offending array element as a anyType[2]. I
even managed to modify the response prior to deserialization and changed it
to thing[2].
When I did that, the exception went away and the response contents were
properly stuffed into the response oject.

My question is this. My solution is ugly and specific to a particular SOAP
I thought that a purpose of webservices and wsdl was to remove the developer
from the loop - the web service details are handled by a wsdl processor and
as such the developer doesn't mess with the details of request formatting and
response parsing.

Is there a way that I am supposed to use wsdl and the resulting proxy class
that will allow me to consume an Axis service with a dotnet client? Is there
a problem with either the dotnet deserialization or the Axis serialization of
Is there a known Axis issue that requires the service provider to adjust
some stuff in order to service dotnet clients?

Thanks for your time.

Nov 21 '05 #1
1 3562
Please diregard my original post in this thread. I noticed that my first
attempt at posting this question did in fact make it onto the discussion
board. Please refer to it, "deserialization arrays in Axis SOAP messages"
posted 11/11/2004, intead.


Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jacky Zhu | last post: by
3 posts views Thread by parrot toes | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.