You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Trevor Porter <Tr...@corp.palm.com> on 2001/03/15 01:37:22 UTC

Questions regarding faultcode in SOAP fault element and the Apach e's implementation

Hi,

I have two questions related to the SOAP fault element:

1. What is considered the most appropriate way to return an
application-specific error code and error string in a SOAP fault element?
The SOAP 1.1 spec says that the faultcode element MUST be one of the
qualified names defined in the spec but I've seen plenty of examples where
application-specific codes are returned in the faultcode even though the
spec seems to disapprove of this. So, is it more appropriate to use the
detail element for application-specific data like this:

<SOAP-ENV:Fault>
  <faultcode>SOAP-ENV:Server</faultcode>
  <faultstring>Some error string</faultstring>
  <detail>
    <e:faultdetails xmlns:e="Some-URI">
      <errorcode>100</errorcode>
      <errorstring>some error string</errorstring>
    </e:faultdetails>
  </detail>
</SOAP-ENV:Fault>

Or is this okay:

<SOAP-ENV:Fault>
  <faultcode>100</faultcode>
  <faultstring>some error string</faultstring>
</SOAP-ENV:Fault>

2. How in the Apache SOAP implementation, can I override the faultcode with
my own. Throwing the following exception in my server code doesn't do the
trick:

throw new SOAPException( "100", "some error string" );

Any insight is greatly appreciated.

...Trevor