aspose file tools*
The moose likes Web Services and the fly likes handling SOAP fault in JAVA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "handling SOAP fault in JAVA" Watch "handling SOAP fault in JAVA" New topic
Author

handling SOAP fault in JAVA

Puja Mantri
Greenhorn

Joined: Sep 24, 2009
Posts: 15
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

Joined: Jul 09, 2001
Posts: 1164
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


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 576

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.


Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Shashank Ag
Ranch Hand

Joined: Dec 22, 2009
Posts: 88

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/


SCJP 91%, SCWCD 97%
Puja Mantri
Greenhorn

Joined: Sep 24, 2009
Posts: 15
thank you everyone. that helps.

-Puja
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: handling SOAP fault in JAVA
 
Similar Threads
Error while running web service client in RAD 6.0
WAP/WEBSERVICES
SOAP request error
Using webservices in J2EE web application
Soap Fault Implementation