You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Shaun Mangelsdorf <s....@gmail.com> on 2007/07/26 07:19:13 UTC
[Axis2/C] Access to service context or environment
Hi,
I'm currently writing some web service code, and am at a bit of a loss on
how to proceed. The problem I have at the moment is that there is no context
information available to the web service "init" or "invoke" functions when
they are invoked.
I want to pass configuration options to the code (at runtime) and I need to
maintain some state between web service calls. I would rather not resort to
global variables for maintaining state if I can avoid it.
I am targeting this code at running under apache. If there was a way to get
to the server_rec or the module config pointer, I could use that to my
advantage.
Anyone able to offer a suggestion?
Thanks,
Shaun Mangelsdorf
Re: [Axis2/C] Access to service context or environment
Posted by Shaun Mangelsdorf <s....@gmail.com>.
Hi,
Yes, In server side, When invoking You can get msg_ctx using that
> message context you will be able to get config_ctx or config.
Thanks for the quick reply. I have had a look at the echo service in samples
and I can't see where the message context is used. After looking through the
axis2 API more, I can see that the conf_ctx has a fair bit of configuration
information in it, but it all seems specific to the axis2 environment. Is
there a way to get custom configuration information into (and ultimately
retrieve it from) this context struct?
I also can't see a way, using the message context, to maintain state between
web service calls - i.e. initialize a struct (or in my case, a C++ object
pointer) and access the same object again the next time a call is made. Is
this possible?
It seems to be a conscious design decision that the apache environment is
not visible within the service calls. Is there a way to get to the
request_rec or server_rec objects created by apache, from within the
service?
Thanks,
Shaun
Re: [Axis2/C] Access to service context or environment
Posted by Dinesh Premalal <xy...@gmail.com>.
Hi,
"Shaun Mangelsdorf" <s....@gmail.com> writes:
> I am targeting this code at running under apache. If there was a way to get to
> the server_rec or the module config pointer, I could use that to my
> advantage.
Yes, In server side, When invoking You can get msg_ctx using that
message context you will be able to get config_ctx or config.
AXIS2_EXTERN struct axis2_conf_ctx *AXIS2_CALL
axis2_msg_ctx_get_conf_ctx(const axis2_msg_ctx_t *msg_ctx,
const axutil_env_t *env);
Please see "echo" service under samples directory for more details.
thanks,
Dinesh
--
Dinesh Premalal
http://xydinesh.wordpress.com/
GPG ID : A255955C
GPG Key Finger Print : C481 E5D4 C27E DC34 9257 0229 4F44 266E A255 955C
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.org