Re: SOAP serialization problem

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



On Fri, 14 Aug 2009 09:58:25 -0400, Mr. Arnold wrote:

"Jeff Dege" <jdege@xxxxxxxxxxxxxx> wrote in message
news:H_SdnXeH482DwRjXnZ2dnUVZ_g1i4p2d@xxxxxxxxxxxxxx
On Thu, 13 Aug 2009 19:02:31 -0400, Mr. Arnold wrote:

"Jeff Dege" <jdege@xxxxxxxxxxxxxx> wrote in message
news:9tKdnZWhBf3VHRnXnZ2dnUVZ_tednZ2d@xxxxxxxxxxxxxx
I'm trying to write a client against a third party's web service
using ASP.NET 3.5. I'm getting an error when the generated proxy
deserializes the response:

"Cannot assign object of type System.Xml.XmlNode[] to an object of
type System.String."

This exception is thrown by the generated proxy class on
this.Invoke().

I've snooped the SOAP response, and it looks fine. The wsdl
validates, and wsdl.exe compiles it without error.

Browsing around on the net has given me the vague impression that I
might need to set some sort of custom serialization attribute, but
I've not been able to figure out what that might be.

Any ideas?

Contact the Web Service provider?

I am in contact with them. They're working with the PHP SOAP
Extension, and their test client works just fine.

Their test client based on what, Java?

If they need to make a change, in
order for ASP.NET to work with their responses, what change do they
need to make?


"Cannot assign object of type System.Xml.XmlNode[] to an object of type
System.String."

[System.Web.Services.Protocols.SoapRpcMethodAttribute(
"http://www.XXX.com/webservices/service.php/XmlTest";,
RequestNamespace="http://www.XXX.com/webservices";,
ResponseNamespace="http://www.XXX.com/webservices";)]
[return: System.Xml.Serialization.SoapElementAttribute("result")] public
string XmlTest(string xml_msg) {
object[] results = this.Invoke("XmlTest", new object[] {
xml_msg});
return ((string)(results[0]));
}

-------

I don't see how the statements above are going to work. It can't take an
array - [] object type and assign it to a primitive object type of
String. That's the issue you need to address and not some serialization
problem. There seems to be a misinterpretation of the XML schema that
needs to be resolved between you and the 3rd party provider.

The wsdl says:

<portType name="AEWebServicePortType">
<operation name="XmlTest">
<input message="tns:XmlTestRequest"/>
<output message="tns:XmlTestResponse"/>
</operation>
</portType>

Where:

<message name="XmlTestResponse">
<part name="result" type="tns:XmlOut"/>
</message>

And:

<simpleType name="XmlOut">
<restriction base = "xsd:string"/>
</simpleType>

The SOAP response contains:

<ns1:XmlTestResponse>
<result xsi:type="ns2:XmlOut">
Test Message
</result>
</ns1:XmlTestResponse>

This looks consistent, to me.

It's wsdl.exe that has decided that "result" should be converted to a
string, instead of to some other type, and it's wsdl.exe that then can't
convert it to a string. I've tried using other return types for this
deserialization, but I've not found any that work. Everything I've tried
has either been undefined or has generated the same error.

[return: System.Xml.Serialization.SoapElementAttribute("result")]
public string XmlTest(string xml_msg) {
object[] results = this.Invoke("XmlTest", new object[] {
xml_msg});
return ((string)(results[0]));
}

"Value 'any' cannot be used for the SoapElementAttribute.DataType
property. The datatype 'http://www.w3.org/2001/XMLSchema:any' is missing."


Either they have to change what they're sending, or I have to change
how .NET's deserialization handles it. But what change do we need to
make?

--
Feles mala! Cur cista non uteris? Stramentum novum in ea posui.
.



Relevant Pages

  • RE: Dropping carriage return characters from web service
    ... It works...I'm just surprised that the proxy was written to drop ... string data in soap response message. ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • RE: Soap Response
    ... Try refreshing the proxy. ... Thread-Topic: Soap Response ... webservice as per the following code in the proxy class: ... Public Function process3ParmRequest(ByVal inputHeader As String, ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: SOAP serialization problem
    ... I've snooped the SOAP response, ... public string XmlTest{ ... this deserialization, but I've not found any that work. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: SOAP serialization problem
    ... I've snooped the SOAP response, ... and their test client works just fine. ... string XmlTest{ ... deserialization, but I've not found any that work. ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Add Record with combo box
    ... Private Sub JCTARSectionLayer1ID_NotInList(NewData As String, ... Response As Integer) ... Dim strMsg As String ... Dim rst As DAO.Recordset ...
    (microsoft.public.access.formscoding)