axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramesh Gopal <fatuzorin2...@yahoo.com>
Subject Re: Some quick Axis2C help required
Date Tue, 04 Nov 2008 10:14:12 GMT

Hi,

------------------
Generated Code is
------------------

    AXIS2_ENV_CHECK(env, NULL);
    if (!node) ---- Complete Node
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
AXIS2_FAILURE);
        printf("ERROR: invalid XML in request\n");
    }
    parent_node = axiom_node_get_first_element(node, env);
    if (!parent_node)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
AXIS2_FAILURE);
        printf("ERROR: invalid XML in request\n");
    }
    request_node = axiom_node_get_first_child(parent_node, env);
    if (!request_node)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
AXIS2_FAILURE);
        printf("ERROR: invalid XML in request\n");
    }
    if (request_node && axiom_node_get_node_type(request_node, env) == AXIOM_TEXT)
    {
        axiom_text_t *reqtext = (axiom_text_t *)axiom_node_get_data_element(request_node,
env);
        if (reqtext && axiom_text_get_value(reqtext , env))
        {
            const axis2_char_t *reqtext_str = axiom_text_get_value(reqtext, env);
            inparam0 = reqtext_str;
            printf("The first param is %s : \n", inparam0);
        }
    }
    sibling_node = axiom_node_get_next_sibling(parent_node, env);
    if (!sibling_node)
    {
        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST,
AXIS2_FAILURE);
        printf("ERROR: invalid XML in request while getting sibling");
    }
    request_node =  axiom_node_get_first_child(sibling_node, env);
    if (request_node && axiom_node_get_node_type(request_node, env) == AXIOM_TEXT)
    {
        axiom_text_t *reqtext = (axiom_text_t *)axiom_node_get_data_element(request_node,
env);
        if (reqtext && axiom_text_get_value(reqtext , env))
        {
            const axis2_char_t *reqtext_str = axiom_text_get_value(reqtext, env);
            inparam1 = reqtext_str;
            printf("The second param is %s : \n", inparam1);
        }
    }


Does this help ?

With this code, can you pin-point the area of code which could be faulty.
Also, if you can suggest what change I need to be doing to avoid the "Segmentation Fault"
issue.


Rgds,
Ramesh.


--- On Tue, 4/11/08, Uthaiyashankar <shankar@wso2.com> wrote:

> From: Uthaiyashankar <shankar@wso2.com>
> Subject: Re: Some quick Axis2C help required
> To: "Apache AXIS C User List" <axis-c-user@ws.apache.org>
> Date: Tuesday, 4 November, 2008, 1:09 PM
> Hi Ramesh,
> 
> See the comments.
> 
> 
> > Sample xml request:
> > -------------------
> >
> > <operation>
> > <in1>1</in1>
> > <in2>2</in2>
> > </operation>
> >
> > My sample code :
> > ----------------
> >
> > if (node) { --- This is the entire xml
> > parent_node =3D axiom_node_get_first_element(node,
> env); --- Here, I though=
> > I will get operation as the first element, but I get
> <in1>1</in1> ...
> >   
> 
> You have to do "axiom_node_get_data_element" to
> get <operation> as the 
> element. When you do axiom_node_get_first_element, it will
> return first 
> child whose type is om element.
> 
> 
> > If this is wrong pls point out the exact function that
> I ought to be using.
> >
> > {
> > if (!parent_node)
> > { // throw error;
> > }
> > request_node =3D
> axiom_node_get_first_child(parent_node, env);
> > if (!request_node)
> > { // throw error;
> > }
> > if (request_node &&
> axiom_node_get_node_type(request_node, env) =3D=3D AXIO=
> > M_TEXT)
> > { // Get value of TEXT --- Here we get value
> "1"
> > }
> > }
> > sibling_node =3D
> axiom_node_get_next_sibling(parent_node, env); --- Here I =
> > get <in2>2</in2>, which is a sibling to
> <in1>1</in1>
> >
> > if (!sibling_node) { // throw error ; }
> > request_node =3D
> axiom_node_get_first_child(sibling_node, env);
> > if (!request_node)
> > { // throw error;
> > }
> > if (request_node &&
> axiom_node_get_node_type(request_node, env) =3D=3D AXIO=
> > M_TEXT)
> > { // Get value of TEXT --- Here we get value
> "2"
> > }=20
> > }
> >
> >
> > I am running into some issues
> >   
> 
>  First error is caused by axiom_node_free_detached_subtree,
> which I 
> could not find in the code you have sent. Can you send the
> correct code 
> which causes these errors?
> 
> Regards,
> Shankar
> 
> >
> > Below is some error which I get :
> > ---------------------------------
> >
> > Program received signal SIGSEGV, Segmentation fault.
> > [Switching to Thread -1208951888 (LWP 19071)]
> > axiom_node_free_detached_subtree (om_node=3D0x8927758,
> env=3D0x8920e60)
> > at om_node.c:105
> > 105 next_sibling =3D child_node->next_sibling;
> >
> > #0 axiom_node_free_detached_subtree
> (om_node=3D0x81d9758, env=3D0x81d2e60)
> > at om_node.c:105
> > #1 0x006005a2 in axiom_node_free_detached_subtree
> (om_node=3D0x81d96d0,=20
> > env=3D0x81d2e60) at om_node.c:106
> > #2 0x006005a2 in axiom_node_free_detached_subtree
> (om_node=3D0x81d9528,=20
> > env=3D0x81d2e60) at om_node.c:106
> > #3 0x006005a2 in axiom_node_free_detached_subtree
> (om_node=3D0x81d9478,=20
> > env=3D0x81d2e60) at om_node.c:106
> > #4 0x006005a2 in axiom_node_free_detached_subtree
> (om_node=3D0x81d9198,=20
> > env=3D0x81d2e60) at om_node.c:106
> > #5 0x0060026e in axiom_document_free
> (document=3D0x81d50b8, env=3D0x81d2e60=
> > )
> > at om_document.c:87
> > #6 0x00607b6e in axiom_stax_builder_free
> (om_builder=3D0x81d5010, env=3D0x8=
> > 1d2e60)
> > at om_stax_builder.c:897
> > #7 0x0060e7ad in axiom_soap_builder_free
> (soap_builder=3D0x81d50d8,=20
> > env=3D0x81d2e60) at soap_builder.c:188
> > #8 0x0060dd25 in axiom_soap_envelope_free
> (soap_envelope=3D0x81d9338,=20
> > env=3D0x81d2e60) at soap_envelope.c:178
> > #9 0x0806b2be in axis2_msg_ctx_free
> (msg_ctx=3D0x81d45f8, env=3D0x81d2e60)
> > at msg_ctx.c:410
> > #10 0x00c60b43 in axis2_http_worker_process_request
> (http_worker=3D0x81d0d3=
> > 8,=20
> > env=3D0x81d2e60, svr_conn=3D0x81d2e80,
> simple_request=3D0x81d2f48)
> > at http_worker.c:1952
> >
> > Program received signal SIGSEGV, Segmentation fault.
> > [Switching to Thread -1208378448 (LWP 18971)]
> > axiom_node_create (env=3D0x20202020) at om_node.c:75
> > 75 node =3D (axiom_node_t *)
> AXIS2_MALLOC(env->allocator, sizeof(axiom_node=
> > _t));
> >
> > #0 axiom_node_create (env=3D0x20202020) at
> om_node.c:75
> > #1 0x00f250fa in axiom_element_create
> (env=3D0x20202020, parent=3D0x0,=20
> > localname=3D0x4e9f8c "outparam0", ns=3D0x0,
> node=3D0xb7f98f30) at om_elemen=
> > t.c:78
> > #2 0x004e9a0f in build_res_text_response ()
> > from ..//services/ws_test_demo/libws_test_demo.so
> > #3 0x004e99ac in axis2_skel_ws_test_demo_test_demo ()
> > from ..//services/ws_test_demo/libws_test_demo.so
> > #4 0x20202020 in ?? ()
> > #5 0x20202020 in ?? ()
> > #6 0x20202020 in ?? ()
> > #7 0xb7f99000 in ?? ()
> > #8 0x004e9b62 in axis2_svc_skel_ws_test_demo_invoke ()
> > from ..//services/ws_test_demo/libws_test_demo.so
> >
> >
> > Pls let me know, if I am missing something ...
> >
> > Also, pls let me know if you need more info.
> > I need some help on an urgent basis.
> >
> > Rgds,
> > Ramesh
> >
> >
> >       Add more friends to your messenger and enjoy! Go
> to http://messenger.yahoo.com/invite/
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> axis-c-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail:
> axis-c-user-help@ws.apache.org
> >
> >
> >
> >   
> 
> 
> -- 
> S.Uthaiyashankar
> Software Architect
> WSO2 Inc. 
> http://wso2.com/ - "The Open Source SOA Company" 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail:
> axis-c-user-help@ws.apache.org


      Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/


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


Mime
View raw message