axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damitha Kumarage <dami...@wso2.com>
Subject Re: http cookies
Date Tue, 29 Jun 2010 04:14:05 GMT
Doug Price wrote:
> Thanks for the information.  Using the approach you outlined works for the first message
I send, but fails on the second.  Unfortunately for my needs, I must request a list of resources
from the service and then download each resource in the list (see code below).  Stepping through
the Axis2C source I can see that both invocations eventually end up in axis2_http_simple_request_get_first_header().
 In the first call, my axis2_http_header_t is in the list, but on the second, the name value
is null, which causes a crash.  So it would appear that my header is getting deleted, leaving
a dangling pointer.
>   
So with your first request the http header you set goes to the server 
and with your second request it does not go. Is that so?
> I assumed that since the stub can be used multiple times that the stub's options could
as well.
Yes it should. options struct that you get from the stub is supposed to 
be deleted when svc_client is deleted. svc_client is deleted when stub 
is deleted. So the properties you set should exist until you delete the 
stub. If this is not so let me know.

Thanks,
Damitha
>   Is there a way for me to avoid this deletion?  Am I supposed to add the header properties
to the stub before each call?  Any advice would be appreciated.
>
>
>         std::string headerStr = ".ASPXAUTH=";
>         headerStr += aspxAuth;
>         axis2_http_header_t *header = axis2_http_header_create(env,
>             AXIS2_HTTP_HEADER_COOKIE, headerStr.c_str());
>         axutil_array_list_t *header_list = axutil_array_list_create(env, 2);
>         axutil_array_list_add(header_list, env, (void *)header);
>         axutil_property_t *header_property = axutil_property_create(env);
>         axis2_options_t *options = axis2_stub_get_options(stub, env);
>         axutil_property_set_value(header_property, env, header_list);
>         axutil_property_set_free_func(header_property, env,
>             axutil_array_list_free_void_arg);
>         axis2_options_set_property(options, env,
>             AXIS2_TRANSPORT_HEADER_PROPERTY, header_property);
>
> // this works
>         adb_GetClientResources_t *getClientResources = adb_GetClientResources_create(env);
>
>         int size;
>         unsigned char *buffer;
>         std::string fileName, root = getenv("PRESAGIS_HYDRA_1_0");
>         adb_DownloadResource_t *downloadResource;
>         adb_DownloadResourceRequest_t *downloadResourceRequest;
>         adb_DownloadResourceResponseE11_t *downloadResourceResponseE11;
>         adb_DownloadResourceResponse_t *downloadResourceResponse;
>         axutil_base64_binary_t *binary;
>         adb_GetClientResourcesResponse_t *getClientResourcesResponse = axis2_stub_op_ExternalService_GetClientResources(stub,
env, getClientResources);
>         if (getClientResourcesResponse != NULL) {
>             adb_GetResourcesResponse_t *getResourcesResponse = adb_GetClientResourcesResponse_get_GetClientResourcesResult(getClientResourcesResponse,
env);
>             if (getResourcesResponse != NULL) {
>                 adb_ArrayOfResource_t *arrayOfResource = adb_GetResourcesResponse_get_Resources(getResourcesResponse,
env);
>                 if (arrayOfResource != NULL) {
>                     int id, numResources = adb_ArrayOfResource_sizeof_Resource(arrayOfResource,
env);
>                     adb_Resource_t *resource;
>                     axis2_char_t *name, *type;
>                     for (int i=0;i<numResources;i++) {
>
>                         resource = adb_ArrayOfResource_get_Resource_at(arrayOfResource,
env, i);
>                         id = adb_Resource_get_Id(resource, env);
>                         name = adb_Resource_get_FileName(resource, env);
>                         type = adb_Resource_get_TypeName(resource, env);
>
>                         downloadResourceRequest = adb_DownloadResourceRequest_create(env);
>                         adb_DownloadResourceRequest_set_ResourceId(downloadResourceRequest,
env, id);
>                         downloadResource = adb_DownloadResource_create(env);
>                         adb_DownloadResource_set_request(downloadResource, env, downloadResourceRequest);
>
> // this fails
>                         downloadResourceResponseE11 = axis2_stub_op_ExternalService_DownloadResource(stub,
env, downloadResource);
>
>
> --
> Doug Price
> Research Director | Presagis
>
> T. +1 972 943.2400 X2433  F. +1 469 467.4564  C. +1 469 867.8399
>
> DISCLAIMER: This e-mail message is for the sole use of the intended recipient(s) and
may contain confidential and/or proprietary information. Do not read, copy, or disseminate
this message unless you are the addressee. Any unauthorized review, use, disclosure or distribution
is strictly prohibited. If you have received this message in error, please contact the sender
by reply e-mail and delete the original and any copies from your system.
>
> -----Original Message-----
>
> From: Damitha Kumarage [mailto:damitha@wso2.com]
> Sent: Friday, June 18, 2010 12:50 AM
> To: Apache AXIS C User List
> Subject: Re: http cookies
>
> Doug Price wrote:
>   
>> I guess that's the part I'm missing.  What API do I use to attach the options to
the request?  I don't see anything that will let me do that.
>>
>>     
> You can call axis2_stub_get_options to get the stub and set the header there
>
> Damitha
>   
>> --
>> Doug Price
>> Research Director | Presagis
>>
>> T. +1 972 943.2400 X2433  F. +1 469 467.4564  C. +1 469 867.8399
>>
>> DISCLAIMER: This e-mail message is for the sole use of the intended recipient(s)
and may contain confidential and/or proprietary information. Do not read, copy, or disseminate
this message unless you are the addressee. Any unauthorized review, use, disclosure or distribution
is strictly prohibited. If you have received this message in error, please contact the sender
by reply e-mail and delete the original and any copies from your system.
>>
>> -----Original Message-----
>>
>> From: Damitha Kumarage [mailto:damitha@wso2.com]
>> Sent: Thursday, June 17, 2010 1:50 AM
>> To: Apache AXIS C User List
>> Subject: Re: http cookies
>>
>> Doug Price wrote:
>>
>>     
>>> Thanks for the information.  I tried to add this to an functioning Axis2c web
service client, but when I examine the incoming packing on the server using network monitor
I don't see the cookie information.  I assume I'm probably just missing a step.  Can you see
anything wrong w/ the code below?
>>>
>>> axutil_array_list_t *header_list = axutil_array_list_create(env, 2);
>>> axis2_char_t *header_str = "Cookie: ASP.NET_SessionId=40a3mv55xoaj5055ltjo0h45;
.ASPXAUTH=C1B9F50A916D98A80730C38C3F0FF65269D8AE7E8766288EB640DD5C01F6E929D6C0EF76AD6CA3083C6D92B086520204F22F1F843AC7206C4EBADA25C023BA8F81AD355F741F1B552BFBACD3BFBA0148D2AE3798701A7A4E975D94619C322F9CDBFC";
>>> axis2_http_header_t *header = axis2_http_header_create_by_str(env, header_str);
>>> axutil_array_list_add(header_list, env, (void *)header);
>>> axutil_property_t *header_property = axutil_property_create(env);
>>> axis2_options_t *options = axis2_options_create(env);
>>> axutil_property_set_value(header_property, env, header_list);
>>> axutil_property_set_free_func(header_property, env, axutil_array_list_free_void_arg);
>>> axis2_options_set_property(options, env, AXIS2_TRANSPORT_HEADER_PROPERTY, header_property);
>>>
>>> adb_resourceRequest_t *request = adb_resourceRequest_create(env);
>>> adb_resourceResponse_t *response = axis2_stub_op_test_resource(stub, env, request);
>>>
>>>
>>>       
>> They way you try head a header is OK. But it seems you don't use your
>> created options struct for request.
>>
>> Thanks,
>> Damitha
>>
>>     
>>> --
>>> Doug Price
>>> Research Director | Presagis
>>>
>>> T. +1 972 943.2400 X2433  F. +1 469 467.4564  C. +1 469 867.8399
>>>
>>> DISCLAIMER: This e-mail message is for the sole use of the intended recipient(s)
and may contain confidential and/or proprietary information. Do not read, copy, or disseminate
this message unless you are the addressee. Any unauthorized review, use, disclosure or distribution
is strictly prohibited. If you have received this message in error, please contact the sender
by reply e-mail and delete the original and any copies from your system.
>>>
>>> -----Original Message-----
>>>
>>> From: Damitha Kumarage [mailto:damitha@wso2.com]
>>> Sent: Tuesday, June 15, 2010 8:59 AM
>>> To: Apache AXIS C User List
>>> Subject: Re: http cookies
>>>
>>> Doug Price wrote:
>>>
>>>
>>>       
>>>> I'm using the Axis2c utility WSDL2C to create a client for an existing
>>>> web service. That works fine. However, for authentication purposes, I
>>>> now need to set cookies in the HTTP header of the SOAP message. It
>>>> would appear there are ways to do this using the underlying Axis2c
>>>> functions, but I don't see a way that I can use them with the stub
>>>> structs generated by WSDL2C. Ideally, I'd like to create my request
>>>> struct and set the cookie information on it (or some other related
>>>> struct) before passing it to the underlying Axis2c code so that I can
>>>> continue to use WSDL2C as the web service interface changes. Is this
>>>> possible? If not, what's the easiest way to set cookies on the HTTP
>>>> header?
>>>>
>>>>
>>>>
>>>>         
>>> Axis2/c client handles cookies set by server at transport level.
>>> However if you need to create a cookie in your client you need to add it
>>> as a http header. The way to add a http header is,
>>> first create the header using axis2_http_header_create_by_str and then
>>> add this header as a property in the options struct.
>>> Thanks,
>>> Damitha
>>>
>>>
>>>       
>>>> --
>>>> *Doug Price*
>>>> Research Director | *Presagis*
>>>>
>>>> *T.* +1 972 943.2400 X2433 *F.* +1 469 467.4564 *C.* +1 469 867.8399
>>>>
>>>>
>>>> DISCLAIMER: This e-mail message is for the sole use of the intended
>>>> recipient(s) and may contain confidential and/or proprietary
>>>> information. Do not read, copy, or disseminate this message unless you
>>>> are the addressee. Any unauthorized review, use, disclosure or
>>>> distribution is strictly prohibited. If you have received this message
>>>> in error, please contact the sender by reply e-mail and delete the
>>>> original and any copies from your system.
>>>>
>>>>
>>>>
>>>>
>>>>         
>>> --
>>> __________________________________________________________________
>>>
>>> Damitha Kumarage
>>> Technical Lead; WSO2 Inc.
>>> "Oxygenating the Web Service Platform; " http://www.wso2.com/
>>>
>>> blog: " http://damithakumarage.wordpress.com/
>>> __________________________________________________________________
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: c-user-unsubscribe@axis.apache.org
>>> For additional commands, e-mail: c-user-help@axis.apache.org
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: c-user-unsubscribe@axis.apache.org
>>> For additional commands, e-mail: c-user-help@axis.apache.org
>>>
>>>
>>>
>>>
>>>       
>> --
>> __________________________________________________________________
>>
>> Damitha Kumarage
>> Technical Lead; WSO2 Inc.
>> "Oxygenating the Web Service Platform; " http://www.wso2.com/
>>
>> blog: " http://damithakumarage.wordpress.com/
>> __________________________________________________________________
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: c-user-unsubscribe@axis.apache.org
>> For additional commands, e-mail: c-user-help@axis.apache.org
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: c-user-unsubscribe@axis.apache.org
>> For additional commands, e-mail: c-user-help@axis.apache.org
>>
>>
>>
>>     
>
>
> --
> __________________________________________________________________
>
> Damitha Kumarage
> Technical Lead; WSO2 Inc.
> "Oxygenating the Web Service Platform; " http://www.wso2.com/
>
> blog: " http://damithakumarage.wordpress.com/
> __________________________________________________________________
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: c-user-help@axis.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: c-user-help@axis.apache.org
>
>
>   


-- 
__________________________________________________________________

Damitha Kumarage
Technical Lead; WSO2 Inc.
"Oxygenating the Web Service Platform; " http://www.wso2.com/

blog: " http://damithakumarage.wordpress.com/
__________________________________________________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: c-user-unsubscribe@axis.apache.org
For additional commands, e-mail: c-user-help@axis.apache.org


Mime
View raw message