Hello every one.
If any one else is facing a similar issue , here's how to go about it.
File : soap_envelope.c
Function : axiom_soap_envelope_create
axiom_namespace_t *ns2 = NULL,*ns3 = NULL;
ns2 =axiom_namespace_create(env, "
http://www.w3.org/1999/XMLSchema-instance", "xsi");
ns3 =axiom_namespace_create(env, "http://www.w3.org/2001/XMLSchema
","xsd");
ele = axiom_element_create(env, NULL, AXIOM_SOAP_ENVELOPE_LOCAL_NAME,
ns, &(soap_envelope->om_ele_node));
axiom_element_declare_namespace(ele,env,soap_envelope->om_ele_node,ns2);
axiom_element_declare_namespace(ele,env,soap_envelope->om_ele_node,ns3);
End Result : <soap:Envelope xmlns:soap="
http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="
http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
Cheers!
On Tue, Jul 20, 2010 at 5:04 PM, Rico M <[email protected]> wrote:
> Hi,
> Thanks...
>
> If i understand correctly , the envelope is built by the engine and not by
> the user. Hence i do not understand how one can get access to a node higher
> in hierarchy.
> I did look at the soap_envelope.c where the envelope is being built.
>
>
> Cheers!
>
>
> On Tue, Jul 20, 2010 at 9:47 AM, Nandika Jayawardana
> <[email protected]>wrote:
>
>> There are several functions available in both axiom_element.h and
>> axiom_util.h for searching elements. However there methods will search only
>> the next child level of elements and would not search the entire xml.
>>
>> Regards
>> Nandika
>>
>>
>> On Tue, Jul 20, 2010 at 2:00 PM, Rico M <[email protected]> wrote:
>>
>>> Thanks Nandika.
>>>
>>> I have gone through the OM tutorial :
>>> http://ws.apache.org/axis2/c/docs/om_tutorial.html
>>>
>>> Is there an api available which we can use to search for a particular
>>> element ?? Or the only way possible is to traverse it ? ( which i'll be
>>> taking a crack at now)
>>>
>>> Cheers!
>>>
>>>
>>> On Mon, Jul 19, 2010 at 4:46 PM, Nandika Jayawardana <[email protected]
>>> > wrote:
>>>
>>>> In your code you are adding the namespaces to the greet element and its
>>>> serialized in that way. If you want the namespace to be in the soap
>>>> envelope, you need to get the axiom element of soap envelope and declare
>>>> the
>>>> namespace there.
>>>>
>>>> Regards
>>>> Nandika
>>>>
>>>>
>>>> On Mon, Jul 19, 2010 at 8:05 PM, Rico M <[email protected]> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I am trying to modify the SOAP envelope generated by Axis. What i need
>>>>> to do is add some name spaces to it.
>>>>>
>>>>> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="
>>>>> http://schemas.xmlsoap.org/soap/envelope/">
>>>>>
>>>>>
>>>>> I tried to add the name spaces to it via the following call :
>>>>>
>>>>> axiom_node_t* greet_om_node = NULL;
>>>>> axiom_element_t * greet_om_ele = NULL;
>>>>> axiom_namespace_t *ns0=NULL,*ns2 = NULL,*ns3 = NULL;
>>>>>
>>>>> ns0 =axiom_namespace_create(env,
>>>>> AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI,"soap");
>>>>> ns2 =axiom_namespace_create(env, "
>>>>> http://www.w3.org/1999/XMLSchema-instance", "xsi");
>>>>> ns3 =axiom_namespace_create(env, "http://www.w3.org/2001/XMLSchema",
>>>>> "xsd");
>>>>>
>>>>> greet_om_ele = axiom_element_create(env, NULL, "greet", ns0,
>>>>> &greet_om_node);
>>>>> axiom_element_declare_namespace(greet_om_ele, env, greet_om_node,
>>>>> ns2);
>>>>> axiom_element_declare_namespace(greet_om_ele, env, greet_om_node,
>>>>> ns3);
>>>>> axiom_element_set_text(greet_om_ele, env, "Hello Server!",
>>>>> greet_om_node);
>>>>>
>>>>>
>>>>> This however adds it to the element. i.e. :
>>>>>
>>>>> <soap:Envelope
>>>>> xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Body><soap:greet
>>>>> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="
>>>>> http://www.w3.org/2001/XMLSchema">Hello
>>>>> Server!</soap:greet></soap:Body></soap:Envelope>
>>>>>
>>>>> Can you please suggest what is wrong above?
>>>>>
>>>>> Cheers!
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> http://nandikajayawardana.blogspot.com/
>>>> WSO2 Inc: http://www.wso2.com
>>>>
>>>
>>>
>>
>>
>> --
>> http://nandikajayawardana.blogspot.com/
>> WSO2 Inc: http://www.wso2.com
>>
>
>