P
Philip Crooks
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
inherits from:
Microsoft.Web.Services.WebServicesClientProtocol
rather than:
System.Web.Services.Protocols.SoapHttpClientProtocol
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:
<globalization requestEncoding="utf-16"
responseEncoding="utf-16"/>
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
service:
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
declaration?
Thanks in advance,
Philip
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
inherits from:
Microsoft.Web.Services.WebServicesClientProtocol
rather than:
System.Web.Services.Protocols.SoapHttpClientProtocol
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:
<globalization requestEncoding="utf-16"
responseEncoding="utf-16"/>
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
service:
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
declaration?
Thanks in advance,
Philip