You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Lee Breisacher <LB...@seagullsoftware.com> on 2008/09/18 05:41:00 UTC

Extraneous namespace attributes

I'm implementing a web service using @WebServiceProvider and Provider<SOAPMessage>.

I'm getting XML output that looks like this:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
        <SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"/>
        <SOAP-ENV:Body xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
                ....
        </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The xmlns:SOAP-ENV attributes on the Header and Body elements are redundant. They are not incorrect, just makes things cluttered.

Is there a way to "normalize" the outgoing XML so that the inner xmlns attributes are omitted?

Thanks,

Lee

Re: Extraneous namespace attributes

Posted by Daniel Kulp <dk...@apache.org>.
I think with Provider<SOAPMessage> things, we just let the SOAPMessage write 
itself out.   Thus, whatever it does is what gets written.    

Do something like:

ByteArrayOutputStream bout = new ByteArrayOutputStream();
soapMessage.writeTo(bout);
System.out.println(bout.toString());
and see what it prints.

Dan


On Wednesday 17 September 2008 11:41:00 pm Lee Breisacher wrote:
> I'm implementing a web service using @WebServiceProvider and
> Provider<SOAPMessage>.
>
> I'm getting XML output that looks like this:
>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
> <SOAP-ENV:Header
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"/> <SOAP-ENV:Body
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> ....
>         </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> The xmlns:SOAP-ENV attributes on the Header and Body elements are
> redundant. They are not incorrect, just makes things cluttered.
>
> Is there a way to "normalize" the outgoing XML so that the inner xmlns
> attributes are omitted?
>
> Thanks,
>
> Lee



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog