hi,
I have to implement a doc/lit-webservice (B2B) for our order-system. Our order-system is based on servlets, ejb-components
and jboss4. On basis of this application-environment we decided to implement the webservice as an ejb service endpoint.
To learn more about jbossws I created a little test-order-application (doing: xsd -> wsdl -> wscompile -> sessionbean -> delpoy).
Everything works fine, but I have problems with the errorhandling of the webservice! How should I propagate errors
(e.g. runtimeexceptions, businessruleexceptions) to the ws-client?
Here are my tries:
1. Try: Encapsulate all errors in the response message.
Here's the code-fragment for the orderresponse:
... <xsd:complexType name="OrderResponse"> <xsd:choice> <xsd:sequence> <xsd:element name="orderid" type="xsd:int"/> </xsd:sequence> <xsd:element name="error" type="xsd:string"/> </xsd:choice> </xsd:complexType> ...
Faults were designed to convey exceptional conditions (errors), and thus they should be used for that. An error typically contains different information than a sucessful response message, so its always a good idea to use faults to your advantage.
-Jason