axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dinesh Premalal <xydin...@gmail.com>
Subject Re: [Axis2/C] How to convert a string to an axiom node ?
Date Mon, 25 Jun 2007 03:35:31 GMT
Hi Simon,
Simon Elbaz <simon.elbaz@free.fr> writes:

> Hi all,
> I would like to know how to transform a string containing an XML
> message into an axiom node in order to send it with SOAP.
I think this could be done using axiom_reader_create_for_memory

<snippet>
    buffer = "<ns1:EchoRequest xmlns:ns1 = 'http://example.com/ws/2004/09/policy' xmlns:wsu
= 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd' wsu:Id
= 'SigID-b3a30a12-1ef4-1dc1'><text>Hello</text></ns1:EchoRequest>" ;

    reader = axiom_xml_reader_create_for_memory(environment,
                 (void*)buffer, axutil_strlen(buffer), "utf-8", AXIS2_XML_PARSER_TYPE_BUFFER);
    if (!reader)
    {
        printf("ERROR CREATING PULLPARSER");
        return -1;
    }

    /** create axiom_stax_builder by parsing pull_parser struct */
    builder = axiom_stax_builder_create(environment, reader);
    if (!builder)
    {
        printf("ERROR CREATING PULL PARSER");
        return -1;
    }

    /**
        create an om document
        document is the container of om model created using builder 
    */
    document = axiom_stax_builder_get_document(builder, environment);

    /**
        get root element , building starts hear 
     */
    if (!document)
        return -1;
    node1 = axiom_document_get_root_element(document, environment);
</snippet>

You could see rest of the code at axiom/test/om/test_om.c

thanks,
Dinesh

-- 
Dinesh Premalal
http://feeds.feedburner.com/Dinesh
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


Mime
View raw message