You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by swxies <in...@gmail.com> on 2011/10/11 04:58:40 UTC

Re: How to set soapAction header in Dispatch API?

Hi Dan,

I am using CXF 2.2.6. I would like to use Dispatch and ws-security to sign
the message. I tried to use the the approach illustrated in
SecurityPlicyTest 

            public void DispatchClient(String req) throws Exception {
                PayService service = new PayService();
                Dispatch<Source> disp = service.createDispatch(
                        PayService.PayPortTypePort,
                        Source.class, Mode.PAYLOAD);

                disp.getRequestContext().put(
                        SecurityConstants.CALLBACK_HANDLER,
                        new KeystorePasswordCallback());
                disp.getRequestContext().put(
                        SecurityConstants.SIGNATURE_PROPERTIES,
                        getClass().getResource("client.properties"));

                Source source = new StreamSource(new StringReader(req));
                source = disp.invoke(source);
       }

I have turned SSL debugging and can see the soap message is not signed.

Compare to the SecurityPlicyTest sample, the WSDL does not contain any
security policies. I also do not have client.xml with the wss4j interceptor
at all.

I also tried 		
dispSOAPMsg.getRequestContext().put(MessageContext.WSDL_OPERATION, 
					op);


But it did not work.

Can you please help? 

Thanks
SW.

--
View this message in context: http://cxf.547215.n5.nabble.com/How-to-set-soapAction-header-in-Dispatch-API-tp547977p4890531.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: How to set soapAction header in Dispatch API?

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday, October 18, 2011 3:52:34 PM swxies wrote:
> Thanks Dan. The newer version worked for me.
> 
> I have another question. I want to use a single instance of
> dispatcher<SoapMessage> object per end point in a multi-threaded
> application, is cxf dispatcher implementation thread-safe?

Yes, subject to the same restrictions listed at:

http://cxf.apache.org/faq.html#FAQ-AreJAXWSclientproxiesthreadsafe%3F


Dan



> 
> Thanks.
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/How-to-set-soapAction-header-in-Dispatch-AP
> I-tp547977p4915764.html Sent from the cxf-user mailing list archive at
> Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Re: How to set soapAction header in Dispatch API?

Posted by swxies <in...@gmail.com>.
Thanks Dan. The newer version worked for me.

I have another question. I want to use a single instance of
dispatcher<SoapMessage> object per end point in a multi-threaded
application, is cxf dispatcher implementation thread-safe?

Thanks.

--
View this message in context: http://cxf.547215.n5.nabble.com/How-to-set-soapAction-header-in-Dispatch-API-tp547977p4915764.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: How to set soapAction header in Dispatch API?

Posted by Daniel Kulp <dk...@apache.org>.
On Monday, October 10, 2011 7:58:40 PM swxies wrote:
> Hi Dan,
> 
> I am using CXF 2.2.6. I would like to use Dispatch and ws-security to sign
> the message. 

I'm nearly 99% confident that this won't work with 2.2.x.   You'll need to 
upgrade to at least 2.3.1, preferably the latest 2.4.x version, for this to 
work.

Dan



> I tried to use the the approach illustrated in
> SecurityPlicyTest
> 
>             public void DispatchClient(String req) throws Exception {
>                 PayService service = new PayService();
>                 Dispatch<Source> disp = service.createDispatch(
>                         PayService.PayPortTypePort,
>                         Source.class, Mode.PAYLOAD);
> 
>                 disp.getRequestContext().put(
>                         SecurityConstants.CALLBACK_HANDLER,
>                         new KeystorePasswordCallback());
>                 disp.getRequestContext().put(
>                         SecurityConstants.SIGNATURE_PROPERTIES,
>                         getClass().getResource("client.properties"));
> 
>                 Source source = new StreamSource(new StringReader(req));
>                 source = disp.invoke(source);
>        }
> 
> I have turned SSL debugging and can see the soap message is not signed.
> 
> Compare to the SecurityPlicyTest sample, the WSDL does not contain any
> security policies. I also do not have client.xml with the wss4j interceptor
> at all.
> 
> I also tried
> dispSOAPMsg.getRequestContext().put(MessageContext.WSDL_OPERATION,
> 					op);
> 
> 
> But it did not work.
> 
> Can you please help?
> 
> Thanks
> SW.
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/How-to-set-soapAction-header-in-Dispatch-AP
> I-tp547977p4890531.html Sent from the cxf-user mailing list archive at
> Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com