aspose file tools
The moose likes Web Services and the fly likes Throwing/Handling SOAP Faults in JAX-WS Webservices Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "Throwing/Handling SOAP Faults in JAX-WS Webservices" Watch "Throwing/Handling SOAP Faults in JAX-WS Webservices" New topic
Author

Throwing/Handling SOAP Faults in JAX-WS Webservices

Srinath Kannan
Greenhorn

Joined: Jan 11, 2011
Posts: 14

Hi,

I am completed developing web service using JAX-WS. Now i wanted to throw SOAPFault with customized error codes on certain conditions.
I gooogled on this topic, but i did not find any good/clear example to do this.

I need the following

1. A basic clear good example for throwing SOAPFault.

2. Why cant we just create custom exception classes by extending java.lang.Exception and annotating @webfault and throw this custom exception when required?

For example



3. I read in some article that we need a bindings.xml file to configure and say the fault details? I did not understand this!
Also, its mentioned that @WebFault annotation should not be used by the programmer! Why?


Please help in this regard.

Thanks


Regards
Srinath
Lingan Rajan
Ranch Hand

Joined: Jan 26, 2011
Posts: 30
Srinath

I think you are partially correct.
Hope the below link helps.
http://www.ibm.com/developerworks/webservices/library/ws-jaxws-faults/

Lingan
Srinath Kannan
Greenhorn

Joined: Jan 11, 2011
Posts: 14

Thanks Lingan

I am a novice in web services and i developed web services using code-first approach.

The link which you provided, i already seen it, its difficult to understand. Can you provide some other example?


Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 458

What are the difficutlties you are facing in throwing custom exceptions in code first approach ?

If your implementation is throwing CustomExeption, the client would have access to that exception, once it generates the artifacts. Have you checked one of the exception classes that are generated after you did wsimport ?


Regards
KumarRaja

 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Throwing/Handling SOAP Faults in JAX-WS Webservices
 
Similar Threads
Understanding how to write spring ws using JAXB
Soap Fault Implementation
How to use UserDefined Exceptions inside JAXWS Java to wsdl approach
JAX-WS Custom Exceptions
Web Method Faults for JAX-WS