RE: changing the axis2/c message encoding
On Thu, 2009-07-23 at 17:35 -0500, Haszlakiewicz, Eric wrote: > >>>-Original Message- > >>>From: Haszlakiewicz, Eric [mailto:ehas...@transunion.com] > >>> > >>>I want to change the character encoding that axis2/c uses to send > >>>messages to ISO-8859-1. I am using adb generated code to send and > >>>receive the requests. I figured there'd probably be something > >>>I can set > >>>either in the axis2_stub_t service object, or maybe in > >>axis2_options_t, > >>>but I can't find anything that looks appropriate. > >>>How do I do this? > ...snip... > >The axis2_engine_send function seems to invokes "phases", so > >maybe I can > >hack something in here to set the charset in the msg_ctx? I found some > >general documentation about how phases and flows work in axis2, but I'm > >not quite sure how to go about implementing a phase. Can someone point > >me towards an example? Does this even sound like a reasonable way to > >get the encoding set? It seems like it's way harder than it should be. > > well, to response to my own email yet again, I used the addressing > module from the axis2c sources as an example and managed to create my > own module that sets the encoding in the msg_ctx and actually sends a > request with "Content-Type: text/xml;charset=ISO-8851-1" in the headers. > Unfortunately, the server side still had a problem deserializing the > request. I guess this isn't something that has been tested much, and > I'm probably in for a world of pain to get it working. :( Did you engage your module in the server sdie ? What are the errors it sends ? > > eric
RE: changing the axis2/c message encoding
>>>-Original Message- >>>From: Haszlakiewicz, Eric [mailto:ehas...@transunion.com] >>> >>>I want to change the character encoding that axis2/c uses to send >>>messages to ISO-8859-1. I am using adb generated code to send and >>>receive the requests. I figured there'd probably be something >>>I can set >>>either in the axis2_stub_t service object, or maybe in >>axis2_options_t, >>>but I can't find anything that looks appropriate. >>>How do I do this? ...snip... >The axis2_engine_send function seems to invokes "phases", so >maybe I can >hack something in here to set the charset in the msg_ctx? I found some >general documentation about how phases and flows work in axis2, but I'm >not quite sure how to go about implementing a phase. Can someone point >me towards an example? Does this even sound like a reasonable way to >get the encoding set? It seems like it's way harder than it should be. well, to response to my own email yet again, I used the addressing module from the axis2c sources as an example and managed to create my own module that sets the encoding in the msg_ctx and actually sends a request with "Content-Type: text/xml;charset=ISO-8851-1" in the headers. Unfortunately, the server side still had a problem deserializing the request. I guess this isn't something that has been tested much, and I'm probably in for a world of pain to get it working. :( eric
RE: changing the axis2/c message encoding
>>-Original Message- >>From: Haszlakiewicz, Eric [mailto:ehas...@transunion.com] >> >>I want to change the character encoding that axis2/c uses to send >>messages to ISO-8859-1. I am using adb generated code to send and >>receive the requests. I figured there'd probably be something >>I can set >>either in the axis2_stub_t service object, or maybe in >axis2_options_t, >>but I can't find anything that looks appropriate. >>How do I do this? >> >>eric >> > >anyone? I looked through the sources a bit, and it seems that there is >an encoding parameter in the msg_ctx that ends up being used >to send the >request, but I don't know how to set that. This is what my code does >now: > >axis2_stub_t *my_service = axis2_stub_create_MyService(env, >axis_cfg.client_home, axis_cfg.address); >axis2_options_t *opts = axis2_stub_get_options(an_service, env); >axis2_options_set_timeout_in_milli_seconds(opts, env, >axis_cfg.timeout); >adb_my_req_t *my_req = adb_my_req_create(env); >...etc... fill in my_req >adb_addrnorm_response_t *response; >response = axis2_stub_op_MyService_someOp(my_service, env, my_req); > Well, I traced through things a bit more. It seems that the encoding is set in axis2_http_transport_sender_invoke() using either any previously set value in the axis2_msg_ctx_t object, or by grabbing a charset property from some kind of axis2_ctx_t object. I have no idea where the axis2_ctx_t object comes from (it's not the one I tried to set by going through adb stub=>svc_client=>svc_ctx=>axis2_svc_ctx_get_base()), and it looks like I *can't* set things in the msg_ctx ahead of time because it's not even allocated yet. msg_ctx seems to be created in axis2_svc_client_send_receive_with_op_qname (svc_client.c:715), but nothing sets the charset after that point. -> stub function -> axis2_svc_client_send_receive_with_op_qname -> axis2_op_client_execute copies over some things from op_client to msg_ctx, but not charset (axis2_msg_ctx_set_options(msg_ctx, env, op_client->options);) -> axis2_op_client_two_way_send -> axis2_engine_send -> axis2_http_transport_sender_invoke The axis2_engine_send function seems to invokes "phases", so maybe I can hack something in here to set the charset in the msg_ctx? I found some general documentation about how phases and flows work in axis2, but I'm not quite sure how to go about implementing a phase. Can someone point me towards an example? Does this even sound like a reasonable way to get the encoding set? It seems like it's way harder than it should be. eric
RE: changing the axis2/c message encoding
>-Original Message- >From: Haszlakiewicz, Eric [mailto:ehas...@transunion.com] > >I want to change the character encoding that axis2/c uses to send >messages to ISO-8859-1. I am using adb generated code to send and >receive the requests. I figured there'd probably be something >I can set >either in the axis2_stub_t service object, or maybe in axis2_options_t, >but I can't find anything that looks appropriate. >How do I do this? > >eric > anyone? I looked through the sources a bit, and it seems that there is an encoding parameter in the msg_ctx that ends up being used to send the request, but I don't know how to set that. This is what my code does now: axis2_stub_t *my_service = axis2_stub_create_MyService(env, axis_cfg.client_home, axis_cfg.address); axis2_options_t *opts = axis2_stub_get_options(an_service, env); axis2_options_set_timeout_in_milli_seconds(opts, env, axis_cfg.timeout); adb_my_req_t *my_req = adb_my_req_create(env); ...etc... fill in my_req adb_addrnorm_response_t *response; response = axis2_stub_op_MyService_someOp(my_service, env, my_req); eric