There are many frameworks to build Web Services, and in my case I'm trying to build one using standard JAX-WS. However I have not found the way to correctly throw an Exception and Wrap it as a Web Service Fault, or SOAPResponse (by this I mean that it has to be defined as a Fault in the WSDL).
To summarize, what I want to do is: When I throw the Exception inside my java-web-method it should return a SOAPResponse to the client, one in the form of the Custom Exception I defined (NotFoundException), and this Exception should appear as a type in the WSDL for this web service as well.
How can I do this ?
Well, I hope i have made what I want to do clear.
Thanks in advance, and Have a great day !
One of the issues I found in doing that is that my WSDL wont give that as the contract. It gave me a success message contract but the error message contract was missing from WSDL. Hence when I try to use that contract in a rules based engine eg. BPEL it wont recognize the error message since it does not exist in the contract
You understand my problem perfectly. My intention is to build a Process, using a BPEL engine. Therefore it is of utmost importance to have Web Service Faults Correctly defined in the WSDL.
In this way, it is easier to implement the navigational cases in a BPEL-based process choreography; otherwise it becomes a nightmare to develop.
I sincerely hope somebody has solved this in the past.
I am interested in learning this case too. Just FYI - I finally ended up having a status code in my message and WSDL and the client handles this code. There is a code for error and a success. But I would like to know the "correct" way to handle this!
Joined: May 28, 2007
That's great Vyas !
Would you mind sharing a little bit of your implementation? Like a piece of code everybody would find useful. Personally, I'd love to see it, so that I can take it from there and see If I can figure something out during the weekend.
Anyways, I know there's gotta be a way to get this done, I have seen a framework called cxf, that generates this code for Java. so, it's obvious that it can be done using JAX-WS alone; and that's in my opinion what one's got to be learning because everything else is built on it.