Solved

XML Encoded When Passed to a Web Service

Posted on 2002-07-01
5
182 Views
Last Modified: 2010-04-15
Hello,

I am having some trouble with a web service. I have a VB6 client app posting data to a web service. One of the parameters that the web method takes is some XML data. The problem I am having is that when the data gets to the web service it has been encoded and can no long be recognized as XML.  So my XML changes from <test>data</test> to &lt;test&gt;data&lt;/test&gt;  

I used "string" as the data type of the parameter and I am wondering if this is the reason that the XML gets encoded.  

If I switch to "XmlNode" as the data type will it solve my problem?  
Can XmlNode support child nodes such as <test><subtest>data</subtest></test> or will it only work for a single node?
Is there anyway I can solve this problem without changing the data type of the parameter?

I have tried having the client send the data via HTTP POST and SOAP with no change in the result.  
Thanks for your help in advance!
 
0
Comment
Question by:sdn421
  • 2
  • 2
5 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 7122822
With SOAP it should work since the commnication between the client and a webservice is based on SOAP. That's as much as I know... so... something else must be wrong. :-/
0
 
LVL 22

Expert Comment

by:CJ_S
ID: 7122831
0
 
LVL 27

Accepted Solution

by:
BigRat earned 200 total points
ID: 7126610
The problem is that passing "string" will cause the "web object" to encode the data so that the other side can reconstruct the string. Therefore entity encoding takes place. The trouble is that the Web Service expects XML and not "string" so the "decoding" does not take place and consequently an error occurs.

XmlNode is a true XML Node object and consequently can have child nodes, attribute and the like. Since you're communicating with a Web-Service send the XmlNode!
0
 
LVL 1

Author Comment

by:sdn421
ID: 7127375
There was no error when I tried to turn the string into XML. It just encoded the text and would not unencode it.  

I have already switched to the XmlNode as the data type. This works, but I had to get the client to change its call to use a complex SOAP data type or else the XML still gets encoded!  It has been a pain in the ass, but I think I figured it out.  

Thanks for trying.
0
 
LVL 27

Expert Comment

by:BigRat
ID: 7127536
Yes, he must in order to run a proper Web Service!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now