>>-----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