XML Deserializing issue

V

VGE

We are consuming a web service and we receive the following response soap:

ResponseCode: 200 (OK)
X-SOAP-Server:NuSOAP/0.7.2 (1.6)
Keep-Alive:timeout=15, max=100
Connection:Keep-Alive
Content-Length:1540
Content-Type:text/xml; charset=ISO-8859-1
Date:Thu, 10 Apr 2008 01:29:51 GMT
Server:Apache
X-Powered-By:pHP/5.2.5

<?xml version="1.0" encoding="utf-16"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<getQuoteResponse xmlns="urn:pngwsdl">
<quoteResponse>
<pngRequestId>VGE0409200813976API674700055047</pngRequestId>
<site>
<street>2520 Whitehall Park Dr</street>
<city>Charlotte</city>
<state>NC</state>
<zip>28273</zip>
<npa>704</npa>
<nxx>555</nxx>
</site>
<quotes>
<item>
<quoteId>VGETB00409200813977API021200129473</quoteId>
<carrier>Broadwing</carrier>
<term>12</term>
<expirationDate>2008-05-09</expirationDate>
<loopMRC>308</loopMRC>
<loopNRC>0</loopNRC>
<portMRC>358</portMRC>
<portNRC>0</portNRC>
</item>
<item>
<quoteId>VGETB00409200813983API023600182299</quoteId>
<carrier>Broadwing</carrier>
<term>36</term>
<expirationDate>2008-05-09</expirationDate>
<loopMRC>272</loopMRC>
<loopNRC>0</loopNRC>
<portMRC>287</portMRC>
<portNRC>0</portNRC>
</item>
<item>
<quoteId>VGETB00409200813982API022400121435</quoteId>
<carrier>Broadwing</carrier>
<term>24</term>
<expirationDate>2008-05-09</expirationDate>
<loopMRC>281</loopMRC>
<loopNRC>0</loopNRC>
<portMRC>310</portMRC>
<portNRC>0</portNRC>
</item>
</quotes>
<message>Verizon, Paetec, XO, Qwest failed to return valid
pricing or support the service type and bandwidth of this request.</message>
</quoteResponse>
</getQuoteResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


However the object as created by the Framework contains all nulls and
has the following hierarchy:

getQuote
Headers
Body
quoteResponse
pngResultId = null
site = null
siteZ = null
quotes = null
message = null

If I manually deserialize the soap response it creates the object with
the above structure except with the appropriate data. How do I fix this
so that the object generated by the framework will populate correctly
with the data when the response is received?

I hope that explains the question.

Thanks,

Neville Kelly
VGE
 
S

Steven Cheng [MSFT]

Hi Neville,

From your description, when consuming one webservice, you found that your
client proxy doesn't correctly populate the properties of the response
object, correct?

As for the webservice, is it an ASP.NET webservice or generated upon other
platform? Since the SOAP message does carry the XML data, it does be likely
a XML deserialization issue. is it possible that you provide a publich
accessible url , I'd like to perform some test on my side to have a further
look.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
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, 10 Apr 2008 16:06:29 -0400
From: VGE <[email protected]>
User-Agent: Thunderbird 2.0.0.12 (Windows/20080213)
MIME-Version: 1.0
Subject: XML Deserializing issue
 
V

VGE

Here is the url to the web service. And the request input. When adding
the web service you have to add it as a 2.0 service since 3.0/3.5 will
not consume it correctly. It was created using NuSoap, that is all I
know about it since it is not ours we are just trying to consume it.

Url:
http://ecare.pngcom.com/agentportal2/dedicated/WSTest/PNGQuote.php?WSDL

Request Input:
<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<getQuote xmlns="urn:pngwsdl">
<quoteRequest user="VGE" password="plops" xmlns="">
<site>
<street>2520 Whitehall Park Dr</street>
<city>Charlotte</city>
<state>NC</state>
<zip>28273</zip>
<npa>704</npa>
<nxx>555</nxx>
</site>
<siteZ>
<street />
<city />
<state />
<zip>0</zip>
<npa>0</npa>
<nxx>0</nxx>
</siteZ>
<serviceType>Data</serviceType>
<customId />
<bandwidth>DS-1</bandwidth>
</quoteRequest>
</getQuote>
</soap:Body>
</soap:Envelope>

Thanks,

Neville Kelly
VGE
 
S

Steven Cheng [MSFT]

Hi VGE,

Regarding on the the test url you provided. I've visited it and try
generating proxy and consume it. I've used the request sample you provided
and the webservice call did reach the server. However, it report an
authentication error, indicate that I need to supply username/password.

Is there a test account you can provide me for test? If its not that
confidential, you can send it to me offline by the following email:

"stcheng" +"@" + "microsoft.com"

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
S

Steven Cheng [MSFT]

Hi VGE,

I've got the credentials and have performed some further tests.

Based on more tests(I save the response content into xml file and manually
use Xmlserialzier to deserialize them), I found that the problem is due to
the namespace setting for the classes defined in the auto-generated proxy
file. The response content is as below:

===============
<getQuoteResponse xmlns="urn:pngwsdl">
<quoteResponse>
<pngRequestId>VGE0416200827251API168700006528</pngRequestId><site><street>25
20 Whitehall Park
.........
============

that means the <quoteResponse> element and its children are all under
"urn:pngwsdl". However, in the auto-generated proxy classes, it use the
following attributes to decorate the nested child elements of
"quoteResponse" element:

=================
.....................
public partial class quoteResponse {

private string pngRequestIdField;

private site siteField;

private site siteZField;

private quoteArray quotesField;

private string messageField;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string pngRequestId {
get {
return this.pngRequestIdField;
}
set {
this.pngRequestIdField = value;
}
}

....................
=========================

the [System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Unqualified)] result the .NET
xmlserializer look for elements that doesn't have a namespace associated
and then fail to deserlize those properties in the children of
"quoteResponse" element.

Currently a quick way to resolve the problem is customize the types in the
generated proxy code. Here is a complete list of the modified properties:

=========================
System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml",
"2.0.50727.1433")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:pngwsdl")]
public partial class quoteResponse {

private string pngRequestIdField;

private site siteField;

private site siteZField;

private quoteArray quotesField;

private string messageField;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "urn:pngwsdl")]
public string pngRequestId {
get {
return this.pngRequestIdField;
}
set {
this.pngRequestIdField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "urn:pngwsdl")]
public site site {
get {
return this.siteField;
}
set {
this.siteField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "urn:pngwsdl")]
public site siteZ {
get {
return this.siteZField;
}
set {
this.siteZField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "urn:pngwsdl")]
public quoteArray quotes {
get {
return this.quotesField;
}
set {
this.quotesField = value;
}
}

/// <remarks/>

[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
maForm.Qualified, Namespace="urn:pngwsdl")]
public string message {
get {
return this.messageField;
}
set {
this.messageField = value;
}
}
}
===========================

I've tested it and it worked correctly on my side. You can test it to see
whether it works also.

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.



--------------------
From: (e-mail address removed) (Steven Cheng [MSFT])
Organization: Microsoft
Date: Tue, 15 Apr 2008 06:37:09 GMT
Subject: Re: XML Deserializing issue
 
V

VGE

Thank you for the huge help. I was wondering if I wanted to go back to
the vendor in this case and tell them to fix their web service what
would be the best thing to say?

Thanks

Neville Kelly
VGE
Hi VGE,

I've got the credentials and have performed some further tests.

Based on more tests(I save the response content into xml file and manually
use Xmlserialzier to deserialize them), I found that the problem is due to
the namespace setting for the classes defined in the auto-generated proxy
file. The response content is as below:

===============
<getQuoteResponse xmlns="urn:pngwsdl">
<quoteResponse>
<pngRequestId>VGE0416200827251API168700006528</pngRequestId><site><street>25
20 Whitehall Park
........
============

that means the <quoteResponse> element and its children are all under
"urn:pngwsdl". However, in the auto-generated proxy classes, it use the
following attributes to decorate the nested child elements of
"quoteResponse" element:

=================
....................
public partial class quoteResponse {

private string pngRequestIdField;

private site siteField;

private site siteZField;

private quoteArray quotesField;

private string messageField;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string pngRequestId {
get {
return this.pngRequestIdField;
}
set {
this.pngRequestIdField = value;
}
}

...................
=========================

the [System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Unqualified)] result the .NET
xmlserializer look for elements that doesn't have a namespace associated
and then fail to deserlize those properties in the children of
"quoteResponse" element.

Currently a quick way to resolve the problem is customize the types in the
generated proxy code. Here is a complete list of the modified properties:

=========================
System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml",
"2.0.50727.1433")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:pngwsdl")]
public partial class quoteResponse {

private string pngRequestIdField;

private site siteField;

private site siteZField;

private quoteArray quotesField;

private string messageField;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "urn:pngwsdl")]
public string pngRequestId {
get {
return this.pngRequestIdField;
}
set {
this.pngRequestIdField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "urn:pngwsdl")]
public site site {
get {
return this.siteField;
}
set {
this.siteField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "urn:pngwsdl")]
public site siteZ {
get {
return this.siteZField;
}
set {
this.siteZField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "urn:pngwsdl")]
public quoteArray quotes {
get {
return this.quotesField;
}
set {
this.quotesField = value;
}
}

/// <remarks/>

[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
maForm.Qualified, Namespace="urn:pngwsdl")]
public string message {
get {
return this.messageField;
}
set {
this.messageField = value;
}
}
}
===========================

I've tested it and it worked correctly on my side. You can test it to see
whether it works also.

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.



--------------------
From: (e-mail address removed) (Steven Cheng [MSFT])
Organization: Microsoft
Date: Tue, 15 Apr 2008 06:37:09 GMT
Subject: Re: XML Deserializing issue
Hi VGE,

Regarding on the the test url you provided. I've visited it and try
generating proxy and consume it. I've used the request sample you provided
and the webservice call did reach the server. However, it report an
authentication error, indicate that I need to supply username/password.

Is there a test account you can provide me for test? If its not that
confidential, you can send it to me offline by the following email:

"stcheng" +"@" + "microsoft.com"

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
 
S

Steven Cheng [MSFT]

Hi Neville,

Thanks for your reply.

So far I think you do not need to modify the WSDL since the problem here is
also related to the wsdl.exe's code generation. This maybe a particular
case in which the WSDL's type definiation(schema) make the code generation
misunderstand the type's namespace. And it would be time consuming to find
a new scheme style that will make the generation work correctly.
Therefore, I think you can use the workaround mentioned earlier if you need
a quick fix.

Regards,

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
Date: Wed, 16 Apr 2008 10:54:02 -0400
From: VGE <[email protected]>
User-Agent: Thunderbird 2.0.0.12 (Windows/20080213)
MIME-Version: 1.0
Subject: Re: XML Deserializing issue
References: <[email protected]>
Thank you for the huge help. I was wondering if I wanted to go back to
the vendor in this case and tell them to fix their web service what
would be the best thing to say?

Thanks

Neville Kelly
VGE
Hi VGE,

I've got the credentials and have performed some further tests.

Based on more tests(I save the response content into xml file and manually
use Xmlserialzier to deserialize them), I found that the problem is due to
the namespace setting for the classes defined in the auto-generated proxy
file. The response content is as below:

===============
<getQuoteResponse xmlns="urn:pngwsdl">
<quoteResponse>
20 Whitehall Park
........
============

that means the <quoteResponse> element and its children are all under
"urn:pngwsdl". However, in the auto-generated proxy classes, it use the
following attributes to decorate the nested child elements of
"quoteResponse" element:

=================
....................
public partial class quoteResponse {

private string pngRequestIdField;

private site siteField;

private site siteZField;

private quoteArray quotesField;

private string messageField;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string pngRequestId {
get {
return this.pngRequestIdField;
}
set {
this.pngRequestIdField = value;
}
}

...................
=========================

the [System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Unqualified)] result the .NET
xmlserializer look for elements that doesn't have a namespace associated
and then fail to deserlize those properties in the children of
"quoteResponse" element.

Currently a quick way to resolve the problem is customize the types in the
generated proxy code. Here is a complete list of the modified properties:

=========================
System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml",
"2.0.50727.1433")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:pngwsdl")]
public partial class quoteResponse {

private string pngRequestIdField;

private site siteField;

private site siteZField;

private quoteArray quotesField;

private string messageField;

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "urn:pngwsdl")]
public string pngRequestId {
get {
return this.pngRequestIdField;
}
set {
this.pngRequestIdField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "urn:pngwsdl")]
public site site {
get {
return this.siteField;
}
set {
this.siteField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "urn:pngwsdl")]
public site siteZ {
get {
return this.siteZField;
}
set {
this.siteZField = value;
}
}

/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form =
System.Xml.Schema.XmlSchemaForm.Qualified, Namespace = "urn:pngwsdl")]
public quoteArray quotes {
get {
return this.quotesField;
}
set {
this.quotesField = value;
}
}

/// <remarks/>

[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSche
maForm.Qualified, Namespace="urn:pngwsdl")]
public string message {
get {
return this.messageField;
}
set {
this.messageField = value;
}
}
}
===========================

I've tested it and it worked correctly on my side. You can test it to see
whether it works also.

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.



--------------------
From: (e-mail address removed) (Steven Cheng [MSFT])
Organization: Microsoft
Date: Tue, 15 Apr 2008 06:37:09 GMT
Subject: Re: XML Deserializing issue
Hi VGE,

Regarding on the the test url you provided. I've visited it and try
generating proxy and consume it. I've used the request sample you provided
and the webservice call did reach the server. However, it report an
authentication error, indicate that I need to supply username/password.

Is there a test account you can provide me for test? If its not that
confidential, you can send it to me offline by the following email:

"stcheng" +"@" + "microsoft.com"

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top