Hi Ramesh,

There are two ways to return a fault from a service. You can have a look
into how the service method invocation happens by looking at
raw_xml_in_out_msg_recv.c file located at
axis2c\src\core\receivers\raw_xml_in_out_msg_recv.c. In order to return an
error, you can do following.

If you set an error status code and error message from your service
skeletons invoke method, that error message will be wrapped inside a soap
fault and will be returned to the client.

If you want to set a complete custom soap fault, you can construct a soap
envelope object and add your custom soap fault into it, and then set it to
the message context object available from the your service's invoke method.
The message context available in the service's invoke method is the outgoing
message context and hence the soap envelope set in the message context will
be sent to the client.

Regards
Nandika



On Fri, Jul 8, 2011 at 8:55 PM, Scott Wilson <scott.wilson...@gmail.com>wrote:

> Before giving up on using Axis2/C, I had a server returning SOAP faults and
> a C# client****
>
> handling them as exceptions.  So it is possible, but I had to build from
> the latest source,****
>
> and at some point a bug crept in related to faults, so then I found what I
> think is the****
>
> problem and figured out how to work around it.  I found there already was a
> JIRA for it****
>
> when I went to file one, so I added my workaround to it.  See AXIS2C-1499.
> ****
>
> ** **
>
> ** **
>
> *From:* ramesh Gopal [mailto:fatuzorin2...@yahoo.com]
> *Sent:* Friday, July 08, 2011 1:29 AM
>
> *To:* Apache AXIS C User List
> *Subject:* Re: Implement axis soap fault in server/ client side from C****
>
> ** **
>
>
> Can someone pls help me with this asap ?
>
> --- On *Wed, 6/7/11, ramesh Gopal <fatuzorin2...@yahoo.com>* wrote:****
>
>
> From: ramesh Gopal <fatuzorin2...@yahoo.com>
> Subject: Implement axis soap fault in server/ client side from C
> To: "Apache AXIS C User List" <c-user@axis.apache.org>
> Date: Wednesday, 6 July, 2011, 5:28 PM****
>
>
> Hello everybody,
>
> I want to implement a logic of how to create soap fault from Axis2C in C.
> It must follow the below format.
>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
> >
>   <soapenv:Body>
>     <soapenv:Fault>
>       <faultcode>System</faultcode>
>       <faultstring>There was an error in the web service</faultstring>
>       <detail>
>         <iss:issues_exceptionfault>
>           <iss:errorno>-206</iss:errorno>
>           <iss:errormsg>The specified table (mengano) is not in the
> database.</iss:errormsg>
>         </iss:issues_exceptionfault>
>       </detail>
>     </soapenv:Fault>
>   </soapenv:Body>
> </soapenv:Envelope>
>
> How do I get about coding this on the server side.
>
> Another question I had was, how do I write my client code to understand
> this soap fault and handle it.
>
> Though this is a standard format, some services send a custom fault, Will
> they also be in this format only.
>
> Pls help me with some samples around these. Links will be an added
> advantage. I googled for some samples, but havent been successful.
>
> Ramesh.****
>
> ** **
>

Reply via email to