Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

How to Handle SOAP Fault in SOAP based Webservices  RSS feed

 
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
Boost this thread!