Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / November 2004

Tip: Looking for answers? Try searching our database.

How can UTF-16 data be supported in Web Service?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
joep - 18 Nov 2004 22:43 GMT
We have a Web Service that appears to handle some Unicode data properly. We
have our web.config file set for Unicode encoding of socket messages to our
backend server application (i.e., Encoding.Unicode) and we have the
globalization settings for requestEncoding and responseEncoding set to utf-8.
I have successfully sent and received utf-8 data via a C++ client using gSoap
thru the Web Service and backend server. I have done the same via ASP.NET C#
web samples as well.

However, I tried changing the requestEncoding and responseEncoding of the
web.config file for the Web Service to utf-16 and started running into
issues. One thing I noticed is that with this setting, I can display the Web
Service in IE (navigating to http://localhost/MyService/MyService.asmx), but
when I try to view the WSDL (via the Service Desription link,
http://localhost/MyService/MyService.asmx?WSDL) it doesn't load it. I'm not
able to get the clients to work with these utf-16 settings either. What all
needs to be changed to handle utf-16 (all file encodings are utf-8 but I
don't know if that matters...)?

Thanks.
Dan Rogers - 18 Nov 2004 23:33 GMT
Hi,

In general, the clients will need to be set up with the same web.config
(but in app.config) that you made on the server.  The IE issues are going
to be different, since the WSDL is now (hopefully) being generated in
UTF-16, and the automatic XSLT may not be able to deal with a UTF-16
encoded XML document.  Since UTF-8 can handle most double byte characters,
what is the business need driving your decision to switch things over?

As far as writing out files, you'll have to make sure you write out using
an encoding sensitive writer - and presuming that any string data is
properly decoded to Unicode and then written out as UTF-16 (the
XmlTextWriter can do this if you use the proper over-ride), the actual data
should be fine.

I hope this helps,

Dan Rogers
Microsoft Corporation
--------------------
>Thread-Topic: How can UTF-16 data be supported in Web Service?
>thread-index: AcTNv/mXGPn79uNjTcKcoWN7935mIw==
[quoted text clipped - 17 lines]
>Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
>Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:26697
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
[quoted text clipped - 17 lines]
>
>Thanks.
joep - 30 Nov 2004 16:55 GMT
I did modify the ASP.NET web samples web.config files to match the web
service settings of utf-16 for requestEncoding and responseEncoding and I
could not get it to work. Have you tried this? I must be missing some piece.

As far as the business need for utf-16 - there is no real requirement for it
except that our customers may choose to modify the web service web.config
file and set it to utf-16 for their needs (i.e., reading in data from a file
saved in utf-16 format). I just wanted to make sure our sample clients would
work if they chose to do that. We will default our web service and sample
clients to utf-8 as I know that works fine. Thanks.

> Hi,
>
[quoted text clipped - 68 lines]
> >
> >Thanks.
Dan Rogers - 30 Nov 2004 22:02 GMT
Hi Joe,

If it works in UTF-8 but not in UTF-16, then I suspect there is some issue
with the actual data you are dealing with.  The serializer is perfectly
capable of processing incoming data in UTF-16 (yes, I've tried this).  
Getting data written out that you can read and test with in UTF-16 is an
option on the serializer.

As for "what if the clients choose" - my advice is to make the encoding of
responses a part of the service contract that you make when you acquire a
client that you wish to support.  Making an incoming UTF-16 request turn
into a UTF-16 response, when the server normally sends responses in UTF-8
is nigh difficult.  My advice is to be able to accept requests encoded in
UTF-8, but set expectations that all responses will be in the default XML
encoding (UTF-8).  This is what we decided was reasonable when we wrote the
UDDI specifications.

I hope this helps

Dan Rogers
Microsoft Corporation
--------------------
>Thread-Topic: How can UTF-16 data be supported in Web Service?
>thread-index: AcTW/Vmew73JCaLOQeO2gPazZfM6lw==
>X-WBNR-Posting-Host: 24.196.79.14
>From: "=?Utf-8?B?am9lcA==?=" <joep@discussions.microsoft.com>
>References:  <87C55948-1626-4D0A-9D39-E799FBF4698B@microsoft.com>
<5f7FDcczEHA.3820@cpmsftngxa10.phx.gbl>
>Subject: RE: How can UTF-16 data be supported in Web Service?
>Date: Tue, 30 Nov 2004 08:55:09 -0800
[quoted text clipped - 12 lines]
>NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
>Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGXA0
3.phx.gbl
>Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:26893
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
>
[quoted text clipped - 81 lines]
>> >
>> >Thanks.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.