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[].
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationReader1.Read3_ResponseModel()
at
System.Xml.Serialization.XmlSerializationReader.Re adReferencingElement(String
name, String ns, Boolean elementCanBeType, String& fixupReference)
at System.Xml.Serialization.XmlSerializationReader.Re adReferencedElements()
at
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
deserialization.
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
message.
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
arrays.
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.