You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Subra A Narayanan <as...@gmail.com> on 2007/08/17 04:16:23 UTC

SOAP fault builder

Hello folks,

I am trying ti build a SOAP1.1 fault and return to the ws client. I am
having some difficulty understanding how to go about this. I have tryng to
dig through the source code but was wondering if you guys have some sample
code. If you have it that would be very helpful in understanding the usage.

In the meantime I will continue to dig through the source code to try to
understand.

Thanks as usual!

Subra

Re: SOAP fault builder

Posted by Samisa Abeysinghe <sa...@wso2.com>.
You may find some information on generating Faults in this thread: 
http://www.nabble.com/-AXIS2C--throwing-an-exception-from-the-server-to-the-Java-client-tf3967397.html#a11299262

Thanks,
Samisa...

Subra A Narayanan wrote:
> Hey Nandika,
>
> Did you get a chance to look at my questions? I would really 
> appreciate ur input on these.
>
> Thanks so much!
>
> Subra
>
> On 8/17/07, * Subra A Narayanan* <aswathsn@gmail.com 
> <ma...@gmail.com>> wrote:
>
>     Hey Nandika,
>
>     So I tried your suggestion but I have a doubt. I am just modifying
>     the 'math' webservice from the samples folder.
>
>     The 'add' operation returns a axiom_node_t * on success, which is
>     nothing but the soap message. But I want to return a soap fault
>     from the 'add' operation if lets say one of the parameters was
>     missing from the request or it was a decimal number. If I follow
>     what you asked me to do, what do I return from the add function? I
>     have to return a axiom_node_t *? But from your email I thought you
>     meant that if I set the soap fault to the message context, the
>     soap fault will automatically be returned to the client. I dont
>     understand how do I stop further processing and return a soap
>     fault to the client.
>
>     So I did some further digging in to the axis code and found this
>     function in axiom_soap_envelope.h:
>
>     AXIS2_EXTERN axiom_node_t* AXIS2_CALL
>     axiom_soap_envelope_get_base_node(axiom_soap_envelope_t *envelope,
>     const axutil_env_t *env);
>
>
>     so this gives me access to the soap fault message as a
>     axiom_node_t*. And upon error in the 'add' operation, I just
>     return it to the client. Is this the right way to do it? I am
>     missing something here.
>
>     Now one more important thing. When I call
>     axiom_soap_envelope_get_base_node, it seems to returning a soap1.2
>     fault message rather than a soap1.1 message even though I set *
>
>     *soapVersion = AXIOM_SOAP11;
>
>     Why is that? Is there a way to get soap1.1 fault message?
>
>
>     I hope my questions are clear. Thanks so much for your help!
>
>
>     Subra
>
>
>
>
>     On 8/17/07, * Subra A Narayanan* <aswathsn@gmail.com
>     <ma...@gmail.com>> wrote:
>
>         Thanks Nandika. I will give it a shot.
>
>         Have a good weekend!
>
>
>         On 8/17/07, *Nandika Jayawardana* < jayawark@gmail.com
>         <ma...@gmail.com>> wrote:
>
>             Hi Subra,
>              
>             You can create a soap11 fault using following lines.
>              
>             int soap_version = AXIOM_SOAP11;
>
>             soap_envelope =
>             axiom_soap_envelope_create_default_soap_envelope (env,
>             soap_version);
>
>             soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
>
>             soap_fault = axiom_soap_fault_create_default_fault (env,
>             soap_body, "fault code" , "fault reason"
>
>             , soap_version);
>
>             axis2_msg_ctx_set_fault_soap_envelope(msg_ctx, env,
>             soap_envelope);
>
>             You can set the fault to the msg_ctx and it will be
>             returned to the client.
>
>             Regards
>
>             Nandika
>
>
>
>              
>             On 8/17/07, *Subra A Narayanan* <aswathsn@gmail.com
>             <ma...@gmail.com>> wrote:
>
>                 Hello folks,
>                  
>                 I am trying ti build a SOAP1.1 fault and return to the
>                 ws client. I am having some difficulty understanding
>                 how to go about this. I have tryng to dig through the
>                 source code but was wondering if you guys have some
>                 sample code. If you have it that would be very helpful
>                 in understanding the usage.
>                  
>                 In the meantime I will continue to dig through the
>                 source code to try to understand.
>                  
>                 Thanks as usual!
>                  
>                 Subra
>
>
>
>
>             -- 
>             nandika@wso2.com <ma...@wso2.com>
>             WSO2 Inc: http://www.wso2.com 
>
>
>
>


-- 
Samisa Abeysinghe : WSO2 WSF/C
"http://wso2.org/projects/wsf/c?WSO2&nbsp;Web&nbsp;Services&nbsp;Framework/C&nbsp;-&nbsp;Open&nbsp;source&nbsp;C&nbsp;library&nbsp;for&nbsp;providing&nbsp;and&nbsp;consuming&nbsp;Web&nbsp;services"


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org


Re: SOAP fault builder

Posted by Subra A Narayanan <as...@gmail.com>.
Dinesh,

I have created JIRA issues for both the issues we have been talking about.
Here is a link to the issues:

Internal server error => https://issues.apache.org/jira/browse/AXIS2C-676
Ability to return custom error messages/codes to the client  =>
https://issues.apache.org/jira/browse/AXIS2C-678


Thanks!!
Subra


On 8/22/07, Dinesh Premalal <xy...@gmail.com> wrote:
>
> "Subra A Narayanan" <as...@gmail.com> writes:
> Hi Subra,
> "Subra A Narayanan" <as...@gmail.com> writes:
> > Thanks for your reply. I tried running the same servive with the
> > asix2_http_server and the client successfully receives a soap fault. No
> > problems there. So I think it is a bug with apache http server module.
> If you
> > guys concur, I will open a JIRA issue. It would be really nice to have
> this
> > problem fixed.
> Yes, Please do raise a JIRA issue.
> >
> > Having a way to return custom error codes/messages to client would be a
> big
> > plus? This way the client would know where exactly the error lies, on
> the
> > server side or in the request itself. Should I create a JIRA issue for
> this
> > too. If yes, under which category?
> I too think, we need to implement customize errors for user. yes
> please raise a jira under axis2c/util because error implementation is
> under the utils. If others think there should be alternate method, we
> could do it in the JIRA itself. (we could edit the JIRA accordingly).
>
> thanks,
> Dinesh
> --
> Dinesh Premalal
> http://xydinesh.wordpress.com/
> GPG ID : A255955C
> GPG Key Finger Print : C481 E5D4 C27E DC34 9257  0229 4F44 266E A255 955C
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>

Re: SOAP fault builder

Posted by Dinesh Premalal <xy...@gmail.com>.
"Subra A Narayanan" <as...@gmail.com> writes:
Hi Subra,
"Subra A Narayanan" <as...@gmail.com> writes:
> Thanks for your reply. I tried running the same servive with the
> asix2_http_server and the client successfully receives a soap fault. No
> problems there. So I think it is a bug with apache http server module. If you
> guys concur, I will open a JIRA issue. It would be really nice to have this
> problem fixed.
Yes, Please do raise a JIRA issue. 
>
> Having a way to return custom error codes/messages to client would be a big
> plus? This way the client would know where exactly the error lies, on the
> server side or in the request itself. Should I create a JIRA issue for this
> too. If yes, under which category?
I too think, we need to implement customize errors for user. yes
please raise a jira under axis2c/util because error implementation is
under the utils. If others think there should be alternate method, we
could do it in the JIRA itself. (we could edit the JIRA accordingly).

thanks,
Dinesh
-- 
Dinesh Premalal
http://xydinesh.wordpress.com/
GPG ID : A255955C
GPG Key Finger Print : C481 E5D4 C27E DC34 9257  0229 4F44 266E A255 955C

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org


Re: SOAP fault builder

Posted by Subra A Narayanan <as...@gmail.com>.
Dinesh,

Thanks for your reply. I tried running the same servive with the
asix2_http_server and the client successfully receives a soap fault. No
problems there. So I think it is a bug with apache http server module. If
you guys concur, I will open a JIRA issue. It would be really nice to have
this problem fixed.

Having a way to return custom error codes/messages to client would be a big
plus? This way the client would know where exactly the error lies, on the
server side or in the request itself. Should I create a JIRA issue for this
too. If yes, under which category?

Thanks,
Subra


On 8/21/07, Dinesh Premalal <xy...@gmail.com> wrote:
>
> Hi Subra,
> "Subra A Narayanan" <as...@gmail.com> writes:
>
> > I modified the axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync
> > function to log the soap fault message to axis2.log file just before it
> returns
> > and see the correct soap fault message. So something happens after this
> point
> > which makes the apache http server send a 500 Internal server error to
> the
> > client.
> were you able to log those fault to axis2.log? My feeling is, there
> might be some misconfiguration in apache server. Did you try with
> axis2_http_server?
>
> > My second question was, is there a way to return custom error numbers
> and error
> > message to the myservice_on_fault function so that the error number/msg
> can be
> > included in the soap fault. Right now only predefined AXIS2 error
> message can
> > be set using AXIS2_ERROR_SET. I understand that I can modify
> axutil_error.h
> > file but it says that the error codes are reserved for modules. Is there
> any
> > other better way of doing this?
> AFAIK, there is no such a mechanism. However I think we should
> provide custom error mechanism to user. May be an extension for
> current axis2 error mechanism will be helpful.
>
> Thoughts ???
>
> thanks,
> Dinesh
> --
> Dinesh Premalal
> http://xydinesh.wordpress.com/
> GPG ID : A255955C
> GPG Key Finger Print : C481 E5D4 C27E DC34 9257  0229 4F44 266E A255 955C
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>

Re: SOAP fault builder

Posted by Dinesh Premalal <xy...@gmail.com>.
Hi Subra,
"Subra A Narayanan" <as...@gmail.com> writes:

> I modified the axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync
> function to log the soap fault message to axis2.log file just before it returns
> and see the correct soap fault message. So something happens after this point
> which makes the apache http server send a 500 Internal server error to the
> client.
were you able to log those fault to axis2.log? My feeling is, there
might be some misconfiguration in apache server. Did you try with
axis2_http_server? 

> My second question was, is there a way to return custom error numbers and error
> message to the myservice_on_fault function so that the error number/msg can be
> included in the soap fault. Right now only predefined AXIS2 error message can
> be set using AXIS2_ERROR_SET. I understand that I can modify axutil_error.h
> file but it says that the error codes are reserved for modules. Is there any
> other better way of doing this?
AFAIK, there is no such a mechanism. However I think we should
provide custom error mechanism to user. May be an extension for
current axis2 error mechanism will be helpful. 

Thoughts ???

thanks,
Dinesh
-- 
Dinesh Premalal
http://xydinesh.wordpress.com/
GPG ID : A255955C
GPG Key Finger Print : C481 E5D4 C27E DC34 9257  0229 4F44 266E A255 955C

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org


Re: SOAP fault builder

Posted by Subra A Narayanan <as...@gmail.com>.
Hey Nandika,

Thanks for your reply. Looking at the
axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync function in
raw_xml_in_out_msg_recv.c was very helpful.

So I modified my code accordingly and I think I might have found a bug in
the framework. This is what I did

1. Set error status to AXIS2_FAILURE using AXIS2_ERROR_SET
2. Return NULL from my service
3. Implement myservice_on_fault function and create an axiom node which gets
added to the soap fault details node.

No when I try return a soap fault, the server sends a 500 Internal Server
error to the client. Chris Darroch created a JIRA issue late last year about
this bug here => https://issues.apache.org/jira/browse/AXIS2C-328 but I dont
think the bug has been fixed (pls correct me if I am wrong). I used TcpMon
to capture the response and this is what the client sees:

HTTP/1.1 500 Internal Server Error Date: Tue, 21 Aug 2007 17:39:55 GMT
Server: Apache/2.0.59 (rPath) Content-Length: 613 Connection: close
Content-Type: text/html; charset=iso-8859-1  <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
 root@localhost and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr>
<address>Apache/2.0.59 (rPath) Server at 168.159.116.42 Port 80</address>
</body></html>

I modified the axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync
function
to log the soap fault message to axis2.log file just before it returns and
see the correct soap fault message. So something happens after this point
which makes the apache http server send a 500 Internal server error to the
client.



My second question was, is there a way to return custom error numbers and
error message to the myservice_on_fault function so that the error
number/msg can be included in the soap fault. Right now only predefined
AXIS2 error message can be set using AXIS2_ERROR_SET. I understand that I
can modify axutil_error.h file but it says that the error codes are reserved
for modules. Is there any other better way of doing this?


Thank you folks!

Subra






On 8/21/07, Nandika Jayawardana <ja...@gmail.com> wrote:
>
> Hi Subra,
>
> To send a fault from the service you can do the following.
> In the invoke function of the service skeleton set an the error status to
> AXIS2_FALSE
> and return NULL. You can use the AXIS2_ERROR_SET macro to set the error
> status.
>
> Then implement the on_fault function in the skeleton to return the error
> message you want to return. This will be added to the fault detail section.
>
> When axis2 calls invoke function and finds that it returned null, it will
> check the error status.
> If the error status if AXIS2_FALSE , then a fault is returned.
>
> You do not have to be concerned about the soap version of the fault.
> Depending on the received
> message's soap version an appropriate  soap fault will be returned.
>
> You can have a look at
> axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync function
> in raw_xml_in_out_msg_recv.c file to understand how the fault is
> processed.
>
> Regards,
> Nandika
>
>
> On 8/21/07, Subra A Narayanan <as...@gmail.com> wrote:
> >
> > Hey Nandika,
> >
> > Did you get a chance to look at my questions? I would really appreciate
> > ur input on these.
> >
> > Thanks so much!
> >
> > Subra
> >
> > On 8/17/07, Subra A Narayanan <as...@gmail.com> wrote:
> > >
> > > Hey Nandika,
> > >
> > > So I tried your suggestion but I have a doubt. I am just modifying the
> > > 'math' webservice from the samples folder.
> > >
> > > The 'add' operation returns a axiom_node_t * on success, which is
> > > nothing but the soap message. But I want to return a soap fault from the
> > > 'add' operation if lets say one of the parameters was missing from the
> > > request or it was a decimal number. If I follow what you asked me to do,
> > > what do I return from the add function? I have to return a axiom_node_t
> > > *? But from your email I thought you meant that if I set the soap
> > > fault to the message context, the soap fault will automatically be returned
> > > to the client. I dont understand how do I stop further processing and return
> > > a soap fault to the client.
> > >
> > > So I did some further digging in to the axis code and found this
> > > function in axiom_soap_envelope.h:
> > >
> > > AXIS2_EXTERN axiom_node_t* AXIS2_CALL
> > > axiom_soap_envelope_get_base_node(axiom_soap_envelope_t *envelope,
> > > const axutil_env_t *env);
> > >
> > >
> > > so this gives me access to the soap fault message as a axiom_node_t*.
> > > And upon error in the 'add' operation, I just return it to the client. Is
> > > this the right way to do it? I am missing something here.
> > >
> > > Now one more important thing. When I call
> > > axiom_soap_envelope_get_base_node, it seems to returning a soap1.2fault message rather than a
> > > soap1.1 message even though I set *
> > >
> > > *soapVersion = AXIOM_SOAP11;
> > >
> > > Why is that? Is there a way to get soap1.1 fault message?
> > >
> > >
> > > I hope my questions are clear. Thanks so much for your help!
> > >
> > >
> > > Subra
> > >
> > >
> > >
> > > On 8/17/07, Subra A Narayanan <as...@gmail.com> wrote:
> > > >
> > > > Thanks Nandika. I will give it a shot.
> > > >
> > > > Have a good weekend!
> > > >
> > > > On 8/17/07, Nandika Jayawardana < jayawark@gmail.com > wrote:
> > > > >
> > > > > Hi Subra,
> > > > >
> > > > > You can create a soap11 fault using following lines.
> > > > >
> > > > > int soap_version = AXIOM_SOAP11;
> > > > >
> > > > > soap_envelope = axiom_soap_envelope_create_default_soap_envelope
> > > > > (env, soap_version);
> > > > >
> > > > > soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
> > > > >
> > > > > soap_fault = axiom_soap_fault_create_default_fault (env,
> > > > > soap_body, "fault code" , "fault reason"
> > > > > , soap_version);
> > > > >
> > > > > axis2_msg_ctx_set_fault_soap_envelope(msg_ctx, env,
> > > > > soap_envelope);
> > > > >
> > > > > You can set the fault to the msg_ctx and it will be returned to
> > > > > the client.
> > > > >
> > > > > Regards
> > > > >
> > > > > Nandika
> > > > >
> > > > >
> > > > >
> > > > > On 8/17/07, Subra A Narayanan <aswathsn@gmail.com > wrote:
> > > > > >
> > > > > > Hello folks,
> > > > > >
> > > > > > I am trying ti build a SOAP1.1 fault and return to the ws
> > > > > > client. I am having some difficulty understanding how to go about this. I
> > > > > > have tryng to dig through the source code but was wondering if you guys have
> > > > > > some sample code. If you have it that would be very helpful in understanding
> > > > > > the usage.
> > > > > >
> > > > > > In the meantime I will continue to dig through the source code
> > > > > > to try to understand.
> > > > > >
> > > > > > Thanks as usual!
> > > > > >
> > > > > > Subra
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > nandika@wso2.com
> > > > > WSO2 Inc: http://www.wso2.com
> > > >
> > > >
> > > >
> > >
> >
>
>
> --
> nandika@wso2.com
> WSO2 Inc: http://www.wso2.com
>

Re: SOAP fault builder

Posted by Nandika Jayawardana <ja...@gmail.com>.
Hi Subra,

To send a fault from the service you can do the following.
In the invoke function of the service skeleton set an the error status to
AXIS2_FALSE
and return NULL. You can use the AXIS2_ERROR_SET macro to set the error
status.

Then implement the on_fault function in the skeleton to return the error
message you want to return. This will be added to the fault detail section.

When axis2 calls invoke function and finds that it returned null, it will
check the error status.
If the error status if AXIS2_FALSE , then a fault is returned.

You do not have to be concerned about the soap version of the fault.
Depending on the received
message's soap version an appropriate  soap fault will be returned.

You can have a look at
axis2_raw_xml_in_out_msg_recv_invoke_business_logic_sync function
in raw_xml_in_out_msg_recv.c file to understand how the fault is processed.

Regards,
Nandika


On 8/21/07, Subra A Narayanan <as...@gmail.com> wrote:
>
> Hey Nandika,
>
> Did you get a chance to look at my questions? I would really appreciate ur
> input on these.
>
> Thanks so much!
>
> Subra
>
> On 8/17/07, Subra A Narayanan <as...@gmail.com> wrote:
> >
> > Hey Nandika,
> >
> > So I tried your suggestion but I have a doubt. I am just modifying the
> > 'math' webservice from the samples folder.
> >
> > The 'add' operation returns a axiom_node_t * on success, which is
> > nothing but the soap message. But I want to return a soap fault from the
> > 'add' operation if lets say one of the parameters was missing from the
> > request or it was a decimal number. If I follow what you asked me to do,
> > what do I return from the add function? I have to return a axiom_node_t
> > *? But from your email I thought you meant that if I set the soap fault
> > to the message context, the soap fault will automatically be returned to the
> > client. I dont understand how do I stop further processing and return a soap
> > fault to the client.
> >
> > So I did some further digging in to the axis code and found this
> > function in axiom_soap_envelope.h:
> >
> > AXIS2_EXTERN axiom_node_t* AXIS2_CALL
> > axiom_soap_envelope_get_base_node(axiom_soap_envelope_t *envelope, constaxutil_env_t *env);
> >
> >
> > so this gives me access to the soap fault message as a axiom_node_t*.
> > And upon error in the 'add' operation, I just return it to the client. Is
> > this the right way to do it? I am missing something here.
> >
> > Now one more important thing. When I call
> > axiom_soap_envelope_get_base_node, it seems to returning a soap1.2 fault
> > message rather than a soap1.1 message even though I set *
> >
> > *soapVersion = AXIOM_SOAP11;
> >
> > Why is that? Is there a way to get soap1.1 fault message?
> >
> >
> > I hope my questions are clear. Thanks so much for your help!
> >
> >
> > Subra
> >
> >
> >
> > On 8/17/07, Subra A Narayanan <as...@gmail.com> wrote:
> > >
> > > Thanks Nandika. I will give it a shot.
> > >
> > > Have a good weekend!
> > >
> > > On 8/17/07, Nandika Jayawardana < jayawark@gmail.com > wrote:
> > > >
> > > > Hi Subra,
> > > >
> > > > You can create a soap11 fault using following lines.
> > > >
> > > > int soap_version = AXIOM_SOAP11;
> > > >
> > > > soap_envelope = axiom_soap_envelope_create_default_soap_envelope
> > > > (env, soap_version);
> > > >
> > > > soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
> > > >
> > > > soap_fault = axiom_soap_fault_create_default_fault (env,
> > > > soap_body, "fault code" , "fault reason"
> > > > , soap_version);
> > > >
> > > > axis2_msg_ctx_set_fault_soap_envelope(msg_ctx, env, soap_envelope);
> > > >
> > > > You can set the fault to the msg_ctx and it will be returned to the
> > > > client.
> > > >
> > > > Regards
> > > >
> > > > Nandika
> > > >
> > > >
> > > >
> > > > On 8/17/07, Subra A Narayanan <aswathsn@gmail.com > wrote:
> > > > >
> > > > > Hello folks,
> > > > >
> > > > > I am trying ti build a SOAP1.1 fault and return to the ws client.
> > > > > I am having some difficulty understanding how to go about this. I have tryng
> > > > > to dig through the source code but was wondering if you guys have some
> > > > > sample code. If you have it that would be very helpful in understanding the
> > > > > usage.
> > > > >
> > > > > In the meantime I will continue to dig through the source code to
> > > > > try to understand.
> > > > >
> > > > > Thanks as usual!
> > > > >
> > > > > Subra
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > nandika@wso2.com
> > > > WSO2 Inc: http://www.wso2.com
> > >
> > >
> > >
> >
>


-- 
nandika@wso2.com
WSO2 Inc: http://www.wso2.com

Re: SOAP fault builder

Posted by Subra A Narayanan <as...@gmail.com>.
Hey Nandika,

Did you get a chance to look at my questions? I would really appreciate ur
input on these.

Thanks so much!

Subra

On 8/17/07, Subra A Narayanan <as...@gmail.com> wrote:
>
> Hey Nandika,
>
> So I tried your suggestion but I have a doubt. I am just modifying the
> 'math' webservice from the samples folder.
>
> The 'add' operation returns a axiom_node_t * on success, which is nothing
> but the soap message. But I want to return a soap fault from the 'add'operation if lets say one of the parameters was missing from the request or
> it was a decimal number. If I follow what you asked me to do, what do I
> return from the add function? I have to return a axiom_node_t *? But from
> your email I thought you meant that if I set the soap fault to the message
> context, the soap fault will automatically be returned to the client. I dont
> understand how do I stop further processing and return a soap fault to the
> client.
>
> So I did some further digging in to the axis code and found this function
> in axiom_soap_envelope.h:
>
> AXIS2_EXTERN axiom_node_t* AXIS2_CALL
> axiom_soap_envelope_get_base_node(axiom_soap_envelope_t *envelope, constaxutil_env_t *env);
>
>
> so this gives me access to the soap fault message as a axiom_node_t*. And
> upon error in the 'add' operation, I just return it to the client. Is this
> the right way to do it? I am missing something here.
>
> Now one more important thing. When I call
> axiom_soap_envelope_get_base_node, it seems to returning a soap1.2 fault
> message rather than a soap1.1 message even though I set *
>
> *soapVersion = AXIOM_SOAP11;
>
> Why is that? Is there a way to get soap1.1 fault message?
>
>
> I hope my questions are clear. Thanks so much for your help!
>
>
> Subra
>
>
>
> On 8/17/07, Subra A Narayanan <as...@gmail.com> wrote:
> >
> > Thanks Nandika. I will give it a shot.
> >
> > Have a good weekend!
> >
> > On 8/17/07, Nandika Jayawardana < jayawark@gmail.com > wrote:
> > >
> > > Hi Subra,
> > >
> > > You can create a soap11 fault using following lines.
> > >
> > > int soap_version = AXIOM_SOAP11;
> > >
> > > soap_envelope = axiom_soap_envelope_create_default_soap_envelope (env,
> > > soap_version);
> > >
> > > soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
> > >
> > > soap_fault = axiom_soap_fault_create_default_fault (env,
> > > soap_body, "fault code" , "fault reason"
> > > , soap_version);
> > >
> > > axis2_msg_ctx_set_fault_soap_envelope(msg_ctx, env, soap_envelope);
> > >
> > > You can set the fault to the msg_ctx and it will be returned to the
> > > client.
> > >
> > > Regards
> > >
> > > Nandika
> > >
> > >
> > >
> > > On 8/17/07, Subra A Narayanan <aswathsn@gmail.com > wrote:
> > > >
> > > > Hello folks,
> > > >
> > > > I am trying ti build a SOAP1.1 fault and return to the ws client. I
> > > > am having some difficulty understanding how to go about this. I have tryng
> > > > to dig through the source code but was wondering if you guys have some
> > > > sample code. If you have it that would be very helpful in understanding the
> > > > usage.
> > > >
> > > > In the meantime I will continue to dig through the source code to
> > > > try to understand.
> > > >
> > > > Thanks as usual!
> > > >
> > > > Subra
> > > >
> > >
> > >
> > >
> > > --
> > > nandika@wso2.com
> > > WSO2 Inc: http://www.wso2.com
> >
> >
> >
>

Re: SOAP fault builder

Posted by Subra A Narayanan <as...@gmail.com>.
Hey Nandika,

So I tried your suggestion but I have a doubt. I am just modifying the
'math' webservice from the samples folder.

The 'add' operation returns a axiom_node_t * on success, which is nothing
but the soap message. But I want to return a soap fault from the
'add'operation if lets say one of the parameters was missing from the
request or
it was a decimal number. If I follow what you asked me to do, what do I
return from the add function? I have to return a axiom_node_t *? But from
your email I thought you meant that if I set the soap fault to the message
context, the soap fault will automatically be returned to the client. I dont
understand how do I stop further processing and return a soap fault to the
client.

So I did some further digging in to the axis code and found this function in
axiom_soap_envelope.h:

 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
axiom_soap_envelope_get_base_node(axiom_soap_envelope_t *envelope,
constaxutil_env_t *env);


so this gives me access to the soap fault message as a axiom_node_t*. And
upon error in the 'add' operation, I just return it to the client. Is this
the right way to do it? I am missing something here.

Now one more important thing. When I call axiom_soap_envelope_get_base_node,
it seems to returning a soap1.2 fault message rather than a soap1.1 message
even though I set *

*soapVersion = AXIOM_SOAP11;

Why is that? Is there a way to get soap1.1 fault message?


I hope my questions are clear. Thanks so much for your help!


Subra



On 8/17/07, Subra A Narayanan <as...@gmail.com> wrote:
>
> Thanks Nandika. I will give it a shot.
>
> Have a good weekend!
>
> On 8/17/07, Nandika Jayawardana <jayawark@gmail.com > wrote:
> >
> > Hi Subra,
> >
> > You can create a soap11 fault using following lines.
> >
> > int soap_version = AXIOM_SOAP11;
> >
> > soap_envelope = axiom_soap_envelope_create_default_soap_envelope (env,
> > soap_version);
> >
> > soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
> >
> > soap_fault = axiom_soap_fault_create_default_fault (env,
> > soap_body, "fault code" , "fault reason"
> > , soap_version);
> >
> > axis2_msg_ctx_set_fault_soap_envelope(msg_ctx, env, soap_envelope);
> >
> > You can set the fault to the msg_ctx and it will be returned to the
> > client.
> >
> > Regards
> >
> > Nandika
> >
> >
> >
> > On 8/17/07, Subra A Narayanan <aswathsn@gmail.com > wrote:
> > >
> > > Hello folks,
> > >
> > > I am trying ti build a SOAP1.1 fault and return to the ws client. I am
> > > having some difficulty understanding how to go about this. I have tryng to
> > > dig through the source code but was wondering if you guys have some sample
> > > code. If you have it that would be very helpful in understanding the usage.
> > >
> > > In the meantime I will continue to dig through the source code to try
> > > to understand.
> > >
> > > Thanks as usual!
> > >
> > > Subra
> > >
> >
> >
> >
> > --
> > nandika@wso2.com
> > WSO2 Inc: http://www.wso2.com
>
>
>

Re: SOAP fault builder

Posted by Subra A Narayanan <as...@gmail.com>.
Thanks Nandika. I will give it a shot.

Have a good weekend!

On 8/17/07, Nandika Jayawardana <ja...@gmail.com> wrote:
>
> Hi Subra,
>
> You can create a soap11 fault using following lines.
>
> int soap_version = AXIOM_SOAP11;
>
> soap_envelope = axiom_soap_envelope_create_default_soap_envelope (env,
> soap_version);
>
> soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
>
> soap_fault = axiom_soap_fault_create_default_fault (env, soap_body, "fault
> code" , "fault reason"
> , soap_version);
>
> axis2_msg_ctx_set_fault_soap_envelope(msg_ctx, env, soap_envelope);
>
> You can set the fault to the msg_ctx and it will be returned to the
> client.
>
> Regards
>
> Nandika
>
>
>
> On 8/17/07, Subra A Narayanan <as...@gmail.com> wrote:
> >
> > Hello folks,
> >
> > I am trying ti build a SOAP1.1 fault and return to the ws client. I am
> > having some difficulty understanding how to go about this. I have tryng to
> > dig through the source code but was wondering if you guys have some sample
> > code. If you have it that would be very helpful in understanding the usage.
> >
> > In the meantime I will continue to dig through the source code to try to
> > understand.
> >
> > Thanks as usual!
> >
> > Subra
> >
>
>
>
> --
> nandika@wso2.com
> WSO2 Inc: http://www.wso2.com

Re: SOAP fault builder

Posted by Nandika Jayawardana <ja...@gmail.com>.
Hi Subra,

You can create a soap11 fault using following lines.

int soap_version = AXIOM_SOAP11;

soap_envelope = axiom_soap_envelope_create_default_soap_envelope (env,
soap_version);

soap_body = axiom_soap_envelope_get_body(soap_envelope, env);

soap_fault = axiom_soap_fault_create_default_fault (env, soap_body, "fault
code" , "fault reason", soap_version);

axis2_msg_ctx_set_fault_soap_envelope(msg_ctx, env, soap_envelope);

You can set the fault to the msg_ctx and it will be returned to the client.

Regards

Nandika



On 8/17/07, Subra A Narayanan <as...@gmail.com> wrote:
>
> Hello folks,
>
> I am trying ti build a SOAP1.1 fault and return to the ws client. I am
> having some difficulty understanding how to go about this. I have tryng to
> dig through the source code but was wondering if you guys have some sample
> code. If you have it that would be very helpful in understanding the usage.
>
> In the meantime I will continue to dig through the source code to try to
> understand.
>
> Thanks as usual!
>
> Subra
>



-- 
nandika@wso2.com
WSO2 Inc: http://www.wso2.com