You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Ishan De Silva <is...@gmail.com> on 2006/10/04 11:19:45 UTC
axis2_svc_client_get_options returns a "const" ?
Hi,
The get_option function of the service client returns a const
axis2_options_t pointer.
const axis2_options_t *AXIS2_CALL
axis2_svc_client_get_options(
const axis2_svc_client_t *svc_client,
const axis2_env_t *env);
This makes it difficult to use it in the following manner:
const axis2_options_t *options = NULL;
const axis2_char_t *old_action = NULL;
options = AXIS2_SVC_CLIENT_GET_OPTIONS (svc_client, env);
old_action = AXIS2_OPTIONS_GET_ACTION(options, env);
AXIS2_OPTIONS_SET_ACTION(options, env, "new action"); /* problem here
because set_action modifies options */
Is the const modifier required in this function?
Cheers,
Ishan.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org
Re: axis2_svc_client_get_options returns a "const" ?
Posted by Samisa Abeysinghe <sa...@wso2.com>.
Ishan De Silva wrote:
> Samisa Abeysinghe wrote:
>> Ishan De Silva wrote:
>>> Hi,
>>>
>>> The get_option function of the service client returns a const
>>> axis2_options_t pointer.
>> The idea is that use would create options and would own options.
>> Hence not need to access options from service client in your client
>> program. Rather use the pointer to options that you passes to service
>> client.
>>
> I came across this problem when writing a module. I'm providing a
> library function which takes in a service client as an IN parameter.
> Inside the function, I want to change the wsa:Action and use that
> client to send a message. I remember the old action so that I can set
> it back when returning from the function. So in this situation, I
> don't own the options nor the client.
>
> As a work around, I can forcefully cast the return value from
> get_option fn to a non-const type. Is that the correct way to go?
Yes that is a possible workaround.
However, in the handler, you have access to message context, using which
you can gain access to WSA action.
BTW, what sort of a handler you are writing that requires a service
client within it?
Thanks,
Samisa...
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org
Re: axis2_svc_client_get_options returns a "const" ?
Posted by Ishan De Silva <is...@gmail.com>.
Samisa Abeysinghe wrote:
> Ishan De Silva wrote:
>> Hi,
>>
>> The get_option function of the service client returns a const
>> axis2_options_t pointer.
> The idea is that use would create options and would own options. Hence
> not need to access options from service client in your client program.
> Rather use the pointer to options that you passes to service client.
>
I came across this problem when writing a module. I'm providing a
library function which takes in a service client as an IN parameter.
Inside the function, I want to change the wsa:Action and use that client
to send a message. I remember the old action so that I can set it back
when returning from the function. So in this situation, I don't own the
options nor the client.
As a work around, I can forcefully cast the return value from get_option
fn to a non-const type. Is that the correct way to go?
Thanks,
Ishan.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org
Re: axis2_svc_client_get_options returns a "const" ?
Posted by Samisa Abeysinghe <sa...@wso2.com>.
Ishan De Silva wrote:
> Hi,
>
> The get_option function of the service client returns a const
> axis2_options_t pointer.
The idea is that use would create options and would own options. Hence
not need to access options from service client in your client program.
Rather use the pointer to options that you passes to service client.
Samisa...
>
> const axis2_options_t *AXIS2_CALL
> axis2_svc_client_get_options(
> const axis2_svc_client_t *svc_client,
> const axis2_env_t *env);
>
> This makes it difficult to use it in the following manner:
>
> const axis2_options_t *options = NULL;
> const axis2_char_t *old_action = NULL;
> options = AXIS2_SVC_CLIENT_GET_OPTIONS (svc_client, env);
> old_action = AXIS2_OPTIONS_GET_ACTION(options, env);
> AXIS2_OPTIONS_SET_ACTION(options, env, "new action"); /* problem here
> because set_action modifies options */
>
>
> Is the const modifier required in this function?
>
> Cheers,
> Ishan.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-dev-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org