You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Marco Firrincieli <mf...@beintoo.com> on 2012/10/18 10:14:04 UTC

add namespaces to and tags

 For some reason I cant' seem to create <soap:Header> and <soap:Envelope>
tags the way I want them to be.

I need <soap:Header> to contain the reference to a particular namespace
so something like <soap:Header xmlns:mfi="http://this.particular.ns.com">

and soap:Envelope has to be
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
http://this.particular.com" xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/">

How is that possible?

I've tried with something like this:

List<Header> headers = new ArrayList<Header>();
QName qName = new QName(...)
Header dummyHeader = new Header(...);
headers.add(dummyHeader);
Map<String, Object> requestContext = ((javax.xml.ws.BindingProvider)
port).getRequestContext();
requestContext.put(Header.HEADER_LIST, headers);

But this adds ns to <soap:Header> sub-tags.

For the envelope part I'm not sure where to start.

Re: add namespaces to and tags

Posted by Willem jiang <wi...@gmail.com>.
Here is the thread[1] for it.

[1]http://cxf.547215.n5.nabble.com/add-namespace-to-soap-header-td5716003.html  

--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: willemjiang





On Thursday, October 18, 2012 at 4:26 PM, Freeman Fang wrote:

> Hi,
>  
> For the extra namespace in soap:Envelope, the property soap.env.ns.map could help, you can search this forum to get how to use soap.env.ns.map.
>  
> For the extra namespace in soap:Header, not sure if there's really a way to do so.
> -------------
> Freeman(Yue) Fang
>  
> Red Hat, Inc.  
> FuseSource is now part of Red Hat
> Web: http://fusesource.com | http://www.redhat.com/
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
> http://blog.sina.com.cn/u/1473905042
> weibo: http://weibo.com/u/1473905042
>  
> On 2012-10-18, at 下午4:14, Marco Firrincieli wrote:
>  
> > For some reason I cant' seem to create <soap:Header> and <soap:Envelope>
> > tags the way I want them to be.
> >  
> > I need <soap:Header> to contain the reference to a particular namespace
> > so something like <soap:Header xmlns:mfi="http://this.particular.ns.com">
> >  
> > and soap:Envelope has to be
> > <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
> > http://this.particular.com" xmlns:soap="
> > http://schemas.xmlsoap.org/soap/envelope/">
> >  
> > How is that possible?
> >  
> > I've tried with something like this:
> >  
> > List<Header> headers = new ArrayList<Header>();
> > QName qName = new QName(...)
> > Header dummyHeader = new Header(...);
> > headers.add(dummyHeader);
> > Map<String, Object> requestContext = ((javax.xml.ws.BindingProvider)
> > port).getRequestContext();
> > requestContext.put(Header.HEADER_LIST, headers);
> >  
> > But this adds ns to <soap:Header> sub-tags.
> >  
> > For the envelope part I'm not sure where to start.  



Re: add namespaces to and tags

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

For the extra namespace in soap:Envelope, the property soap.env.ns.map could help, you can search this forum to get how to use soap.env.ns.map.

For the extra namespace in soap:Header, not sure if there's really a way to do so.
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-10-18, at 下午4:14, Marco Firrincieli wrote:

> For some reason I cant' seem to create <soap:Header> and <soap:Envelope>
> tags the way I want them to be.
> 
> I need <soap:Header> to contain the reference to a particular namespace
> so something like <soap:Header xmlns:mfi="http://this.particular.ns.com">
> 
> and soap:Envelope has to be
> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
> http://this.particular.com" xmlns:soap="
> http://schemas.xmlsoap.org/soap/envelope/">
> 
> How is that possible?
> 
> I've tried with something like this:
> 
> List<Header> headers = new ArrayList<Header>();
> QName qName = new QName(...)
> Header dummyHeader = new Header(...);
> headers.add(dummyHeader);
> Map<String, Object> requestContext = ((javax.xml.ws.BindingProvider)
> port).getRequestContext();
> requestContext.put(Header.HEADER_LIST, headers);
> 
> But this adds ns to <soap:Header> sub-tags.
> 
> For the envelope part I'm not sure where to start.