|
|
|
start date: Wed, 22 Aug 2007 15:30:59 +0200,
posted on: microsoft.public.dotnet.framework.aspnet.webservices
back
| Thread Index |
|
1
msdnuniv am
|
|
2
John Saunders [MVP] john.saunders at trizetto.com
|
|
3
(Steven Cheng[MSFT])
|
exception on Response Envelope, Error in XML-document
Hello!
i am desparetely trying to consume a PHP Webservice in VB.NET 2005.
I can add the webreference, compile without errors and see the methods of
the webservice.
But on runtime it tells me {"There is an error in XML document (6, 62)."}.
Inner Exception:
{"Cannot assign object of type System.Xml.XmlNode[] to an object of type
System.String."}
Envelope that comes from the webservice:
_________________________________________
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:ns1='urn:xmethods-mhd_ArticleDetails'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:ns2='http://xml.apache.org/xml-soap'
xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/'
SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
<SOAP-ENV:Body>
<ns1:getArticleDetailsResponse>
<details xsi:type='ns2:Map'>
<item>
<key xsi:type='xsd:string'>
title
</key>
<value xsi:type='xsd:string'>
SGB 3 Sozialgesetzbuch Drittes Buch
</value>
</item>
<item>
<key xsi:type='xsd:string'>
headline
</key>
<value xsi:type='xsd:string'>
Viertes Kapitel: Leistungen an Arbeitnehmer Achter
Abschnitt: Entgeltersatzleistungen Zweiter Unterabschnitt: Arbeitslosengeld
Erster Titel: Regelvoraussetzungen
</value>
</item>
</details>
</ns1:getArticleDetailsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Relevant part of WSDL (no complex types because i did not get them to import
at all in .NET):
__________________________
<message name="getArticleDetailsRequest">
<part name="artId" type="xsd:int"/>
</message>
<message name="getArticleDetailsResponse">
<part name="details" type="xsd:ArrayOfString"/>
</message>
____________
Strange: I defined ArrayOfString, but .NET expects just string.
How can I get that to run?
Thank you!
Best Regards,
Dirk
Date:Wed, 22 Aug 2007 15:30:59 +0200
Author:
|
Re: exception on Response Envelope, Error in XML-document
"msdnuniv" <dm4dm@newsgroup.nospam> wrote in message
news:O1zfjCM5HHA.5844@TK2MSFTNGP02.phx.gbl...
> Hello!
>
> i am desparetely trying to consume a PHP Webservice in VB.NET 2005.
> I can add the webreference, compile without errors and see the methods of
> the webservice.
> But on runtime it tells me {"There is an error in XML document (6, 62)."}.
> Inner Exception:
> {"Cannot assign object of type System.Xml.XmlNode[] to an object of type
> System.String."}
>
> Envelope that comes from the webservice:
> _________________________________________
>
> <?xml version='1.0' encoding='UTF-8'?>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
> xmlns:ns1='urn:xmethods-mhd_ArticleDetails'
> xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
> xmlns:xsd='http://www.w3.org/2001/XMLSchema'
> xmlns:ns2='http://xml.apache.org/xml-soap'
> xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/'
> SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
> <SOAP-ENV:Body>
> <ns1:getArticleDetailsResponse>
> <details xsi:type='ns2:Map'>
> <item>
> <key xsi:type='xsd:string'>
> title
> </key>
> <value xsi:type='xsd:string'>
> SGB 3 Sozialgesetzbuch Drittes Buch
> </value>
> </item>
> <item>
> <key xsi:type='xsd:string'>
> headline
> </key>
> <value xsi:type='xsd:string'>
> Viertes Kapitel: Leistungen an Arbeitnehmer Achter
> Abschnitt: Entgeltersatzleistungen Zweiter Unterabschnitt:
> Arbeitslosengeld Erster Titel: Regelvoraussetzungen
> </value>
> </item>
> </details>
> </ns1:getArticleDetailsResponse>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
>
> Relevant part of WSDL (no complex types because i did not get them to
> import at all in .NET):
> __________________________
> <message name="getArticleDetailsRequest">
> <part name="artId" type="xsd:int"/>
> </message>
>
> <message name="getArticleDetailsResponse">
> <part name="details" type="xsd:ArrayOfString"/>
> </message>
> ____________
>
> Strange: I defined ArrayOfString, but .NET expects just string.
Please post the WSDL, so we can see _how_ you defined ArrayOfString.
Also, why did you define it in the "xsd" namespace? That's not your
namespace, so you don't get to change it.
Also, it doesn't look like the service is sending ArrayOfString, unless
ArrayOfString is the same thing as ns2:Map.
--
John Saunders [MVP]
Date:Wed, 22 Aug 2007 13:03:18 -0400
Author:
|
Re: exception on Response Envelope, Error in XML-document
thanks for John's input.
Hi Dirk,
I agree with John that the problem is likely caused by the type mismatching
between the generated webservice client proxy and the corresponding object
member in the SOAP response message. As the following line indicates:
=========
{"Cannot assign object of type System.Xml.XmlNode[] to an object of type
System.String."}
=========
the webservice proxy class contains a string member while the SOAP response
message return an node list(array), at least the .net webservice
deserializer deserialize it into a nodelist which cause the type
mismatching problem.
Please feel free to post some further info(like WSDL document) so that we
can have a look and perform some test on it.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Date:Thu, 23 Aug 2007 05:19:51 GMT
Author:
|
|
|