Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

XML Encoded When Passed to a Web Service

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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