You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Philipp Michel <mi...@apiomat.com> on 2014/02/07 09:18:05 UTC

Removing default "soap" namespace prefix from SOAP request

Hello,

i try to remove the  the default namespace prefix ("soap") from the
outgoing SOAP message. But I
don't know where to add the property "soap.env.ns.map". I've created a
sample SOAP Client with the
wsdl2java tool from Apache CXF and the client flag. My outgoing SOAP
message have to look like that:

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

But at the moment it looks like that:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
    ....
   </soap:Header>
   <soap:Body>
   </soap:Body>
</soap:Envelope>

I know that this isn't the wrong format but the server accepts only message
without any prefix for the
"http://schemas.xmlsoap.org/soap/envelope/" namespace.

Regards

Philipp

RE: Removing default "soap" namespace prefix from SOAP request

Posted by Andrei Shakirin <as...@talend.com>.
Hi,

Hmm, actually soap.env.ns.map should be global for all interceptors.
Could you please check is this effect is specific for security headers only or for all soap headers (for example, activate WS-Addressing)?

Small test case will be also helpful for analyses.

Regards,
Andrei.

> -----Original Message-----
> From: Philipp Michel [mailto:michel@apiomat.com]
> Sent: Freitag, 7. Februar 2014 16:25
> To: users@cxf.apache.org
> Subject: Re: Removing default "soap" namespace prefix from SOAP request
> 
> Thanks for your answer. At the meanwhile I've found a partial solution. I set a
> prefix map to the request context like so:
> 
> Map<String, String> prefixMap = new HashMap<String, String>( );
> 
>  prefixMap.put( "", "http://schemas.xmlsoap.org/soap/envelope/" );
> 
>  requestContext = ( ( BindingProvider ) port ).getRequestContext( );
> 
>  requestContext.put( "soap.env.ns.map", prefixMap );
> 
> 
> Now another problem occurred. The Authentication header has a new
> namespace "soapenv" now. I've configured the header with the
> "WSS4JOutInterceptor" to set my credentials. Why is this happen? Is the prefix
> map not global for all intereceptors?
> 
> 
> Regards
> 
> 
> Philipp
> 
> 
> 2014-02-07 Aki Yoshida <el...@gmail.com>:
> 
> > you need to set property "soap.env.ns.map cxf".
> > see example
> >
> > http://mail-archives.apache.org/mod_mbox/cxf-
> users/201302.mbox/%3CD225
> > CD69196F3F4A9F4174B2FCA06F88117402EA@S10BE002.SH10.lan%3E
> >
> >
> > 2014-02-07 9:18 GMT+01:00 Philipp Michel <mi...@apiomat.com>:
> > > Hello,
> > >
> > > i try to remove the  the default namespace prefix ("soap") from the
> > > outgoing SOAP message. But I don't know where to add the property
> > > "soap.env.ns.map". I've created a sample SOAP Client with the
> > > wsdl2java tool from Apache CXF and the client flag. My outgoing SOAP
> > > message have to look like that:
> > >
> > > <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
> > >     <Header>
> > >     ....
> > >    </Header>
> > >    <Body>
> > >    </Body>
> > > </Envelope>
> > >
> > > But at the moment it looks like that:
> > > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> > >     <soap:Header>
> > >     ....
> > >    </soap:Header>
> > >    <soap:Body>
> > >    </soap:Body>
> > > </soap:Envelope>
> > >
> > > I know that this isn't the wrong format but the server accepts only
> > message
> > > without any prefix for the
> > > "http://schemas.xmlsoap.org/soap/envelope/" namespace.
> > >
> > > Regards
> > >
> > > Philipp
> >
> 
> 
> 
> --
> Philipp Michel
> Chief-Developer
> Hainstraße 10a
> 04109 Leipzig
> Germany
> 
> P: +49151 28048171
> E: michel@apiomat.com
> W: www.apiomat.com
> T: @APIOMAT
> 
> Registergericht: Amtsgericht Leipzig
> Registernummer: HRB 29027
> Geschäftsführer: Marcel Etzel

Re: Removing default "soap" namespace prefix from SOAP request

Posted by Philipp Michel <mi...@apiomat.com>.
Thanks for your answer. At the meanwhile I've found a partial solution. I
set a prefix map to the request context like so:

Map<String, String> prefixMap = new HashMap<String, String>( );

 prefixMap.put( "", "http://schemas.xmlsoap.org/soap/envelope/" );

 requestContext = ( ( BindingProvider ) port ).getRequestContext( );

 requestContext.put( "soap.env.ns.map", prefixMap );


Now another problem occurred. The Authentication header has a new namespace
"soapenv" now. I've configured the header with the "WSS4JOutInterceptor" to
set my credentials. Why is this happen? Is the prefix map not global for
all intereceptors?


Regards


Philipp


2014-02-07 Aki Yoshida <el...@gmail.com>:

> you need to set property "soap.env.ns.map cxf".
> see example
>
> http://mail-archives.apache.org/mod_mbox/cxf-users/201302.mbox/%3CD225CD69196F3F4A9F4174B2FCA06F88117402EA@S10BE002.SH10.lan%3E
>
>
> 2014-02-07 9:18 GMT+01:00 Philipp Michel <mi...@apiomat.com>:
> > Hello,
> >
> > i try to remove the  the default namespace prefix ("soap") from the
> > outgoing SOAP message. But I
> > don't know where to add the property "soap.env.ns.map". I've created a
> > sample SOAP Client with the
> > wsdl2java tool from Apache CXF and the client flag. My outgoing SOAP
> > message have to look like that:
> >
> > <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
> >     <Header>
> >     ....
> >    </Header>
> >    <Body>
> >    </Body>
> > </Envelope>
> >
> > But at the moment it looks like that:
> > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> >     <soap:Header>
> >     ....
> >    </soap:Header>
> >    <soap:Body>
> >    </soap:Body>
> > </soap:Envelope>
> >
> > I know that this isn't the wrong format but the server accepts only
> message
> > without any prefix for the
> > "http://schemas.xmlsoap.org/soap/envelope/" namespace.
> >
> > Regards
> >
> > Philipp
>



-- 
Philipp Michel
Chief-Developer
Hainstraße 10a
04109 Leipzig
Germany

P: +49151 28048171
E: michel@apiomat.com
W: www.apiomat.com
T: @APIOMAT

Registergericht: Amtsgericht Leipzig
Registernummer: HRB 29027
Geschäftsführer: Marcel Etzel

Re: Removing default "soap" namespace prefix from SOAP request

Posted by Aki Yoshida <el...@gmail.com>.
you need to set property "soap.env.ns.map cxf".
see example
http://mail-archives.apache.org/mod_mbox/cxf-users/201302.mbox/%3CD225CD69196F3F4A9F4174B2FCA06F88117402EA@S10BE002.SH10.lan%3E


2014-02-07 9:18 GMT+01:00 Philipp Michel <mi...@apiomat.com>:
> Hello,
>
> i try to remove the  the default namespace prefix ("soap") from the
> outgoing SOAP message. But I
> don't know where to add the property "soap.env.ns.map". I've created a
> sample SOAP Client with the
> wsdl2java tool from Apache CXF and the client flag. My outgoing SOAP
> message have to look like that:
>
> <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
>     <Header>
>     ....
>    </Header>
>    <Body>
>    </Body>
> </Envelope>
>
> But at the moment it looks like that:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>     <soap:Header>
>     ....
>    </soap:Header>
>    <soap:Body>
>    </soap:Body>
> </soap:Envelope>
>
> I know that this isn't the wrong format but the server accepts only message
> without any prefix for the
> "http://schemas.xmlsoap.org/soap/envelope/" namespace.
>
> Regards
>
> Philipp