Solved

XML Encoded When Passed to a Web Service

Posted on 2002-07-01
5
185 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
XML & .net 5 40
ASP.NET Web API or ASP.NET Core MVC? 3 52
New to SOAP and need some direction 10 44
Interview questions for support of a legacy ASP.NET site 4 38
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 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

19 Experts available now in Live!

Get 1:1 Help Now