Re: SOAP serialization problem
- From: Jeff Dege <jdege@xxxxxxxxxxxxxx>
- Date: Fri, 14 Aug 2009 09:49:01 -0500
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 serviceContact the Web Service provider?
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?
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"Cannot assign object of type System.Xml.XmlNode[] to an object of type
order for ASP.NET to work with their responses, what change do they
need to make?
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.
.
- Follow-Ups:
- Re: SOAP serialization problem
- From: Mr. Arnold
- Re: SOAP serialization problem
- References:
- SOAP serialization problem
- From: Jeff Dege
- Re: SOAP serialization problem
- From: Mr. Arnold
- Re: SOAP serialization problem
- From: Jeff Dege
- Re: SOAP serialization problem
- From: Mr. Arnold
- SOAP serialization problem
- Prev by Date: javascript problem,onchange event not working
- Next by Date: Re: Purpose of sectionGroup's "type" attribute in "web.config"
- Previous by thread: Re: SOAP serialization problem
- Next by thread: Re: SOAP serialization problem
- Index(es):
Relevant Pages
|