Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to Handle SOAP Fault in SOAP based Webservices

 
Azahrudhin Mohammad
Greenhorn
Posts: 18
Hibernate Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Azahrudhin Mohammad
Greenhorn
Posts: 18
Hibernate Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please reply how to implement or handle javax.xml.ws.soap.SOAPFaultException provided by JAX-WS.
 
Azahrudhin Mohammad
Greenhorn
Posts: 18
Hibernate Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic