SOAP Fault Segmentation Fault

2007-08-21 Thread Liu_Edward
I am just to run this snippet of code that I have designed:

if (axiom_soap_body_has_fault((axiom_soap_body_t*)create_resp,
env))
{
axiom_soap_fault_t* fault = 
axiom_soap_body_get_fault(
(axiom_soap_body_t*)create_resp, env);

axiom_soap_fault_code_t* code = 
axiom_soap_fault_get_code(fault, env);
axiom_soap_fault_value_t* value = 
axiom_soap_fault_code_get_value(code, env);
axis2_char_t* text =
axiom_soap_fault_value_get_text(value, 

env);
printf(\n%s\n, text);

axiom_soap_fault_reason_t* reason = 
axiom_soap_fault_get_reason(fault, env);
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);
}

create_resp is type-casted since it is originally an object of type
axiom_node_t*.  I am trying to test how to process a SOAP fault that the
client receives from the server.  If I comment out the second portion of
the if section (the part starting with the code object), I see (null)
printed out for value_text, which is not what I expected.  When I keep
in the second portion, I get a segmentation fault on the line:
axis2_char_t* text = axiom_soap_fault_value_get_text(value, env);  Here
is the exact part that the error occurs:

Program received signal SIGSEGV, Segmentation fault.
axiom_node_get_node_type (om_node=0x772e772f2f3a, env=0x508340) at
om_node.c:811
811 return om_node-node_type;

Is this an error on my end or bug in the Axis2/C library?  Also, seeing
(null) for value_text is not correct, as I can see the returning SOAP
fault payload, and the Value is not null is the payload.  The server is
supposed to return a SOAP 1.1 message, but the payload is in SOAP 1.2.
Could that be the issue for the null problem?

Thanks for the help on my two issues!
Edward


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: SOAP Fault Segmentation Fault

2007-08-21 Thread Nandika Jayawardana
Hi Edward,
It is not possible to cast axiom_node_t* pointer to axiom_soap_body_t type.
One thing you could do in order to process the fault is following.

Use axis2_svc_client_get_last_response_has_fault check whether the received
message is a fault at client side. Then you can use
axis2_svc_client_get_last_response_soap_envelope
function to obtain the received soap envelope and then obtain the soap body
and soap fault etc from the soap envelope.

Regards
Nandika



On 8/21/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 I am just to run this snippet of code that I have designed:

 if (axiom_soap_body_has_fault((axiom_soap_body_t*)create_resp,
 env))
 {
 axiom_soap_fault_t* fault =
 axiom_soap_body_get_fault(
 (axiom_soap_body_t*)create_resp, env);

 axiom_soap_fault_code_t* code =
 axiom_soap_fault_get_code(fault, env);
 axiom_soap_fault_value_t* value =
 axiom_soap_fault_code_get_value(code, env);
 axis2_char_t* text =
 axiom_soap_fault_value_get_text(value,

 env);
 printf(\n%s\n, text);

 axiom_soap_fault_reason_t* reason =
 axiom_soap_fault_get_reason(fault, env);
 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);
 }

 create_resp is type-casted since it is originally an object of type
 axiom_node_t*.  I am trying to test how to process a SOAP fault that the
 client receives from the server.  If I comment out the second portion of
 the if section (the part starting with the code object), I see (null)
 printed out for value_text, which is not what I expected.  When I keep
 in the second portion, I get a segmentation fault on the line:
 axis2_char_t* text = axiom_soap_fault_value_get_text(value, env);  Here
 is the exact part that the error occurs:

 Program received signal SIGSEGV, Segmentation fault.
 axiom_node_get_node_type (om_node=0x772e772f2f3a, env=0x508340) at
 om_node.c:811
 811 return om_node-node_type;

 Is this an error on my end or bug in the Axis2/C library?  Also, seeing
 (null) for value_text is not correct, as I can see the returning SOAP
 fault payload, and the Value is not null is the payload.  The server is
 supposed to return a SOAP 1.1 message, but the payload is in SOAP 1.2.
 Could that be the issue for the null problem?

 Thanks for the help on my two issues!
 Edward


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
[EMAIL PROTECTED]
WSO2 Inc: http://www.wso2.com