Changing request encoding
Does anyone know how to change the encoding attribute in the xml
declaration of a webmethod request?
I have an ASP.NET client web application which makes calls into an
ASP.NET web service. The calls are made through client-side proxy
code, autogenerated by Visual Studio.NET via a web reference. I'm
using the Web Service Enhancements 1.0 so my client-side proxy class
The client passes a dataset to the web service, where the dataset may
contain some characters that aren't included in the utf-8 range.
Currently, when the dataset arrives on the web service these
characters have been turned into "???". I've been trying to switch to
unicode encoding to cope with this. I've set the globalization
attributes in my web.config for the web service:
Also, in the client code, I explicitly set the request encoding on the
web service proxy object:
wsProxy.RequestEncoding = System.Text.Encoding.Unicode;
When the client attempts a webmethod call I get an error from the web
System.Web.Services.Protocols.SoapException: Server was unable to
read request. ---> System.Xml.XmlException: There is invalid data at
the root level. Line 1, position 1.
When I check the request using the MsSoapT trace utility (from
Microsoft's SOAP Toolkit) it shows the client request's xml
declaration with encoding "utf-8":
<?xml version="1.0" encoding="utf-8" ?>
I expected this encoding to be "utf-16" and I'm guessing that this is
something to do with the error.
Does anyone have any ideas how I can change the encoding in the xml
Thanks in advance,
|All times are GMT. The time now is 07:06 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.