---------- Forwarded message ----------
From: Sathya Raghunathan <[EMAIL PROTECTED]>
Date: Sep 25, 2007 10:10 AM
Subject: Problem while returning the response back (axis2C)
To: Apache AXIS C User List <[email protected]>
Hi
I sent a message to the service, but i have a problem while getting the
output message.
Please have a look at the service implementation:
adb_pInterchange_t* axis2_skel_ParseMessage_parseMessage (const
axutil_env_t *env ,
adb_inputMessage_t*
inputMessage )
{
/* TODO fill this with the necessary business logic */
adb_pInterchange_t* myInt = adb_pInterchange_create(env);
printf ("I am inside the service method %u\n",myInt );
myInt->attrib_pInterchange = adb_INTERCHANGE_create(env);
adb_INTERCHANGE_set_internal_intref_no(myInt->attrib_pInterchange,env,"222222");
printf("The address of intref no =
%u\n",adb_INTERCHANGE_get_internal_intref_no(myInt->attrib_pInterchange,env));
adb_INTERCHANGE_set_interchange_ref_no(myInt->attrib_pInterchange,env,"333333");
adb_INTERCHANGE_set_sender_id(myInt->attrib_pInterchange,env,"44444");
myInt->attrib_pInterchange->attrib_message= adb_MESSAGE_create(env);
printf ("THe sender id = %s\n",
adb_INTERCHANGE_get_sender_id(myInt->attrib_pInterchange,env));
return myInt;
}
Here, i created a pointer of myInt and populated with some value. And
returned myInt. When i print it in the client side, I am getting junk.
When i debugged it, I found that in adb_pInterchange_t*
axis2_stub_ParseMessage_parseMessage() function (axis2_stub_ParseMessage.c)
, after the call to axis2_svc_client_send_receive_with_op_qname( svc_client,
env, op_qname, payload), the code has generated another object of
adb_pInterchange_t and returns that to the client. If that is returned, the
object that I return from the service is lost. I am attaching the file
axis2_stub_ParseMessage.c for reference. Reference: LIne number : 140 and
149. Why there is a call to create interchange object once again at line 48?
I was thinking that, the object returned by the service should be returned
to the client.
Please let me know if the way, i created the object inside the service is
correct or not.
Thanks
Sathya
/**
* axis2_stub_ParseMessage.c
*
* This file was auto-generated from WSDL for
"ParseMessage|http://www.abnamro.com/paymentrouter" service
* by the Apache Axis2/C version: 1.3 Built on : Aug 10, 2007 (04:45:47
LKT)
*/
#include "axis2_stub_ParseMessage.h"
/**
* axis2_stub_ParseMessage C implementation
*/
axis2_stub_t*
axis2_stub_ParseMessage_create (const axutil_env_t *env,
axis2_char_t *client_home,
axis2_char_t *endpoint_uri)
{
axis2_stub_t *stub = NULL;
axis2_endpoint_ref_t *endpoint_ref = NULL;
AXIS2_FUNC_PARAM_CHECK ( client_home, env, NULL)
if (NULL == endpoint_uri )
{
endpoint_uri = axis2_stub_ParseMessage_get_endpoint_uri_from_wsdl(
env );
}
endpoint_ref = axis2_endpoint_ref_create(env, endpoint_uri);
stub = axis2_stub_create_with_endpoint_ref_and_client_home ( env,
endpoint_ref, client_home );
axis2_stub_ParseMessage_populate_services( stub, env );
return stub;
}
void axis2_stub_ParseMessage_populate_services( axis2_stub_t *stub, const
axutil_env_t *env)
{
axis2_svc_client_t *svc_client = NULL;
axutil_qname_t *svc_qname = NULL;
axutil_qname_t *op_qname = NULL;
axis2_svc_t *svc = NULL;
axis2_op_t *op = NULL;
/* Modifying the Service */
svc_client = axis2_stub_get_svc_client (stub, env );
svc = (axis2_svc_t*)axis2_svc_client_get_svc( svc_client, env );
axutil_qname_create(env,"ParseMessage" ,NULL, NULL);
axis2_svc_set_qname (svc, env, svc_qname);
/* creating the operations*/
op_qname = axutil_qname_create(env,
"parseMessage" ,
"http://www.abnamro.com/paymentrouter",
NULL);
op = axis2_op_create_with_qname(env, op_qname);
axis2_op_set_msg_exchange_pattern(op, env, AXIS2_MEP_URI_OUT_IN);
axis2_svc_add_op(svc, env, op);
}
/**
*return end point picked from wsdl
*/
axis2_char_t*
axis2_stub_ParseMessage_get_endpoint_uri_from_wsdl ( const axutil_env_t
*env )
{
axis2_char_t *endpoint_uri = NULL;
/* set the address from here */
endpoint_uri = "http://localhost:12345/soap";
return endpoint_uri;
}
/**
* auto generated method signature
* for "parseMessage|http://www.abnamro.com/paymentrouter" operation.
* @param inputMessage
* @return
*/
adb_pInterchange_t* axis2_stub_ParseMessage_parseMessage(
axis2_stub_t *stub, const axutil_env_t *env,
adb_inputMessage_t* inputMessage)
{
axis2_svc_client_t *svc_client = NULL;
axis2_options_t *options = NULL;
axiom_node_t *ret_node = NULL;
const axis2_char_t *soap_action = NULL;
axutil_qname_t *op_qname = NULL;
axiom_node_t *payload = NULL;
const axutil_string_t *soap_act = NULL;
adb_pInterchange_t* ret_val = NULL;
payload = adb_inputMessage_serialize(inputMessage,
env, NULL, AXIS2_FALSE);
options = axis2_stub_get_options( stub, env);
if ( NULL == options )
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "options is null in stub:
Error code:"
" %d :: %s", env->error->error_number,
AXIS2_ERROR_GET_MESSAGE(env->error));
return NULL;
}
printf ("point 1\n");
svc_client = axis2_stub_get_svc_client(stub, env );
soap_action = axis2_options_get_action( options, env );
if ( NULL == soap_action )
{
soap_action = "http://www.abnamro.com/paymentrouter#parseMessage";
soap_act = axutil_string_create(env,
"http://www.abnamro.com/paymentrouter#parseMessage");
axis2_options_set_soap_action(options, env, soap_act);
axis2_options_set_action( options, env, soap_action );
}
axis2_options_set_soap_version(options, env, AXIOM_SOAP11 );
op_qname = axutil_qname_create(env,
"parseMessage" ,
"http://www.abnamro.com/paymentrouter",
NULL);
printf ("point 2\n");
ret_node = axis2_svc_client_send_receive_with_op_qname(
svc_client, env, op_qname, payload);
if ( NULL == ret_node )
{
return NULL;
}
printf ("point 3\n");
ret_val = adb_pInterchange_create(env);
adb_pInterchange_deserialize(ret_val, env, ret_node );
return ret_val;
}
/**
* auto generated method signature for asynchronous invocations
* for "parseMessage|http://www.abnamro.com/paymentrouter" operation.
* @param inputMessage
* @param on_complete callback to handle on complete
* @param on_error callback to handle on error
*/
void axis2_stub_ParseMessage_parseMessage_start( axis2_stub_t *stub,
const axutil_env_t *env,
adb_inputMessage_t*
inputMessage,
axis2_status_t ( AXIS2_CALL
*on_complete ) (struct axis2_callback *, const axutil_env_t *) ,
axis2_status_t ( AXIS2_CALL
*on_error ) (struct axis2_callback *, const axutil_env_t *, int ) )
{
axis2_callback_t *callback = NULL;
axis2_svc_client_t *svc_client = NULL;
axis2_options_t *options = NULL;
const axis2_char_t *soap_action = NULL;
axiom_node_t *payload = NULL;
axutil_string_t *soap_act = NULL;
payload = adb_inputMessage_serialize(inputMessage,
env, NULL, AXIS2_FALSE);
options = axis2_stub_get_options( stub, env);
if ( NULL == options )
{
AXIS2_LOG_ERROR( env->log, AXIS2_LOG_SI, "options is null in
stub: Error code:"
" %d :: %s", env->error->error_number,
AXIS2_ERROR_GET_MESSAGE(env->error));
return;
}
svc_client = axis2_stub_get_svc_client (stub, env );
soap_action =axis2_options_get_action ( options, env );
if ( NULL == soap_action )
{
soap_action = "http://www.abnamro.com/paymentrouter#parseMessage";
soap_act = axutil_string_create(env,
"http://www.abnamro.com/paymentrouter#parseMessage");
axis2_options_set_soap_action(options, env, soap_act);
axis2_options_set_action( options, env, soap_action );
}
axis2_options_set_soap_version(options, env, AXIOM_SOAP11 );
callback = axis2_callback_create(env);
/* Set our on_complete fucntion pointer to the callback object */
axis2_callback_set_on_complete(callback, on_complete);
/* Set our on_error function pointer to the callback object */
axis2_callback_set_on_error(callback, on_error);
/* Send request */
axis2_svc_client_send_receive_non_blocking(svc_client, env,
payload, callback);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]