<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:jaxws="http://cxf.apache.org/jaxws"
 xmlns:util="http://www.springframework.org/schema/util"
 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
 xsi:schemaLocation="http://www.springframework.org/schema/beans 
 http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
 http://cxf.apache.org/jaxws 
 http://cxf.apache.org/schemas/jaxws.xsd 
 http://www.springframework.org/schema/util 
 http://www.springframework.org/schema/util/spring-util-2.5.xsd 
 http://schemas.xmlsoap.org/wsdl/soap/
 http://schemas.xmlsoap.org/wsdl/soap/">


    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

    <util:properties id="keystoreProperties">
	<prop key="org.apache.ws.security.crypto.provider">org.apache.ws.security.components.crypto.Merlin</prop>
        <prop key="org.apache.ws.security.crypto.merlin.file">/var/lib/tomcat5.5/webapps/np/WEB-INF/classes/mobik_test_keystore.jks</prop>
        <prop key="org.apache.ws.security.crypto.merlin.keystore.type">jks</prop>
        <prop key="org.apache.ws.security.crypto.merlin.keystore.password">password</prop>
    </util:properties>


    <bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean" scope="prototype">
	
	<property name="bindingId"> 
    	    <util:constant static-field="javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING"/> 
    	</property>
	<property name="inInterceptors"> 
            <bean class="org.apache.cxf.common.util.ModCountCopyOnWriteArrayList"> 
                <constructor-arg> 
                    <list> 
                        <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" /> 
                        <ref bean="wssInInterceptor" /> 
                    </list>
                </constructor-arg> 
            </bean>  
        </property> 
	<property name="outInterceptors"> 
            <bean class="org.apache.cxf.common.util.ModCountCopyOnWriteArrayList"> 
                <constructor-arg> 
                    <list> 
                        <bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" /> 
                        <ref bean="wssOutInterceptor" /> 
                    </list> 
                </constructor-arg> 
            </bean> 
        </property> 
    </bean>

    <bean id="wssOutInterceptor" class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor"> 
        <constructor-arg> 
    	    <map> 
		<entry key="keystoreProperties" value-ref="keystoreProperties" /> 
                <entry key="action" value="Timestamp Signature Encrypt" /> 
                <entry key="user" value="mobik_test" /> 
                <entry key="signatureKeyIdentifier" value="DirectReference" /> 
                <entry key="signatureParts" value="{}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;{}{http://www.w3.org/2003/05/soap-envelope}Body" /> 
                <entry key="SignaturePropRefId" value="keystoreProperties" /> 
                <!-- Operator private key's password is needed to use private key for signing. --> 
                <entry key="passwordCallbackRef"> 
            	    <!-- Each operator implements its own password callback handler --> 
            	    <bean class="mobik.np.WSPasswordCallbackHandler"> 
            		<constructor-arg index="0" value="mobik_test" /> 
                	<constructor-arg index="1" value="password" /> 
                	<constructor-arg index="2" value="3" /> 
            	    </bean> 
        	</entry> 
        	<entry key="encryptionUser" value="cdb_test" /> 
        	<entry key="encryptionKeyIdentifier" value="IssuerSerial" /> 
        	<entry key="encryptionPropRefId" value="keystoreProperties" />  
    	    </map> 
	</constructor-arg> 
    </bean> 

    <bean id="wssInInterceptor" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"> 
        <constructor-arg> 
            <map> 
        	<entry key="keystoreProperties" value-ref="keystoreProperties" /> 
                <entry key="action" value="Timestamp Signature Encrypt" /> 
                <entry key="SignaturePropRefId" value="keystoreProperties" /> 
                <entry key="decryptionPropRefId" value="keystoreProperties" /> 
                <!-- Operator private key's password is needed to use private key for decryption. --> 
                <entry key="passwordCallbackRef"> 
            	    <bean class="mobik.np.WSPasswordCallbackHandler"> 
                        <constructor-arg index="0" value="mobik_test" /> 
                        <constructor-arg index="1" value="password" /> 
                        <constructor-arg index="2" value="1" /> 
                    </bean> 
                </entry> 
            </map> 
        </constructor-arg> 
    </bean> 

    <jaxws:client id="{http://cdb.services.np.aek.seavus.com/}NetworkOperatorWS_ImplPort" createdFromAPI="true">
	<jaxws:inInterceptors>
            <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" />
            <ref local="wssInInterceptor" />
        </jaxws:inInterceptors>
        <jaxws:outInterceptors>
    	    <bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor" />
            <ref local="wssOutInterceptor" />
        </jaxws:outInterceptors>
    </jaxws:client>
</beans>