Hi,

we are using the dispatch API to invoke a remote WebService. This works fine
until the remoter service requires mutual authentication (aka 2Way SSL).
This is our spring configuration:

    
    <jaxws:client id="{http://example.com}ws-dispatch";
name="{http://example.com}ws-dispatch";
        createdFromAPI="true">
        <jaxws:outInterceptors>
             <ref bean="setPolicyOutInterceptor"/>
        </jaxws:outInterceptors>
        <jaxws:inInterceptors>
            <ref bean="setSignatureAlgorithmInInterceptor"/>
        </jaxws:inInterceptors>
        <jaxws:handlers>
            <bean class="com.example.FaultOutHandler"/>
        </jaxws:handlers>
        <jaxws:properties>
            <entry key="ws-security.signature.properties"
value-ref="keystoreProperties"/>
            <entry key="ws-security.callback-handler"
value-ref="keystorePasswordCallback"/>
            <entry key="ws-security.encryption.properties"
value-ref="truststoreProperties"/>
            <entry key="faultStackTraceEnabled" value="false"/>
            <entry key="exceptionMessageCauseEnabled" value="false"/>
        </jaxws:properties>
    </jaxws:client>

    <http-conf:conduit name="{http://example.com}ws-dispatch.http-conduit";>
        <http-conf:tlsClientParameters disableCNCheck="true"
secureSocketProtocol="TLS">
            <security:trustManagers>
                <security:keyStore type="JKS" password="****"
                    file="${config.location}/ssl_keys/truststore.jks"/>
            </security:trustManagers>
            <security:keyManagers keyPassword="****">
                <security:keyStore type="JKS" password="****"
                    file="${config.location}/ssl_keys/keystore.jks"/>
            </security:keyManagers>
        </http-conf:tlsClientParameters>
        <http-conf:client AutoRedirect="true" Connection="Keep-Alive"/>
    </http-conf:conduit>


THis is our Dispatch implementation:

    public SOAPMessage dispatch(final SOAPMessage soapMessage) {
        final QName serviceName = new QName("http://example.com";,
"ws-dispatch-service");
        final QName portName = new QName("http://example.com";,
"ws-dispatch");
        final javax.xml.ws.Service service =
javax.xml.ws.Service.create(serviceName);
        service.addPort(portName, SOAPBinding.SOAP12HTTP_BINDING,
getEndpoint());
        Dispatch<SOAPMessage> dispatch = service.createDispatch(portName,
SOAPMessage.class, javax.xml.ws.Service.Mode.MESSAGE);
        dispatch.getRequestContext().put(PolicyConstants.POLICY_OVERRIDE,
getPolicy());
        dispatch.getRequestContext().put(ASYMMETRIC_SIG_ALGO_PROPERTY,
getAlgorithm());
        SOAPMessage result = dispatch.invoke(soapMessage);
        return result;
    }

This does not work and we do not get any useable exceptions. Any help is
highly appreciated.

Greets
Stefan



--
View this message in context: 
http://cxf.547215.n5.nabble.com/Mutual-authentication-with-Dispatch-API-tp5760231.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to