axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dimuthu Gamage" <dimut...@gmail.com>
Subject Re: Problem while returning the response back (axis2C)
Date Tue, 25 Sep 2007 05:43:49 GMT
Hi Sathya,
If I got your question correctly, you are asking why there the returning
object (which is created inside the service logic) is re-created  in the
client side.

When you create and return the adb objects in ther server logic it is
serialized into an xml  and embed it in a soap message and send to the
client. So client only have the xml. so in the client side to output adb
objects (similar to objects you created in the server side), we need to
recreate the objects with the information in the xml. That is done in the
deserialize function.  We cannot give the same objects returned by the
service, because simple we cannot send object pointers through the network.

You will be able to see the messages pass through client and server from a
tool like Apache tcpmon.

It seems that your adb object handling in the server logic is correct,( I
cant gaurentee that without seen the other generated code or the wsdl)  but
it is better you track the messages and check the response soap. So we can
find what s gone wrong.

And btw if is not safe to write code like,
myInt->attrib_pInterchange = adb_INTERCHANGE_create(env);

You are expected only use the header files (i.e. the API) so the above line
should better be changed to
adb_INTERCHANGE_t *x;
x = adb_INTERCHANGE_create(env);
adb_pInterchange_set_pInterchange(myInt, env, x);

This is because if you dont follow this, if you generate the code future you
may need to rewrite the service logic again,
since it is only the API is guaranteed to be kept same from version to
version.


Thanks,
Dimuthu




On 9/25/07, Sathya Raghunathan <pappu.raghunathan@gmail.com> wrote:
>
> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>

Mime
View raw message