Solved

XML Encoded When Passed to a Web Service

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error when loading the database 16 64
Keyboard 2 33
How to call weather service by using asmx? 4 29
Winform Module - What is the ASP.Net equiv 2 19
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

785 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