You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Dipti Vaidya <dv...@gmail.com> on 2011/03/30 19:58:56 UTC

Adding xsi namespace to Soap Envelope

Hi,
Can someone please tell me or point to examples where I can see how to add
XSI namespace to my SoapEnvelope.
I'm using CXF and wsdl2java to generate my classes and interfaces. When I
use SoapUi to generate the request, I don't see the "xsi" namespace in my
soapEnvelope.
I need to have it since I'm having some elements which use the
xsi:nil="true" attribute.

Is there a way to add this xsi namespace to my soapUi generated Soap
Envelope?

I saw CXF-1993 talks about the same issue. But couldn't figure out how to
solve the problem and where to put the interceptor.

Please let me know.
Thanks,
Dipti

--
View this message in context: http://cxf.547215.n5.nabble.com/Adding-xsi-namespace-to-Soap-Envelope-tp4271972p4271972.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Adding xsi namespace to Soap Envelope

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

I'm sorry I misunderstand your requirement.
Your original requirement is adding extra namespace  for the client  
request soap message generated by SOAPUI, right? As your client side  
is SOAPUI, it has nothing to do with cxf, so cxf interceptors can't  
take effect anyway.

The interceptor way we discussed here is only applicable if you use  
cxf client to send out soap message.

In SOAPUI, I think you can alway manually edit the request soap  
message based on the default one generated from wsdl, so that you get  
changes to add extra namespace, not sure how SOAPUI can add extra  
namespace automatically.

Freeman

On 2011-3-31, at 下午12:53, Dipti Vaidya wrote:

> Hi Freeman,
>
> I've been trying out what is described by Dan in the post you  
> mentioned, but
> it doesn't seem to work for me.
> I'm not sure if I'm doing something wrong.
>
> Here's what my custom interceptor looks like
>
> myCustomInterceptor extends AbstractSoapInterceptor
> {
>   super.phase(Phase.PRE_STREAM);
>   addBefore(SoapOutInterceptor.class.getName());
> }
>
> handleMessage(SoapMessage message)
> {
> Map&lt;String, String&gt; nsMap = new HashMap&lt;String, String&gt;();
> nsMap.put("ns2", "http://www.test.com");
> mesage.put("soap.env.ns.map", nsMap);
> }
>
> I've added myCustomInterceptor to the list of of OutInterceptors in my
> Spring service bean endpoint bean definition.
>
> When I run in debug mode, I see the constructor for  
> MyCustomInterceptor is
> being called..but the handleMessage method is never called.
>
> What am I missing here? When is the handleMessage called? Is the map  
> to be
> populated in the handleMessage method or is there someother method  
> in the
> code that the map should be populated?
>
> Please let me know.
> Thanks,
> Dipti
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Adding-xsi-namespace-to-Soap-Envelope-tp4271972p4272770.html
> Sent from the cxf-user mailing list archive at Nabble.com.

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
Connect at CamelOne May 24-26
The Open Source Integration Conference









Re: Adding xsi namespace to Soap Envelope

Posted by Dipti Vaidya <dv...@gmail.com>.
Hi Freeman,

I've been trying out what is described by Dan in the post you mentioned, but
it doesn't seem to work for me.
I'm not sure if I'm doing something wrong.

Here's what my custom interceptor looks like

myCustomInterceptor extends AbstractSoapInterceptor
{
   super.phase(Phase.PRE_STREAM);
   addBefore(SoapOutInterceptor.class.getName());
}

handleMessage(SoapMessage message)
{
 Map&lt;String, String&gt; nsMap = new HashMap&lt;String, String&gt;();
nsMap.put("ns2", "http://www.test.com");
mesage.put("soap.env.ns.map", nsMap);
}

I've added myCustomInterceptor to the list of of OutInterceptors in my
Spring service bean endpoint bean definition.

When I run in debug mode, I see the constructor for MyCustomInterceptor is
being called..but the handleMessage method is never called.

What am I missing here? When is the handleMessage called? Is the map to be
populated in the handleMessage method or is there someother method in the
code that the map should be populated?

Please let me know.
Thanks,
Dipti

--
View this message in context: http://cxf.547215.n5.nabble.com/Adding-xsi-namespace-to-Soap-Envelope-tp4271972p4272770.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Adding xsi namespace to Soap Envelope

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

We've discussed this issue before, please take a look at it[1]
[1]http://cxf.547215.n5.nabble.com/how-could-I-add-a-compulsory-xmlns-xsi-and-xmlns-xsd-to-the-soap-envelope-td548800.html#a548801

Freeman
On 2011-3-31, at 上午5:29, Dipti Vaidya wrote:

> I tried to add an OutInterceptor  to my service config bean file:
>
>
>
>
> MyCustomerOutInterceptor extends AbstractSoapInterceptor. with the  
> Phase 0f
> WRITE
>
> But I don't see  it firing up.
>
> What am I missing here?
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Adding-xsi-namespace-to-Soap-Envelope-tp4271972p4272372.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Freeman Fang

------------------------

FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org


Re: Adding xsi namespace to Soap Envelope

Posted by Dipti Vaidya <dv...@gmail.com>.
I tried to add an OutInterceptor  to my service config bean file:




MyCustomerOutInterceptor extends AbstractSoapInterceptor. with the Phase 0f
WRITE

But I don't see  it firing up.

What am I missing here?

--
View this message in context: http://cxf.547215.n5.nabble.com/Adding-xsi-namespace-to-Soap-Envelope-tp4271972p4272372.html
Sent from the cxf-user mailing list archive at Nabble.com.