• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Throwing/Handling SOAP Faults in JAX-WS Webservices

 
Greenhorn
Posts: 14
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 14
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?


 
Ranch Hand
Posts: 558
2
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic