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 Pavani J <jp...@gmail.com> on 2013/02/25 20:01:29 UTC

New Axis2c user - Axis2c API returning NULL

Hi,

I am a new user of Axis2c and I am stuck because of the following:

I have WSDL generated C stubs and using axis2c-1.7.0 to deploy web service
based on them. I am on server side.

Below is my code snippets that I tried to get HTTP header and it is
returning NULL. Actually I am trying to get Cookie information from header.
 I could see the headers with Cookie information when I did a packet
capture using wireshark, where Axis2c API is returning NULL for the same.
Please let me know if there is anything wrong with the following code.

1) First method
    axutil_property_t* property = NULL;
    axis2_char_t* prop_val = NULL;
    property = axis2_msg_ctx_get_property(msg_ctx, env,
AXIS2_TRANSPORT_HEADERS);  // <--- this is returning NULL
    if (property == NULL)
    {
        printf("property is NULL\n\n");
    }
    else
    {
        prop_val = (axis2_char_t*)axutil_property_get_value(property, env);
        if (prop_val == NULL)
        {
            printf(" prop_val is NULL\n\n");
        }
        else
        {
            printf("prop_val: %s\n\n", prop_val);
        }
    }

2) Second Method

    axutil_hash_t* header = NULL;
    header = axis2_msg_ctx_get_transport_headers(msg_ctx, env);   // <---
This is returning NULL
    if (header)
    {
        axis2_http_header_t* test = NULL;
        test = (axis2_http_header_t*) axutil_hash_get(header,
AXIS2_HTTP_HEADER_COOKIE, AXIS2_HASH_KEY_STRING);
        if (test)
        {
            axis2_char_t* val = NULL;
            val = axis2_http_header_get_value(test, env);
            if (val)
            {
                printf (" axis2_http_header_get_value, val: %s\n\n", val);
            }
            else
            {
                printf("axis2_http_header_get_value returned NULL\n\n");
            }
        }
        else
        {
            printf("axutil_hash_get returned NULL\n\n");
        }
    }
    else
    {
        printf("axis2_msg_ctx_get_transport_headers returned NULL\n\n");
    }


Any help is appreciated.

Thanks,
Pavani

Re: New Axis2c user - Axis2c API returning NULL

Posted by Oscar Pernas <os...@pernas.es>.
By the way, synchronous examples worked for me (tested with online
webservices). I think that now I have working a synchronous client wrapped
in c++ with cilent api. If you need some extra examples tell me.

regards


2013/2/26 Stadelmann Josef <jo...@axa-winterthur.ch>

> I have a question: ****
>
> Are the samples delivered with your axis2C kit running?****
>
> There are all kind of samples, simple and more complex ones. ****
>
> If you work / debugging through this examples, you learn a lot.****
>
> Once an example is running, enhance it with your code below: i.e.****
>
> call to axis2_msg_ctx_get_property****
>
> ** **
>
> But make sure, that at the client side, the client has in fact feed a
> property into the message context.****
>
> If the client does not pass a property into the message context for
> transport to the server, NULL at the ****
>
> server side is normal. Or what else would you expect from the server in
> this case?****
>
> ** **
>
> Josef****
>
> ** **
>
> *Von:* Pavani J [mailto:jpavani07@gmail.com]
> *Gesendet:* Montag, 25. Februar 2013 20:01
> *An:* c-user@axis.apache.org
> *Betreff:* New Axis2c user - Axis2c API returning NULL****
>
> ** **
>
> Hi,****
>
> ** **
>
> I am a new user of Axis2c and I am stuck because of the following:****
>
> ** **
>
> I have WSDL generated C stubs and using axis2c-1.7.0 to deploy web service
> based on them. I am on server side.****
>
> ** **
>
> Below is my code snippets that I tried to get HTTP header and it is
> returning NULL. Actually I am trying to get Cookie information from header.
>  I could see the headers with Cookie information when I did a packet
> capture using wireshark, where Axis2c API is returning NULL for the same.*
> ***
>
> Please let me know if there is anything wrong with the following code.****
>
> ** **
>
> 1) First method****
>
>     axutil_property_t* property = NULL;****
>
>     axis2_char_t* prop_val = NULL;****
>
>     property = axis2_msg_ctx_get_property(msg_ctx, env,****
>
> AXIS2_TRANSPORT_HEADERS);  // <--- this is returning NULL****
>
>     if (property == NULL)****
>
>     {****
>
>         printf("property is NULL\n\n");****
>
>     }****
>
>     else****
>
>     {****
>
>         prop_val = (axis2_char_t*)axutil_property_get_value(property, env);
> ****
>
>         if (prop_val == NULL)****
>
>         {****
>
>             printf(" prop_val is NULL\n\n");****
>
>         }****
>
>         else****
>
>         {****
>
>             printf("prop_val: %s\n\n", prop_val);****
>
>         }****
>
>     }****
>
> ** **
>
> 2) Second Method****
>
> ** **
>
>     axutil_hash_t* header = NULL;****
>
>     header = axis2_msg_ctx_get_transport_headers(msg_ctx, env);   // <---
> This is returning NULL****
>
>     if (header)****
>
>     {****
>
>         axis2_http_header_t* test = NULL;****
>
>         test = (axis2_http_header_t*) axutil_hash_get(header,****
>
> AXIS2_HTTP_HEADER_COOKIE, AXIS2_HASH_KEY_STRING);****
>
>         if (test)****
>
>         {****
>
>             axis2_char_t* val = NULL;****
>
>             val = axis2_http_header_get_value(test, env);****
>
>             if (val)****
>
>             {****
>
>                 printf (" axis2_http_header_get_value, val: %s\n\n", val);
> ****
>
>             }****
>
>             else****
>
>             {****
>
>                 printf("axis2_http_header_get_value returned NULL\n\n");**
> **
>
>             }****
>
>         }****
>
>         else****
>
>         {****
>
>             printf("axutil_hash_get returned NULL\n\n");****
>
>         }****
>
>     }****
>
>     else****
>
>     {****
>
>         printf("axis2_msg_ctx_get_transport_headers returned NULL\n\n");**
> **
>
>     }****
>
> ** **
>
> ** **
>
> Any help is appreciated.****
>
> ** **
>
> Thanks,****
>
> Pavani****
>
> ** **
>
> ** **
>



-- 
Óscar Pernas Plaza.

Re: New Axis2c user - Axis2c API returning NULL

Posted by Pavani J <jp...@gmail.com>.
Hi,

I forgot to mention that I am using simple axis2 HTTP server,
axis2_http_server on linux.

Below is from client to server:

POST /axis2/services/MyService8.0 HTTP/1.1
Cookie: MYSESSIONID=92f1e42d-bef3-4726-9b31-a5335ec123f8
Content-Type: application/soap+xml; charset=utf-8;
action="urn:getNumberOfEntries"
Host: 10.112.8.137:9090
Content-Length: 538
Expect: 100-continue
Accept-Encoding: gzip, deflate

I am interested in Cookie in the header.

Any help is appreciated.

Thanks,
Pavani

On Tue, Feb 26, 2013 at 1:21 PM, Pavani J <jp...@gmail.com> wrote:

> Hi,
>
> I went through samples/server/session.
> Do I need to
> 1.  have/create mysql database table for session-table
> 2. build apache module with mod-dbd enabled
> for message context, msg_ctx to return Cookie information?
> Or it is there for sample code to work?
>
> Client is setting HTTP headers properly, I can see Cookie information on
> wireshark.
>
>
> Any help is appreciated.
>
> Thanks,
> Pavani
>
>
> On Tue, Feb 26, 2013 at 12:34 AM, Stadelmann Josef <
> josef.stadelmann@axa-winterthur.ch> wrote:
>
>> I have a question: ****
>>
>> Are the samples delivered with your axis2C kit running?****
>>
>> There are all kind of samples, simple and more complex ones. ****
>>
>> If you work / debugging through this examples, you learn a lot.****
>>
>> Once an example is running, enhance it with your code below: i.e.****
>>
>> call to axis2_msg_ctx_get_property****
>>
>> ** **
>>
>> But make sure, that at the client side, the client has in fact feed a
>> property into the message context.****
>>
>> If the client does not pass a property into the message context for
>> transport to the server, NULL at the ****
>>
>> server side is normal. Or what else would you expect from the server in
>> this case?****
>>
>> ** **
>>
>> Josef****
>>
>> ** **
>>
>> *Von:* Pavani J [mailto:jpavani07@gmail.com]
>> *Gesendet:* Montag, 25. Februar 2013 20:01
>> *An:* c-user@axis.apache.org
>> *Betreff:* New Axis2c user - Axis2c API returning NULL****
>>
>> ** **
>>
>> Hi,****
>>
>> ** **
>>
>> I am a new user of Axis2c and I am stuck because of the following:****
>>
>> ** **
>>
>> I have WSDL generated C stubs and using axis2c-1.7.0 to deploy web
>> service based on them. I am on server side.****
>>
>> ** **
>>
>> Below is my code snippets that I tried to get HTTP header and it is
>> returning NULL. Actually I am trying to get Cookie information from header.
>>  I could see the headers with Cookie information when I did a packet
>> capture using wireshark, where Axis2c API is returning NULL for the same.
>> ****
>>
>> Please let me know if there is anything wrong with the following code.***
>> *
>>
>> ** **
>>
>> 1) First method****
>>
>>     axutil_property_t* property = NULL;****
>>
>>     axis2_char_t* prop_val = NULL;****
>>
>>     property = axis2_msg_ctx_get_property(msg_ctx, env,****
>>
>> AXIS2_TRANSPORT_HEADERS);  // <--- this is returning NULL****
>>
>>     if (property == NULL)****
>>
>>     {****
>>
>>         printf("property is NULL\n\n");****
>>
>>     }****
>>
>>     else****
>>
>>     {****
>>
>>         prop_val = (axis2_char_t*)axutil_property_get_value(property,
>> env);****
>>
>>         if (prop_val == NULL)****
>>
>>         {****
>>
>>             printf(" prop_val is NULL\n\n");****
>>
>>         }****
>>
>>         else****
>>
>>         {****
>>
>>             printf("prop_val: %s\n\n", prop_val);****
>>
>>         }****
>>
>>     }****
>>
>> ** **
>>
>> 2) Second Method****
>>
>> ** **
>>
>>     axutil_hash_t* header = NULL;****
>>
>>     header = axis2_msg_ctx_get_transport_headers(msg_ctx, env);   // <---
>> This is returning NULL****
>>
>>     if (header)****
>>
>>     {****
>>
>>         axis2_http_header_t* test = NULL;****
>>
>>         test = (axis2_http_header_t*) axutil_hash_get(header,****
>>
>> AXIS2_HTTP_HEADER_COOKIE, AXIS2_HASH_KEY_STRING);****
>>
>>         if (test)****
>>
>>         {****
>>
>>             axis2_char_t* val = NULL;****
>>
>>             val = axis2_http_header_get_value(test, env);****
>>
>>             if (val)****
>>
>>             {****
>>
>>                 printf (" axis2_http_header_get_value, val: %s\n\n", val);
>> ****
>>
>>             }****
>>
>>             else****
>>
>>             {****
>>
>>                 printf("axis2_http_header_get_value returned NULL\n\n");*
>> ***
>>
>>             }****
>>
>>         }****
>>
>>         else****
>>
>>         {****
>>
>>             printf("axutil_hash_get returned NULL\n\n");****
>>
>>         }****
>>
>>     }****
>>
>>     else****
>>
>>     {****
>>
>>         printf("axis2_msg_ctx_get_transport_headers returned NULL\n\n");*
>> ***
>>
>>     }****
>>
>> ** **
>>
>> ** **
>>
>> Any help is appreciated.****
>>
>> ** **
>>
>> Thanks,****
>>
>> Pavani****
>>
>> ** **
>>
>> ** **
>>
>
>

Re: New Axis2c user - Axis2c API returning NULL

Posted by Pavani J <jp...@gmail.com>.
Hi,

I went through samples/server/session.
Do I need to
1.  have/create mysql database table for session-table
2. build apache module with mod-dbd enabled
for message context, msg_ctx to return Cookie information?
Or it is there for sample code to work?

Client is setting HTTP headers properly, I can see Cookie information on
wireshark.


Any help is appreciated.

Thanks,
Pavani


On Tue, Feb 26, 2013 at 12:34 AM, Stadelmann Josef <
josef.stadelmann@axa-winterthur.ch> wrote:

> I have a question: ****
>
> Are the samples delivered with your axis2C kit running?****
>
> There are all kind of samples, simple and more complex ones. ****
>
> If you work / debugging through this examples, you learn a lot.****
>
> Once an example is running, enhance it with your code below: i.e.****
>
> call to axis2_msg_ctx_get_property****
>
> ** **
>
> But make sure, that at the client side, the client has in fact feed a
> property into the message context.****
>
> If the client does not pass a property into the message context for
> transport to the server, NULL at the ****
>
> server side is normal. Or what else would you expect from the server in
> this case?****
>
> ** **
>
> Josef****
>
> ** **
>
> *Von:* Pavani J [mailto:jpavani07@gmail.com]
> *Gesendet:* Montag, 25. Februar 2013 20:01
> *An:* c-user@axis.apache.org
> *Betreff:* New Axis2c user - Axis2c API returning NULL****
>
> ** **
>
> Hi,****
>
> ** **
>
> I am a new user of Axis2c and I am stuck because of the following:****
>
> ** **
>
> I have WSDL generated C stubs and using axis2c-1.7.0 to deploy web service
> based on them. I am on server side.****
>
> ** **
>
> Below is my code snippets that I tried to get HTTP header and it is
> returning NULL. Actually I am trying to get Cookie information from header.
>  I could see the headers with Cookie information when I did a packet
> capture using wireshark, where Axis2c API is returning NULL for the same.*
> ***
>
> Please let me know if there is anything wrong with the following code.****
>
> ** **
>
> 1) First method****
>
>     axutil_property_t* property = NULL;****
>
>     axis2_char_t* prop_val = NULL;****
>
>     property = axis2_msg_ctx_get_property(msg_ctx, env,****
>
> AXIS2_TRANSPORT_HEADERS);  // <--- this is returning NULL****
>
>     if (property == NULL)****
>
>     {****
>
>         printf("property is NULL\n\n");****
>
>     }****
>
>     else****
>
>     {****
>
>         prop_val = (axis2_char_t*)axutil_property_get_value(property, env);
> ****
>
>         if (prop_val == NULL)****
>
>         {****
>
>             printf(" prop_val is NULL\n\n");****
>
>         }****
>
>         else****
>
>         {****
>
>             printf("prop_val: %s\n\n", prop_val);****
>
>         }****
>
>     }****
>
> ** **
>
> 2) Second Method****
>
> ** **
>
>     axutil_hash_t* header = NULL;****
>
>     header = axis2_msg_ctx_get_transport_headers(msg_ctx, env);   // <---
> This is returning NULL****
>
>     if (header)****
>
>     {****
>
>         axis2_http_header_t* test = NULL;****
>
>         test = (axis2_http_header_t*) axutil_hash_get(header,****
>
> AXIS2_HTTP_HEADER_COOKIE, AXIS2_HASH_KEY_STRING);****
>
>         if (test)****
>
>         {****
>
>             axis2_char_t* val = NULL;****
>
>             val = axis2_http_header_get_value(test, env);****
>
>             if (val)****
>
>             {****
>
>                 printf (" axis2_http_header_get_value, val: %s\n\n", val);
> ****
>
>             }****
>
>             else****
>
>             {****
>
>                 printf("axis2_http_header_get_value returned NULL\n\n");**
> **
>
>             }****
>
>         }****
>
>         else****
>
>         {****
>
>             printf("axutil_hash_get returned NULL\n\n");****
>
>         }****
>
>     }****
>
>     else****
>
>     {****
>
>         printf("axis2_msg_ctx_get_transport_headers returned NULL\n\n");**
> **
>
>     }****
>
> ** **
>
> ** **
>
> Any help is appreciated.****
>
> ** **
>
> Thanks,****
>
> Pavani****
>
> ** **
>
> ** **
>

AW: New Axis2c user - Axis2c API returning NULL

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
I have a question: 

Are the samples delivered with your axis2C kit running?

There are all kind of samples, simple and more complex ones. 

If you work / debugging through this examples, you learn a lot.

Once an example is running, enhance it with your code below: i.e.

call to axis2_msg_ctx_get_property

 

But make sure, that at the client side, the client has in fact feed a
property into the message context.

If the client does not pass a property into the message context for
transport to the server, NULL at the 

server side is normal. Or what else would you expect from the server in
this case?

 

Josef

 

Von: Pavani J [mailto:jpavani07@gmail.com] 
Gesendet: Montag, 25. Februar 2013 20:01
An: c-user@axis.apache.org
Betreff: New Axis2c user - Axis2c API returning NULL

 

Hi,

 

I am a new user of Axis2c and I am stuck because of the following:

 

I have WSDL generated C stubs and using axis2c-1.7.0 to deploy web
service based on them. I am on server side.

 

Below is my code snippets that I tried to get HTTP header and it is
returning NULL. Actually I am trying to get Cookie information from
header.  I could see the headers with Cookie information when I did a
packet capture using wireshark, where Axis2c API is returning NULL for
the same.

Please let me know if there is anything wrong with the following code.

 

1) First method

    axutil_property_t* property = NULL;

    axis2_char_t* prop_val = NULL;

    property = axis2_msg_ctx_get_property(msg_ctx, env,

AXIS2_TRANSPORT_HEADERS);  // <--- this is returning NULL

    if (property == NULL)

    {

        printf("property is NULL\n\n");

    }

    else

    {

        prop_val = (axis2_char_t*)axutil_property_get_value(property,
env);

        if (prop_val == NULL)

        {

            printf(" prop_val is NULL\n\n");

        }

        else

        {

            printf("prop_val: %s\n\n", prop_val);

        }

    }

 

2) Second Method

 

    axutil_hash_t* header = NULL;

    header = axis2_msg_ctx_get_transport_headers(msg_ctx, env);   //
<--- This is returning NULL

    if (header)

    {

        axis2_http_header_t* test = NULL;

        test = (axis2_http_header_t*) axutil_hash_get(header,

AXIS2_HTTP_HEADER_COOKIE, AXIS2_HASH_KEY_STRING);

        if (test)

        {

            axis2_char_t* val = NULL;

            val = axis2_http_header_get_value(test, env);

            if (val)

            {

                printf (" axis2_http_header_get_value, val: %s\n\n",
val);

            }

            else

            {

                printf("axis2_http_header_get_value returned NULL\n\n");

            }

        }

        else

        {

            printf("axutil_hash_get returned NULL\n\n");

        }

    }

    else

    {

        printf("axis2_msg_ctx_get_transport_headers returned NULL\n\n");

    }

 

 

Any help is appreciated.

 

Thanks,

Pavani