I have also noticed this and I have reported it as a bug (to Apache via Bugzilla).
The workaround I am using is encapsulating all FAULT data (ie message in thrown
exception) with "<![CDATA[" and "]]>". Sample) Error message "Number should be < 55"
is sent with throw new SOAPException("<![CDATA[Number should be < 55]]>"). This tells
XML parser not to interpret encapsulated text. It works fine for me.
/Micael E.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 24, 2001 2:01 PM
To: [EMAIL PROTECTED]
Subject: Probelm concerning String serialization of Excpetions
Hi!
I've encountered a serious problem in case throwing an exception.
The exception is thrown within a service call and should be transport to the
soapclient.
It is serialized within a FAULT tag as shown below:
...
<faultstring>
SGTEXC_MEXC_CODE: ENA2_0002
SGTEXC_MEXC_INFO: Requested currency <EUR> differes from policy currency
<DEM>
</faultstring>
<faultactor>/soap/servlet/rpcrouter</faultactor>
<detail>
<stackTrace>
SGTEXC_MEXC_CODE: ENA2_0002 SGTEXC_MEXC_SEVERITY: 8
SGTEXC_MEXC_INFO: Requested currency &lt;EUR&gt; differes from
policy currency &lt;DEM&gt;
...
My problem is, that the exception message string contains "<" and ">"
characters. In the <detail> part of the soap message this characters are
serialized
to > and < but in the <faultstring> they aren't translated. This
causes a crimpson parser exception, and the exception I want to show to the
client is invisible.
As a work around I translate the strings before creation of an exception.
Is there any reason to handle the faulstring and the detail part
different??? Or is that something which belongs on the buglist?
Michael
---------------------------------------------------------------------
This message is intended for the addressee or its representative only. Any
form of unauthorized use, publication, reproduction, copying or disclosure
of the content of this e-mail is not permitted. If you are not the intended
recipient of this e-mail message and its contents, please notify the sender
immediately and delete this message and all its attachments subsequently.