Re: How to configure WSS4J for Dispatch Client reference?

Mon, 22 Dec 2008 07:02:01 -0800

in general to WSS is implemented by
org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor (or *In*)
see http://cwiki.apache.org/CXF20DOC/ws-security.html,

I don't know how to add interceptor per endpoint using Dispatch (if you know
let me know :))
but setting them per bus may be enough in some cases, so you can have
cxf.xml file like this (just add interceptors you want):

<beans xmlns="http://www.springframework.org/schema/beans";
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
      xmlns:cxf="http://cxf.apache.org/core";
      xsi:schemaLocation="
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>

    <bean id="logInbound"
class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
    <bean id="logOutbound"
class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>

    <cxf:bus>
        <cxf:inInterceptors>
            <ref bean="logInbound"/>
        </cxf:inInterceptors>
        <cxf:outInterceptors>

            <ref bean="logOutbound"/>
        </cxf:outInterceptors>
        <cxf:inFaultInterceptors>
            <ref bean="logOutbound"/>
        </cxf:inFaultInterceptors>
    </cxf:bus>
</beans>

However WSS doesn't work for me with Dispatch. 
Here's the problem and possible workaround (but it won't work in my case)
http://www.nabble.com/NPE-when-using-WSS4JOutInterceptor-tt19654161.html


YagNesh wrote:
> 
> Hi all,
> 
> How to configure WSS4J for Dispatch Client reference? 
> 
> I have a client which get a dispatch reference as follows:
> 
> 
> QName serviceName = new QName(ClientConstants.SERVICE_NAMESPACE,              
> ClientConstants.SERVICE_NAME);
> 
> Service s = Service.create(new
> URL(ClientApplication.URL_POINTER),serviceName);
> 
> JAXBContext jaxbContext = JAXBContext.newInstance(
>       ClientConstants.SCHEMA_CONTEXT_PATH);
>                           
> QName portName = new QName(ClientConstants.SERVICE_NAMESPACE, 
>       ClientConstants.SERVICE_NAME_PORT);
>                           
> Dispatch dispatch = s.createDispatch(portName,
>       jaxbContext,
>       Service.Mode.PAYLOAD);
> 
> Now my server requireds WSS4J headers. How can i programetically configure
> dispatch client reference to send messages with WSS4J headers?
> 
> Please help
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-configure-WSS4J-for-Dispatch%3CObject%3E-Client-reference--tp20506950p21129220.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to