axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karolina <sarnow...@gmail.com>
Subject WS-Addressing: How service can extract reference parameters from message header?
Date Wed, 05 Nov 2008 16:01:24 GMT
Hello -

I am having trouble extracting reference parameters from the message header
on the service side.  I add reference parameters to the message header but
they are not appearing on the service side.

In the invoke method of my service in the axis2_svc_skel_<service>.c file, I
try to get the reference parameters directly from the message header as well
as from the TO endpoint reference (which I acquire from the header and from
the message context).  In all three attempts, the returned list of reference
parameters does not contain any elements. Is this the correct way to do
this?  What am I missing??

(I used WSDL2C to generate my service skeleton.  I am using release 1.5.0.)

Thanks for any help,
Karolina

Code for extracting reference parameters from message header:

//Get message context
in_msg_ctx = axis2_op_ctx_get_msg_ctx(operation_ctx, env,
AXIS2_WSDL_MESSAGE_LABEL_IN);

//get message header
axis2_msg_info_headers_t * msg_info_headers =
     axis2_msg_ctx_get_msg_info_headers(in_msg_ctx, env);

//get TO endpoint reference from message header
axis2_endpoint_ref_t * ToEPRfromHeaders =
     axis2_msg_info_headers_get_to(msg_info_headers, env);

//get TO endpoint reference from message context
axis2_endpoint_ref_t * ToEPRfromCtx =
     axis2_msg_ctx_get_to(in_msg_ctx, env);

/*Get list of reference parameters*/
axutil_array_list_t * refParamList_FromToFromHeader =
     axis2_endpoint_ref_get_ref_param_list(ToEPRfromHeaders, env);

axutil_array_list_t * refParamList_FromToFromCtx =
     axis2_endpoint_ref_get_ref_param_list(ToEPRfromCtx, env);

axutil_array_list_t * refParamList_FromHeader =
     axis2_msg_info_headers_get_all_ref_params(msg_info_headers, env);

Calling axutil_array_list_size on the lists returns 0.  Calling
axutil_array_list_get to get the first element in the lists returns NULL.

I used TCPmon to make sure there are reference parameters being passed.
Everything looks as expected.  TCPmon view of the header:

   <soapenv:Header>
       <wsa:To>http://localhost:8000/axis2/services/rbyteio</wsa:To>
       <wsa:TestParameter
wsa:isReferenceParameter="true">testing</wsa:TestParameter>
       <wsa:Action>http://schemas.ggf.org/rns/2006/05/rbyteio/append
</wsa:Action>

<wsa:MessageID>urn:uuid:5c017fcc-ab4e-1dd1-3bea-00e0812c2160</wsa:MessageID>
   </soapenv:Header>

I set the reference parameters as follows in my client code:

/*create axiom ref param element*/
axiom_node_t *refParams_node = NULL;
axiom_element_t *refParams_ele = NULL;
refParams_ele = axiom_element_create(env, NULL, "TestParameter", nsWSA,
&refParams_node);
axiom_element_set_text(refParams_ele, env, "testing", refParams_node);

/*create EPR and add ref param element*/
endpoint_ref = axis2_endpoint_ref_create(env,
    http://localhost:8000/axis2/services/rbyteio");
axis2_endpoint_ref_add_ref_param(endpoint_ref, env, refParams_node);

/*Specify request should be sent to created EPR*/
options = axis2_options_create(env);
axis2_options_set_to(options, env, endpoint_ref);

Mime
View raw message