• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jax ws provider return a soap fault

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have asked this elsewhere but got no answer, so I will try again here.
When using a JAX-WS provider in payload mode
E.g.


how can I return a SOAP fault if the processing fails? Is it possible to do it when working directly on the xml payload?
If I was working in Message level (SOAP envelope) I know how to do it. I am not sure when I work on
I understand that if I throw an exception it will be mapped to a 500 Internal Error but what about faultstring, detail etc? How are they populated? How can I do it in xml level?

Thanks!
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
Have you tried the following approach:
1. Look at a fault message from some other web service.
2. Use some Java API to create an appropriate fault message (for example, DOM or JAXB).
3. From the method in the web service endpoint implementation class, return an object implementing the javax.xml.transform.Source interface (see API documentation) to which the fault message has been "written".
Best wishes!
 
Ranch Hand
Posts: 577
Tomcat Server Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jim,
Ivan proposed an easy approach of doing this which we were doing in our previous projects when working on MDBs. But, can I ask you what you get if you generate WSDL from an interface throwing your business exception? I think if WSDL is correctly mapped, I'm sure you'd get corresponding SOAPFault when business exception is thrown.
reply
    Bookmark Topic Watch Topic
  • New Topic