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 Li...@emc.com on 2007/08/23 21:52:44 UTC
SOAP 1.1 Fault Handling
I am having an issue handling a SOAP 1.1 fault. So far, I am successful
up to this point:
axiom_soap_fault_t* soap_fault = axiom_soap_body_get_fault(soap_body,
env);
I next run this line:
axiom_node_t* fault_node = axiom_soap_fault_get_base_node(soap_fault,
env);
I know that this node is not empty since I can print it out using the
axiom_node_to_string function and see this example text:
<soapenv:Fault><faultcode>error</faultcode><faultstring>Error on
server</faultstring></soapenv:Fault>
Now the issue I am having is that I am trying to find some Axis2/C
library functions to parse this fault text, but I am having no luck with
this. I have already tried parsing fault_node using
axiom_node_get_first_child and axiom_node_get_next_sibling with success.
I have tried another method to parse fault_node, but it is not working
for me and is more desirable than the first method. When I run this
line of code:
axiom_element_t* fault_elem =
(axiom_element_t*)axiom_node_get_data_element(fault_node, env);
I find it that it is (null) when I print it out. I would think that by
initializing fault_node, its underlying data_element should have been
set, but it is not. Is this a bug in the library? This is a little
digression from my initial issue, so back to that...
With the soap_fault object, I know that I can use the axiom_soap_fault.h
functions on a SOAP 1.2 object with success. However, this library does
not have any functions for parsing a SOAP 1.1 object. Is there a way
for me to parse the soap_fault object directly without creating a
fault_node object when the SOAP fault is SOAP 1.1?
Thanks!
---------------------------------------------------------------------
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 1.1 Fault Handling
Posted by Li...@emc.com.
I have tried doing as you said, Nandika. But, I am still not able to
get a non-NULL value for the axiom_soap_fault_reason variable. I know
that when a fault reaches the client, I have other code that can print
the "faultstring" and "faultcode" without using the axiom_soap_fault.h
functions. However, the axiom_soap_fault.h functions still aren't
working for me. Here is the exact HTTP message I get from the server
when a fault occurs (I am omitting some values...):
HTTP/1.1 500 Internal Server Error
Content-Type: multipart/related;
boundary=MIMEBoundary5642e130-5590-1dc1-398c-000c297a832c;
type="application/xop+xml";
start="<0....@apache.org>";
start-info="text/xml"; charset="UTF-8"
Content-Length: 545
--MIMEBoundary5642e130-5590-1dc1-398c-000c297a832c
content-transfer-encoding: binary
content-id: <0....@apache.org>
content-type: application/xop+xml; charset=UTF-8; type="text/xml";
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Heade
r/><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server</faultcode><fa
ultstring>Error in operation
'...'</faultstring></soapenv:Fault></soapenv:Body></soapenv:Envelope>
--MIMEBoundary5642e130-5590-1dc1-398c-000c297a832c--
Any ideas where the problem may lie?
Thanks!
Edward
________________________________
From: Liu_Edward@emc.com [mailto:Liu_Edward@emc.com]
Sent: Friday, August 24, 2007 8:16 AM
To: axis-c-user@ws.apache.org
Subject: RE: SOAP 1.1 Fault Handling
What you are suggesting for me to do is what I have already tried and it
is not working. I can test it again and see what I get, but I doubt it
will work.
________________________________
From: Nandika Jayawardana [mailto:jayawark@gmail.com]
Sent: Friday, August 24, 2007 4:47 AM
To: Apache AXIS C User List
Subject: Re: SOAP 1.1 Fault Handling
Hi Edward,
I tested the code with soap11 fault and it works fine for me.
axiom_soap_fault.h functions work for soap11 as well. Since axis2c uses
a soap12 fault model soap11 'faultcode' is mapped to
axiom_soap_fault_code , "faultstring" is mapped to
axiom_soap_fault_reason etc. The code you have written to obtain
"faultstring" is correct. You need to obtain the axiom_soap_fault from
axiom_soap_body and then obtain fault reason, fault code .. from
axiom_soap_fault. If your soap fault have a
<faultstring></faultstring> element then your code should work.
Regards
Nandika
On 8/24/07, Liu_Edward@emc.com <Li...@emc.com> wrote:
Also, sorry for not waiting for a response, but I have tried
this code
as well:
axiom_soap_fault_reason_t* reason =
axiom_soap_fault_get_reason(soap_fault, env);
if (reason == NULL)
{
printf("\nENDING...\n");
exit(0);
}
axiom_soap_fault_text_t* reason_text =
axiom_soap_fault_reason_get_first_soap_fault_text(reason, env);
axis2_char_t* value_text =
axiom_soap_fault_text_get_text(reason_text,
env);
printf("\n%s\n", value_text);
When I run this code, I always execute the if condition and exit
early.
This is how I know that the axiom_soap_fault.h functions do not
work for
a SOAP 1.1 fault message.
-----Original Message-----
From: Liu_Edward@emc.com [mailto:Liu_Edward@emc.com]
Sent: Thursday, August 23, 2007 3:53 PM
To: axis-c-user@ws.apache.org
Subject: SOAP 1.1 Fault Handling
I am having an issue handling a SOAP 1.1 fault. So far, I am
successful
up to this point:
axiom_soap_fault_t* soap_fault =
axiom_soap_body_get_fault(soap_body,
env);
I next run this line:
axiom_node_t* fault_node =
axiom_soap_fault_get_base_node(soap_fault,
env);
I know that this node is not empty since I can print it out
using the
axiom_node_to_string function and see this example text:
<soapenv:Fault><faultcode>error</faultcode><faultstring>Error on
server</faultstring></soapenv:Fault>
Now the issue I am having is that I am trying to find some
Axis2/C
library functions to parse this fault text, but I am having no
luck with
this. I have already tried parsing fault_node using
axiom_node_get_first_child and axiom_node_get_next_sibling with
success.
I have tried another method to parse fault_node, but it is not
working
for me and is more desirable than the first method. When I run
this
line of code:
axiom_element_t* fault_elem =
(axiom_element_t*)axiom_node_get_data_element(fault_node, env);
I find it that it is (null) when I print it out. I would think
that by
initializing fault_node, its underlying data_element should have
been
set, but it is not. Is this a bug in the library? This is a
little
digression from my initial issue, so back to that...
With the soap_fault object, I know that I can use the
axiom_soap_fault.h
functions on a SOAP 1.2 object with success. However, this
library does
not have any functions for parsing a SOAP 1.1 object. Is there
a way
for me to parse the soap_fault object directly without creating
a
fault_node object when the SOAP fault is SOAP 1.1?
Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org
--
http://nandikajayawardana.blogspot.com/
WSO2 Inc: http://www.wso2.com
RE: SOAP 1.1 Fault Handling
Posted by Li...@emc.com.
What you are suggesting for me to do is what I have already tried and it
is not working. I can test it again and see what I get, but I doubt it
will work.
________________________________
From: Nandika Jayawardana [mailto:jayawark@gmail.com]
Sent: Friday, August 24, 2007 4:47 AM
To: Apache AXIS C User List
Subject: Re: SOAP 1.1 Fault Handling
Hi Edward,
I tested the code with soap11 fault and it works fine for me.
axiom_soap_fault.h functions work for soap11 as well. Since axis2c uses
a soap12 fault model soap11 'faultcode' is mapped to
axiom_soap_fault_code , "faultstring" is mapped to
axiom_soap_fault_reason etc. The code you have written to obtain
"faultstring" is correct. You need to obtain the axiom_soap_fault from
axiom_soap_body and then obtain fault reason, fault code .. from
axiom_soap_fault. If your soap fault have a
<faultstring></faultstring> element then your code should work.
Regards
Nandika
On 8/24/07, Liu_Edward@emc.com <Li...@emc.com> wrote:
Also, sorry for not waiting for a response, but I have tried
this code
as well:
axiom_soap_fault_reason_t* reason =
axiom_soap_fault_get_reason(soap_fault, env);
if (reason == NULL)
{
printf("\nENDING...\n");
exit(0);
}
axiom_soap_fault_text_t* reason_text =
axiom_soap_fault_reason_get_first_soap_fault_text(reason, env);
axis2_char_t* value_text =
axiom_soap_fault_text_get_text(reason_text,
env);
printf("\n%s\n", value_text);
When I run this code, I always execute the if condition and exit
early.
This is how I know that the axiom_soap_fault.h functions do not
work for
a SOAP 1.1 fault message.
-----Original Message-----
From: Liu_Edward@emc.com [mailto:Liu_Edward@emc.com]
Sent: Thursday, August 23, 2007 3:53 PM
To: axis-c-user@ws.apache.org
Subject: SOAP 1.1 Fault Handling
I am having an issue handling a SOAP 1.1 fault. So far, I am
successful
up to this point:
axiom_soap_fault_t* soap_fault =
axiom_soap_body_get_fault(soap_body,
env);
I next run this line:
axiom_node_t* fault_node =
axiom_soap_fault_get_base_node(soap_fault,
env);
I know that this node is not empty since I can print it out
using the
axiom_node_to_string function and see this example text:
<soapenv:Fault><faultcode>error</faultcode><faultstring>Error on
server</faultstring></soapenv:Fault>
Now the issue I am having is that I am trying to find some
Axis2/C
library functions to parse this fault text, but I am having no
luck with
this. I have already tried parsing fault_node using
axiom_node_get_first_child and axiom_node_get_next_sibling with
success.
I have tried another method to parse fault_node, but it is not
working
for me and is more desirable than the first method. When I run
this
line of code:
axiom_element_t* fault_elem =
(axiom_element_t*)axiom_node_get_data_element(fault_node, env);
I find it that it is (null) when I print it out. I would think
that by
initializing fault_node, its underlying data_element should have
been
set, but it is not. Is this a bug in the library? This is a
little
digression from my initial issue, so back to that...
With the soap_fault object, I know that I can use the
axiom_soap_fault.h
functions on a SOAP 1.2 object with success. However, this
library does
not have any functions for parsing a SOAP 1.1 object. Is there
a way
for me to parse the soap_fault object directly without creating
a
fault_node object when the SOAP fault is SOAP 1.1?
Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org
--
http://nandikajayawardana.blogspot.com/
WSO2 Inc: http://www.wso2.com
Re: SOAP 1.1 Fault Handling
Posted by Nandika Jayawardana <ja...@gmail.com>.
Hi Edward,
I tested the code with soap11 fault and it works fine for me.
axiom_soap_fault.h functions work for soap11 as well. Since axis2c uses a
soap12 fault model soap11 'faultcode' is mapped to axiom_soap_fault_code ,
"faultstring" is mapped to axiom_soap_fault_reason etc. The code you have
written to obtain "faultstring" is correct. You need to obtain the
axiom_soap_fault from axiom_soap_body and then obtain fault reason, fault
code .. from axiom_soap_fault. If your soap fault have a
<faultstring></faultstring>
element then your code should work.
Regards
Nandika
On 8/24/07, Liu_Edward@emc.com <Li...@emc.com> wrote:
> Also, sorry for not waiting for a response, but I have tried this code
> as well:
>
> axiom_soap_fault_reason_t* reason =
> axiom_soap_fault_get_reason(soap_fault, env);
> if (reason == NULL)
> {
> printf("\nENDING...\n");
> exit(0);
> }
> axiom_soap_fault_text_t* reason_text =
> axiom_soap_fault_reason_get_first_soap_fault_text(reason, env);
> axis2_char_t* value_text = axiom_soap_fault_text_get_text(reason_text,
> env);
> printf("\n%s\n", value_text);
>
> When I run this code, I always execute the if condition and exit early.
> This is how I know that the axiom_soap_fault.h functions do not work for
> a SOAP 1.1 fault message.
>
> -----Original Message-----
> From: Liu_Edward@emc.com [mailto:Liu_Edward@emc.com]
> Sent: Thursday, August 23, 2007 3:53 PM
> To: axis-c-user@ws.apache.org
> Subject: SOAP 1.1 Fault Handling
>
> I am having an issue handling a SOAP 1.1 fault. So far, I am successful
> up to this point:
>
> axiom_soap_fault_t* soap_fault = axiom_soap_body_get_fault(soap_body,
> env);
>
> I next run this line:
>
> axiom_node_t* fault_node = axiom_soap_fault_get_base_node(soap_fault,
> env);
>
> I know that this node is not empty since I can print it out using the
> axiom_node_to_string function and see this example text:
>
> <soapenv:Fault><faultcode>error</faultcode><faultstring>Error on
> server</faultstring></soapenv:Fault>
>
> Now the issue I am having is that I am trying to find some Axis2/C
> library functions to parse this fault text, but I am having no luck with
> this. I have already tried parsing fault_node using
> axiom_node_get_first_child and axiom_node_get_next_sibling with success.
> I have tried another method to parse fault_node, but it is not working
> for me and is more desirable than the first method. When I run this
> line of code:
>
> axiom_element_t* fault_elem =
> (axiom_element_t*)axiom_node_get_data_element(fault_node, env);
>
> I find it that it is (null) when I print it out. I would think that by
> initializing fault_node, its underlying data_element should have been
> set, but it is not. Is this a bug in the library? This is a little
> digression from my initial issue, so back to that...
>
> With the soap_fault object, I know that I can use the axiom_soap_fault.h
> functions on a SOAP 1.2 object with success. However, this library does
> not have any functions for parsing a SOAP 1.1 object. Is there a way
> for me to parse the soap_fault object directly without creating a
> fault_node object when the SOAP fault is SOAP 1.1?
>
> Thanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>
--
http://nandikajayawardana.blogspot.com/
WSO2 Inc: http://www.wso2.com
RE: SOAP 1.1 Fault Handling
Posted by Li...@emc.com.
Also, sorry for not waiting for a response, but I have tried this code
as well:
axiom_soap_fault_reason_t* reason =
axiom_soap_fault_get_reason(soap_fault, env);
if (reason == NULL)
{
printf("\nENDING...\n");
exit(0);
}
axiom_soap_fault_text_t* reason_text =
axiom_soap_fault_reason_get_first_soap_fault_text(reason, env);
axis2_char_t* value_text = axiom_soap_fault_text_get_text(reason_text,
env);
printf("\n%s\n", value_text);
When I run this code, I always execute the if condition and exit early.
This is how I know that the axiom_soap_fault.h functions do not work for
a SOAP 1.1 fault message.
-----Original Message-----
From: Liu_Edward@emc.com [mailto:Liu_Edward@emc.com]
Sent: Thursday, August 23, 2007 3:53 PM
To: axis-c-user@ws.apache.org
Subject: SOAP 1.1 Fault Handling
I am having an issue handling a SOAP 1.1 fault. So far, I am successful
up to this point:
axiom_soap_fault_t* soap_fault = axiom_soap_body_get_fault(soap_body,
env);
I next run this line:
axiom_node_t* fault_node = axiom_soap_fault_get_base_node(soap_fault,
env);
I know that this node is not empty since I can print it out using the
axiom_node_to_string function and see this example text:
<soapenv:Fault><faultcode>error</faultcode><faultstring>Error on
server</faultstring></soapenv:Fault>
Now the issue I am having is that I am trying to find some Axis2/C
library functions to parse this fault text, but I am having no luck with
this. I have already tried parsing fault_node using
axiom_node_get_first_child and axiom_node_get_next_sibling with success.
I have tried another method to parse fault_node, but it is not working
for me and is more desirable than the first method. When I run this
line of code:
axiom_element_t* fault_elem =
(axiom_element_t*)axiom_node_get_data_element(fault_node, env);
I find it that it is (null) when I print it out. I would think that by
initializing fault_node, its underlying data_element should have been
set, but it is not. Is this a bug in the library? This is a little
digression from my initial issue, so back to that...
With the soap_fault object, I know that I can use the axiom_soap_fault.h
functions on a SOAP 1.2 object with success. However, this library does
not have any functions for parsing a SOAP 1.1 object. Is there a way
for me to parse the soap_fault object directly without creating a
fault_node object when the SOAP fault is SOAP 1.1?
Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org