I found the solution to setting the cookie from the skeleton, so I thought
I’d record it for posterity.





        axis2_msg_ctx * ctx = outCtx->getAxis2MessageContext(); /// using
WSO2WSF C++



        const axutil_env_t *env = wso2wsf::Environment::getEnv();



        if ( ctx ) {



            axis2_http_out_transport_info_t *out_info =

(axis2_http_out_transport_info_t *)axis2_msg_ctx_get_out_transport_info(ctx,
env);



            axis2_char_t *uuid = axutil_uuid_gen(env);



            axis2_char_t * cookie = axutil_strcat(env,

                    "session=\"",

                    uuid,

                    "\"; Path=/;",

                    NULL);



            if ( out_info ) {

                AXIS2_HTTP_OUT_TRANSPORT_INFO_SET_COOKIE_HEADER(out_info,
env, cookie);

            }

        }





I see the “Set-Cookie” header returned. Which is great J





However the client doesn’t seem to save and  add the Cookie header for the
next request.





I have scope=”transportsession” in the services.xml. I’m also using libcurl
as the sender library.



(I have seen references to SCOPE_REQUEST in axis2_libcurl_send – not sure if
those are correct or not ?)







>From the various lists and forums it just seems that with libcurl client
side “cookies just work”, but I’ve stepped through the code and can’t see an
obvious place where axis2_libcurl stores the returned header value. Since
the curl code is reset for every axis2_libcurl_send(), I assumed that
something outside of libcurl must be storing the cookies between requests.
Am I mis-reading the code ?



This is all with Axis 1.7 RC12





Any clues on where to look next ?



I am getting a bit concerned that I may have selected the wrong SOAP
library, there seems to be what I would have thought were “basic
capabilities” (i.e. cookies) missing in the released version. When the trunk
hasn’t been touched for 4months – that’s not a sign of project vitality. Is
no one doing SOAP in C/C++ anymore ?





Richard.



On Mon, Apr 18, 2011 at 12:02 PM, Richard Offer <[email protected]> wrote:

>
> Hi,
>
> Its taken me a while to figure out how to do this, but its now crashing -
> so that's a sign I'm getting somewhere (hopefully) :-)
>
>
> In the service skeleton I have
>
>             axis2_out_transport_info * tInfo =
> axis2_msg_ctx_get_out_transport_info( ctx, env );
>
>             if ( tInfo ) {
>
>                 axis2_char_t *uuid = axutil_uuid_gen(env);
>
>                 axis2_char_t * cookie = axutil_strcat(env,
>                         "session=\"",
>                         uuid,
>                         "\"; Path=/;",
>                         NULL);
>
>                 if ( cookie ) {
>
>                     AXIS2_OUT_TRANSPORT_INFO_SET_COOKIE_HEADER( tInfo, env,
>  cookie );
>                 }
>             }
>
>
> Its crashing at the MACRO - tInfo is a valid pointer, but its points to
> NULL.
>
>
> What;s the correct way to cause the Set-Cookie header to be sent with
> content that I define ?
>
>
> Thanks
>
>
> richard.
>

Reply via email to