Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

handling SOAP fault in JAVA

 
Puja Mantri
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Application 1 is calling the webservice from Application 2. If there is some problem in executing the webservice application 2 will send the SOAP Fault. My question is -

How to handle the SOAP fault in JAVA (on Application 1 side) ?

We are using Spring webservice.

Currently webservice that we are going to call is not up so not able to do the experiment. Please guide.

Thanks,
Puja
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Puja,

One of the nice things about SOAP is the fact that the structure of the faults is predefined as we can see at SOAP Fault Element.
With Firefow Poster you can simulate the situation and work on the Java code the processes these faults.

Regards,
Dan
 
Naren Chivukula
Ranch Hand
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Puja,
It's good that you said which web service API you are using. But, it really doesn't matter when dealing with SOAP Faults!

Based on your details, I understand your Application 1 is acting as "client" to Application 2. Then you must have created your client stubs using Application 2 WSDL. If your Application 2 WSDL is defined with one or more SOAP faults, then your client stubs correspondingly contain methods throwing SOAP faults. For you, catching SOAP faults is like catching any other checked exceptions (viz. SQLException). SOAP fault details (like in Dan's reply) can be accessed by invoking methods on exception object.
 
Shashank Ag
Ranch Hand
Posts: 88
Java Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Spring has a capability to specify Soap Fault Handeler.
Here is link you may like to see: http://www.stevideter.com/2009/02/18/of-exceptionresolvers-and-xmlbeans/
 
Puja Mantri
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you everyone. that helps.

-Puja
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic