A simple WebService that returns a SOAP Faults
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Benoit_Bertrand
Posted On:   Tuesday, August 17, 2004 08:05 AM

Hello, I am quite new on developping WebService with java (on WebSphere Studio). So I do apoligize if the response to my question is "that" simple. I am trying to develop a very simple WebService with only on SOAP operation: echoString(String aString). How can I send back a SOAP Faults containning all the infos it needs ? As I am on WebSphere runtime, I use JAX-RPC WebServices. the fault I would like would be like : ... <> ... <> ... <> ... <> I fact, for my study case, I would like to return de WS client a fault say if aString v   More>>

Hello,



I am quite new on developping WebService with java (on WebSphere Studio). So I do apoligize if the response to my question is "that" simple.



I am trying to develop a very simple WebService with only on SOAP operation: echoString(String aString).

How can I send back a SOAP Faults containning all the infos it needs ? As I am on WebSphere runtime, I use JAX-RPC WebServices.



the fault I would like would be like :


			

... <>
... <>


... <>
... <>







I fact, for my study case, I would like to return de WS client a fault say if aString value equals "samplestring". Else my WS would return a normal SOAP response containing the aString value.



Can anyone help me ?

Thanks,

Benoit Bertrand    <<Less

Re: A simple WebService that returns a SOAP Faults

Posted By:   Balakris_Subramaniam  
Posted On:   Monday, August 23, 2004 09:52 AM

Since SOAP faults are handled at the web service provider level, you will not be able to explictly send a SOAP fault to the client from whithin your application level. SOAP faults are meant to convey the details of the failure in the SOAP layer to the client and not for application layer errors.

The best thing to do, would be to define your own failure or error object containing details of the failure and send it back as part of your response.

If you were using Axis...(it may be possible on WebSphere too, I am not sure):

One indirect way of achieving this is to introduce a requestHandler in your requestFlow and customize the handler to pre-process the incoming XML (SOAPBody) and throw an AxisFault exception from the handler's invoke() method if your failure condition is matched (if aString value equals "samplestring").

This will return to the client in the form of a SOAP fault.

About | Sitemap | Contact