You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Nayan Hajratwala <na...@chikli.com> on 2009/08/20 20:43:25 UTC

ws-secureconversation + reliablemessaging + spring

Does anyone have an example Spring configuration of talking to a  
service that uses WS-SecureConversation and Reliable Messaging?

I can (i think) get the RM part working, but none of the Security  
elements ever show up.

Here's what i have so far:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:cxf="http://cxf.apache.org/core"
   	   xmlns:wsa="http://cxf.apache.org/ws/addressing"
   	   xmlns:jaxws="http://cxf.apache.org/jaxws"
        xmlns:http="http://cxf.apache.org/transports/http/configuration"
        xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy 
"
        xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager"
   	xmlns:p="http://cxf.apache.org/policy"
          xsi:schemaLocation="
	http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd
         http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
         http://cxf.apache.org/jaxws                           http://cxf.apache.org/schemas/jaxws.xsd
         http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
         http://cxf.apache.org/ws/rm/manager http://cxf.apache.org/schemas/configuration/wsrm-manager.xsd
		http://www.w3.org/2006/07/ws-policy http://www.w3.org/2006/07/ws-policy.xsd
        http://schemas.xmlsoap.org/ws/2005/02/rm/policy http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
">


  	<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-extension-xml.xml"/>
    	<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-addr.xml"/>
	<import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml"/>
	<import resource="classpath:META-INF/cxf/cxf-extension-policy.xml"/>
	<import resource="classpath:META-INF/cxf/cxf-extension-rm.xml"/>
	<import resource="classpath:META-INF/cxf/cxf-extension-ws- 
security.xml"/>

     <cxf:bus>
         <cxf:features>
             <p:policies />
             <cxf:logging/>
             <wsa:addressing />
             <wsrm-mgr:reliableMessaging>
                 <wsrm-policy:RMAssertion>
                     <wsrm-policy:BaseRetransmissionInterval  
Milliseconds="4000"/>
                     <wsrm-policy:AcknowledgementInterval  
Milliseconds="2000"/>
                 </wsrm-policy:RMAssertion>
                 <wsrm-mgr:destinationPolicy>
                     <wsrm-mgr:acksPolicy intraMessageThreshold="0" />
                 </wsrm-mgr:destinationPolicy>
             </wsrm-mgr:reliableMessaging>
         </cxf:features>
     </cxf:bus>

	<bean id="bindingConfiguration"  
class="org.apache.cxf.binding.soap.SoapBindingConfiguration">
		<property name="version" value="1.2" />
	</bean>
	<!--  Product Info Service -->
	<bean id="xxxProductInfoWSFactory"  
class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
		<property name="serviceClass"  
value="com.xxx.www2.xxxprodinfoextsvc.IProdInfoSvc" />
		<property name="address" value="http://localhost:7000/XXXProdInfoExtSvc/XXXProdInfo.svc 
" />
		<property name="bindingConfig" ref="bindingConfiguration" />
		<property name="properties">
			<props>
				<prop key="ws-security.username.sct">MBCert</prop>
				<prop key="ws-security.password.sct">$AtaveSwaN3J</prop>
	        	</props>
		</property>
  	</bean>

	<bean id="xxxProductInfoWS"  
class="com.xxx.www2.xxxprodinfoextsvc.IProdInfoSvc"
		factory-bean="xxxProductInfoWSFactory" factory-method="create" />
</beans>

--------

My request comes out like this:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap- 
envelope"><soap:Header><Action xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing 
">http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence</ 
Action><MessageID xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing 
">urn:uuid:4d6b3341-5363-454d-9cf3-a7bbdd148942</MessageID><To xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing 
">http://localhost:7000/XXXProdInfoExtSvc/XXXProdInfo.svc</To><ReplyTo  
xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing"><Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous 
</Address></ReplyTo></soap:Header><soap:Body><CreateSequence xmlns="http://schemas.xmlsoap.org/ws/2005/02/rm 
" xmlns:ns2="http://schemas.xmlsoap.org/ws/2004/08/ 
addressing"><AcksTo><ns2:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous 
</ns2:Address></AcksTo><Expires>PT0S</Expires><Offer><Identifier>urn:uuid:be128ebd-0897-4acd-9734-e5a73e15f879 
</Identifier><Expires>PT0S</Expires></Offer></CreateSequence></ 
soap:Body></soap:Envelope>



---
Nayan Hajratwala
http://agileshrugged.com
http://twitter.com/nhajratw
734.658.6032