jQuery in Action, 2nd edition*
The moose likes Web Services and the fly likes How to Handle SOAP Fault in SOAP based Webservices Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "How to Handle SOAP Fault in SOAP based Webservices" Watch "How to Handle SOAP Fault in SOAP based Webservices" New topic
Author

How to Handle SOAP Fault in SOAP based Webservices

Azahrudhin Mohammad
Greenhorn

Joined: Sep 04, 2012
Posts: 18

Hi
I wanted to Handle the SOAP Fault code (SOAPFaultException) , if any one know please update reply. The application code is available blow, you can use this simple example and demonstrate where to plug the code.
If I am deploying this code by using cxf please guide where to do changes.
To deploy above example as web application we need to do the modification in context file (I am using cxf.xml) and web.xml, Please find the file content below.


Thanks and Regards,
azahrudhin.mohd@gmail.com
Azahrudhin Mohammad
Greenhorn

Joined: Sep 04, 2012
Posts: 18

Please reply how to implement or handle javax.xml.ws.soap.SOAPFaultException provided by JAX-WS.
Azahrudhin Mohammad
Greenhorn

Joined: Sep 04, 2012
Posts: 18

I managed to implement the soap fault, Please find the process below.
01. Write your own fault code class using WebFault annotation
@WebFault(name = "CustumFault", targetNamespace = "http://soapfault.jaxws.soap.example/")
public class CustumFault extends Exception {

private String faultInfo;
public CustumFault(String message, String faultInfo){
super(message);
this.faultInfo = faultInfo;
}
}

02. Your service and implementation should throw the exception
@WebMethod
public String sayHello(String name) throws CustumFault;
03. Throw the exception from the implementation of service
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Handle SOAP Fault in SOAP based Webservices