Re: SOAP serialization problem
- From: "Mr. Arnold" <MR. Arnold@xxxxxxxxxx>
- Date: Fri, 14 Aug 2009 15:09:14 -0400
"Jeff Dege" <jdege@xxxxxxxxxxxxxx> wrote in message news:zrqdnTLRVu5cPBjXnZ2dnUVZ_g1i4p2d@xxxxxxxxxxxxxx
On Fri, 14 Aug 2009 12:11:32 -0400, Mr. Arnold wrote:
"Jeff Dege" <jdege@xxxxxxxxxxxxxx> wrote in message
news:EYOdnYniw9bA5BjXnZ2dnUVZ_r9i4p2d@xxxxxxxxxxxxxx
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
order for ASP.NET to work with their responses, what change do they
need to make?
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?
You say they have a test client that worked? Test client based on what
platform solution, .NET?
No. I think they're testing it with a PHP web page.
They have any other clients that are .NET that worked, other than you,
that it doesn't work?
Nope.
I would say that they are going to have to provide a XML solution that's
going to work on the .NET platform if they have not already done so.
This is an interface that's being written specifically for the project,
there are no other customers, just me.
I've never tried to connect to an rpc/encoded SOAP service before, and
I've never had a problem connecting to a document/literal SOAP service.
And it's not like we're passing complex arguments - string in and string
out.
When we first raised the issue, they came back with "the PHP SOAP
extension only support rpc/encoded". A fair amount of web browsing has
convinced me that's simply not true, for recent versions of the PHP SOAP
extension, at least.
At this point, I'm faced with either finding some other tool to interface
with the webservice that better supports rpc/encoded (which will be
difficult, because all of the library code for handling the data is
written in .NET, or convincing them to switch to document/literal, with
no guarantee that there won't still be problems.
Is there a way I can write a SOAP client that gets the SOAP response
before the deserialization? If I could, I could parse the response
myself. But SoapHttpClientProtocol.Invoke() returns the result of the
deserialization, I can't see how to access the raw response..
You're the client and you are the customer of a Web service that's for your use only. I don't believe that the Web service provider is limited to rpc/encoded SOAP service. Are you not the one that's driving the requrement? You force them to provide a document/literal SOAP service, which is viable to .NET.
<http://www.developerfusion.com/article/4694/web-services-interoperability-between-j2ee-and-net-part-1/3>
<copied>
However, the RPC/encoded way of doing things existed long before XML Schema or WSDL came into existence; even then, some encoding rules still can not be expressed in XSD. Even though SOAP encoding is recognized as one of the major sources of the Web services interoperability problems and, combined with the fact that the ASP.NET WebMethod infrastructure defaults to Document/literal , most of the J2EE Web services tools defaulted to RPC/encoded , until recently
<end copy>
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4336 (20090814) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
.
- Follow-Ups:
- Re: SOAP serialization problem
- From: Jeff Dege
- 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
- Re: SOAP serialization problem
- From: Jeff Dege
- Re: SOAP serialization problem
- From: Mr. Arnold
- Re: SOAP serialization problem
- From: Jeff Dege
- SOAP serialization problem
- Prev by Date: Re: SOAP serialization problem
- Next by Date: Re: what is the difference between the vb dot net and asp dot net
- Previous by thread: Re: SOAP serialization problem
- Next by thread: Re: SOAP serialization problem
- Index(es):
Relevant Pages
|
Loading