Re: SOAP fault required for application error?

John Kemp <[email protected]> Mon, 03 Nov 2008 10:59:41 -0500
Newsgroups gmane.text.xml.distributed
Message-ID <[email protected]>
Hello Jim,

ext [email protected] wrote:
> In a request-response scenario, does SOAP 1.2 require that a SOAP fault=
 be
> returned in the case of an application error?

You have touched on what was a controversial point in development of the=20
SOAP specification. Some would say yes, and others probably no.

> In the non-normative SOAP 1.2
> Part 0 document, I find text that says:
>=20
> =E2=80=9CThe SOAP fault model (see SOAP Part 1, section 2.6) requires t=
hat all
> SOAP-specific and application-specific faults be reported using a singl=
e
> distinguished element, env:Fault, carried within the env:Body element.=E2=
=80=9D
>=20
> Which indicates that I am required to return a SOAP fault, but the only
> text I could find in the normative SOAP 1.2 Part 1 document pertaining =
to
> this says:
>=20
> =E2=80=9CAn ultimate SOAP receiver MUST process the SOAP body, in a man=
ner
> consistent with 2.5 Structure and Interpretation of SOAP Bodies. Failur=
e is
> indicated by the generation of a fault (see 5.4 SOAP Fault). SOAP messa=
ge
> processing MAY result in the generation of a SOAP fault; more than one=20
> SOAP fault MUST NOT be generated when processing a SOAP message.=E2=80=9D
>=20
> I don't see the word MUST in the sentence "Failure is indicated by the
> generation of a fault" and I do see the word MAY in the phrase "SOAP
> message processing MAY result in the generation of a SOAP fault", so it
> appears to me that I'm not required to return a SOAP fault in the case =
of
> an application error.

In general, it depends on what you call an application error, and how=20
that relates to what you might call an exception.

I believe (and I did spend quite a lot of time working on SOAP) that the=20
intent of the SOAP specification is that a SOAP fault is used to=20
indicate an exception to normal processing, which is considered a=20
separate thing from an application error, occurring during normal=20
processing.

So if you are a Java programmer, a SOAP fault might be considered=20
roughly equivalent to a Java exception - something try-able and=20
catch-able. That would be something more significant than an application=20
error such as "validation failed for the phone number field".

>=20
> Am I interpreting this correctly?

I think so, yes. But I should note that this is my *opinion*, and that=20
there may be others on this list who have different ones.

In the end, however, the answer that will make sense for you should=20
largely depend on pragmatic concerns - what do your tools/SDKs support?=20
Who will you inter-operate with, and what do they expect?

Regards,

- johnk

>=20
> Jim Hollister
>=20
>=20