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

Reply via email to