RE: SP1 Problem SOAPException doesn't return quote and Umlaute correcty

From: Dan Rogers (danro_at_microsoft.com)
Date: 12/07/04


Date: Tue, 07 Dec 2004 20:36:25 GMT

Hi Dany,

I suspect that there is an encoding issue in the way you are loading the
XML. Is there an inconsistency between the XML encoding mark up and the
actual encoding on the wire? UrlEncoded XML is supported by the DOM, but
if someone somewhere along the way is loading what looks like the XML into
a unicode string without doing an encoding conversion first, issues can
happen.

As for how/why this happened - I'm not that guy. For the most part, 1.1
fixed bugs. It is possible that it introduced some as well. I'll see what
I can dig up from the serialization team - can't promise they have a fix,
but I'll see.

Dan
--------------------
Date: Tue, 7 Dec 2004 14:00:36 +0100
References: <uCfPi7f2EHA.3132@TK2MSFTNGP14.phx.gbl>
        <hzdWUQ92EHA.3200@cpmsftngxa10.phx.gbl>
X-Newsreader: Groupwise 6.5
From: Dany <Dany@newsgroups.com>
Subject: RE: SP1 Problem SOAPException doesn't return quote and Umlaute
        correcty
Message-ID: <eDppBzF3EHA.2316@TK2MSFTNGP15.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: gonzo.opus.ch 213.200.237.2
Lines: 1
Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP15
phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices:7944
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

Found out .net web service clients are just as helpless with handling these
character references.

I've built a simple web service consumer in VC#. On a button click the
following code is executed:
                        try
                        {
                                localhost.UmbrellaNTAppServer appserv = new
localhost.UmbrellaNTAppServer();
                                string result = appserv.HelloWorld();
                                MessageBox.Show( result );
                        }
                        catch (Exception exc)
                        {
                                                               
MessageBox.Show( "Error has occured: " + exc.Message );
                        }

If an exception is raised in the web service method saying i.e. 'The method
"HelloWorld" is under construction.' as the exception message. The user
will be shown 'Error has occured: The method &quot;HelloWorld&quot; is
under construction. In a real world example the user would be sure to
complain about this display.

Before SP1 everything was fine, but now handling of exception messages
coming from web service calls must be handled specifically.
In normal SOAP responses (not SOAP faults) strings containing special
characters are correctly sent. So if 'The method "HelloWorld" is under
construction.' is returned the client will also receive it unchanged and
without any character references.

So I wonder why this inconsistent behaviour was built into the SP1 by MS.

Regards Dany

>>> Dan Rogers<danro@microsoft.com> 06.12.2004 21:42:15 >>>
Hi,

What you are describing is the use of encoded strings. These are, to my
knowlege, valid in XML and the responsibility of the parser to convert
properly.

What is the source of the problem, given that these are valid
representations of the data? Is the client not able to process these
properly as it should?

Regards

Dan Rogers
Microsoft Corporation

--------------------
Date: Sat, 4 Dec 2004 13:43:30 +0100
X-Newsreader: Groupwise 6.5
From: Dany <Dany@newsgroups.com>
Subject: SP1 Problem SOAPException doesn't return quote and Umlaute correcty
Message-ID: <uCfPi7f2EHA.3132@TK2MSFTNGP14.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.webservices
NNTP-Posting-Host: adsl-62-167-138-146.adslplus.ch 62.167.138.146
Lines: 1
Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14
phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.webservices:7851
X-Tomcat-NG: microsoft.public.dotnet.framework.webservices

Our web service was working fine until we installed .net Framework 1.1
service pack 1. Uninstalling SP1 is not an option because our largest
customer says service packs marked as "critical" by Microsoft must be
installed on their servers.

Now german Umlaute (ä, ü, ö) and quotes are returned incorrectly in SOAP
fault responses.
This can be easily verified:

Implement the following in a web service method (just raises a
SOAPException with a message text containing quote characters ("):

  string errMsg = "Here is a \"quote\".";
  throw new SoapException( errMsg,new XmlQualifiedName("Server.Problem"));

The following SOAP response is created when calling this SOAP-Exception:

HTTP/1.1 500 Internal Server Error.
Server: Microsoft-IIS/5.1
Date: Fri, 03 Dec 2004 13:02:23 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Content-Length: 431

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <soap:Fault>
      <faultcode>Server.Problem</faultcode>
      <faultstring>Here is a &quot;quote&quot;.</faultstring>
      <detail />
    </soap:Fault>
  </soap:Body>
</soap:Envelope>

All though the encoding should be utf-8 and "& q u o t ;" is not correct.
This worked fine in .net 1.1 without the SP1. The correct <faultstring>
should be:
      <faultstring>Here is a "quote".</faultstring>

This problem also occurs when using german Umlaute: f.e. with an exception
message of "Fahrvergnügen". It is converted incorrectly to
<faultstring>Fahrvergn&amp;#252;gen</faultstring>.

This is a serious problem for us, because in german and french many error
messages will have special characters like ö,ä, é, à in them and these are
not correctly processed.

Thanks for any help!
Dany


Quantcast