On Aug 19, 2013, at 8:25 AM, bhaskerhari <[email protected]> wrote:

> Thanks for the reply, I got this sorted out by adding package-info.java to
> the package, but i am facing a new problem now. I dont get namespace in the
> XMLRootElement. Though I am specifying the namespace to the XMLRootElement
> for which I want to see the namespace, it appears in the Response wrapper
> element instead of the XML element i added.

In the package-info.java, you could try adding:

@javax.xml.bind.annotation.XmlSchema(namespace = ".…...",
                                     elementFormDefault = 
javax.xml.bind.annotation.XmlNsForm.QUALIFIED)

To force the child elements to be qualified.   Alternatively, if using 
Java7/JAXB2.2, you can add @XmlElement(namespace="…..") attributes to the 
parameters on the service.


Dan


> 
> So the response I get is 
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
>   <soap:Body>
>      <ns2: getMessageResponse xmlns:ns2="http://test.ws.com/";>
>         <HelloMessage>Hello.</HelloMessage>
>      </ns2:getMessageResponse>
>   </soap:Body>
> </soap:Envelope>
> 
> But the response I need is 
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>
>   <soap:Body>
>      <ns1:getMessageResponse xmlns:ns1="http://test.ws.com/";>
>         <ns2:HelloMessage
> xmlns:ns2="http://test.ws.com/";>Hello.</HelloMessage>
>      </ns2:getMessageResponse>
>   </soap:Body>
> </soap:Envelope>
> 
> How can I get a namespace added to the XMLRootElement? I tried several
> options, but it keeps adding the namespace to the response wrapper
> (getMessageResponse in this case) instead of getMessageResponse.
> 
> 
> 
> 
> --
> View this message in context: 
> http://cxf.547215.n5.nabble.com/Namespace-prefix-ns1-is-missing-in-cxf-soap-response-tp5732560p5732654.html
> Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to