This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Web Method Faults for JAX-WS

 
Jose Campana
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good morning to everyone,

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

Here are some details of what I'm trying to do:



NotFoundException defined...



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 !

Jose
 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jose Campana
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Vyas !

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.

Have a nice Day !

Jose

 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Jose Campana
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thank you very much for your response,

Sincerely,

Jose
 
Hung W Yee
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe this web article can help you:
http://www.ibm.com/developerworks/webservices/library/ws-jaxws-faults/index.html
 
Jose Campana
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there !

Thanks for the article, I'll read it throughly.

I wish there's an article like that one by Sun.

But that's probably just day-dreaming. Anyways, let me know If there's something else you wish to add.

Good Luck,

Jose
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic