1 Reply Latest reply on Jun 13, 2005 7:19 PM by Jason Greene

    problem errorhandling

    Elm van Olm Newbie

      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>
      ...


      Problem: wscompile throws an error: xsd:choice not supported???


      2. Try: define one custom exception for the webservice: e.g. ServiceException and send these errors in a fault-message

      Problem: I never saw fault-elements in a commercial webservice-wsdl like from amazon (http://soap.amazon.com/schemas3/AmazonWebServices.wsdl)? How do such webservice propagate their exceptions (e.g. businessruleexceptions like "wrong bank account number format") to the user?


      How should I implement errorhandling for all exceptions for my "doc/lit-EJB Service Endpoint"?

      thanx elm