After digging and playing there are at least two options (there may be
more) to configure WS-RM
1) adding interceptors to the CXF bus
2) adding policy to the endpoint 

I have not gotten very far with option 1, though I am not sure why. The
Greeter service from the samples ws-rm directory works, but no
addressing/reliable messaging calls are taking place. 

I have switched to using WS-Policy. (attached is the server side Spring
context file). 
I still get the addressing errors...

16:13:59,096 ERROR [STDERR] Jun 26, 2008 4:13:59 PM
org.apache.cxf.ws.addressing.ContextUtils retrieveMAPs
WARNING: WS-Addressing - failed to retrieve Message Addressing
Properties from context


I also get this error:
16:13:59,346 ERROR [STDERR] Jun 26, 2008 4:13:59 PM
org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: None of the policy alternatives can be
satisfied.
        at
org.apache.cxf.ws.policy.AbstractPolicyInterceptor.handleMessage(Abstrac
tPolicyInterceptor.java:58)

Similar to this JIRA issue: (though I did not add the policy to the
WSDL, I am using the one supplied in the samples directory of CXF)
http://issues.apache.org/jira/browse/CXF-1311

This is what the client looks like: the client Spring file is similar to
the one posted earliar (interceptors attached to the bus). 

            SpringBusFactory bf = new SpringBusFactory();
            Bus bus = bf.createBus("cxf_rm_client.xml");
            bf.setDefaultBus(bus);
            
                GreeterService service = new GreeterService();
                Greeter port = service.getGreeterPort();

                // Use Proxy Instance as BindingProvider
                BindingProvider bp = (BindingProvider) port;
                // enable MTOM
                SOAPBinding binding = (SOAPBinding)bp.getBinding();
                binding.setMTOMEnabled(false);
                // (Optional) Configure RequestContext with endpoint's
URL
                Map<String, Object> rc = bp.getRequestContext();
                rc.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
SERVICE_ADDRESS);
                rc.put(SOAPBinding.SOAP12HTTP_BINDING,true);

            String response = port.sayHi();

Thanks,

Mike Barlotta
Associate
Booz | Allen | Hamilton

-----Original Message-----
From: Barlotta, Michael [USA]
Sent: Wednesday, June 25, 2008 5:56 PM
To: '[email protected]'
Subject: WS-RM enabling in CXF


CXF Users:

I am trying to learn WS-RM and have looked at CXF 2.0.7 and the samples.

I have tried to take the existing sample (ws-rm) and port the
Server-side service into Jboss, calling it from a stand-alone WS Client.
Right now both client and server are CXF. 

The client can call the service, however the WS-Addressing and WS-RM do
not seem to be enabled. 
Here is the console logging:

17:47:12,140 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.interceptor.L oggingInInterceptor logging
INFO: Inbound Message
----------------------------
Encoding: UTF-8
Headers: {connection=[keep-alive], cache-control=[no-cache],
host=[localhost:808 0], user-agent=[Java/1.5.0_12],
transfer-encoding=[chunked], pragma=[no-cache], content-type=[text/xml;
charset=UTF-8], accept=[*], soapaction=[""]}
Messages:
Message:

Payload: <soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";><
soap:Body><sayHi
xmlns="http://cxf.apache.org/hello_world_soap_http/types"/></so
ap:Body></soap:Envelope>
--------------------------------------
17:47:12,156 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .ContextUtils retrieveMAPs
INFO: retrieving MAPs from context property
javax.xml.ws.addressing.context.inbo
und
17:47:12,156 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .ContextUtils retrieveMAPs
INFO: WS-Addressing - failed to retrieve Message Addressing Properties
from cont ext
17:47:12,156 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .soap.MAPCodec unmarshalMAPs
INFO: Inbound WS-Addressing headers
17:47:12,156 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .ContextUtils retrieveMAPs
INFO: retrieving MAPs from context property
javax.xml.ws.addressing.context.inbo
und
17:47:12,156 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .ContextUtils retrieveMAPs
WARNING: WS-Addressing - failed to retrieve Message Addressing
Properties from c ontext
17:47:12,156 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .ContextUtils retrieveMAPs
INFO: retrieving MAPs from context property
javax.xml.ws.addressing.context.inbo
und
17:47:12,156 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .ContextUtils retrieveMAPs
WARNING: WS-Addressing - failed to retrieve Message Addressing
Properties from c ontext
17:47:12,156 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .ContextUtils retrieveMAPs
INFO: retrieving MAPs from context property
javax.xml.ws.addressing.context.inbo
und
17:47:12,156 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .ContextUtils retrieveMAPs
WARNING: WS-Addressing - failed to retrieve Message Addressing
Properties from c ontext
17:47:12,156 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .MAPAggregator getMAPs
INFO: MAPs retrieved from message null
17:47:12,156 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
demo.ws_rm.server.GreeterImp l sayHi
INFO: Executing operation sayHi
17:47:12,156 INFO  [STDOUT] Executing operation sayHi
17:47:12,156 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .ContextUtils retrieveMAPs
INFO: retrieving MAPs from context property
javax.xml.ws.addressing.context.inbo
und
17:47:12,171 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .ContextUtils retrieveMAPs
WARNING: WS-Addressing - failed to retrieve Message Addressing
Properties from c ontext
17:47:12,171 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .MAPAggregator getMAPs
INFO: MAPs retrieved from message null
17:47:12,171 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .ContextUtils retrieveMAPs
INFO: retrieving MAPs from context property
javax.xml.ws.addressing.context.outb
ound
17:47:12,171 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .ContextUtils retrieveMAPs
WARNING: WS-Addressing - failed to retrieve Message Addressing
Properties from c ontext
17:47:12,171 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .ContextUtils retrieveMAPs
INFO: retrieving MAPs from context property
javax.xml.ws.addressing.context.outb
ound
17:47:12,171 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .ContextUtils retrieveMAPs
WARNING: WS-Addressing - failed to retrieve Message Addressing
Properties from c ontext
17:47:12,171 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.rm.RMOutIn terceptor handle
WARNING: Failed to retrieve message addressing properties from context -
not ens uring reliable delivery.
17:47:12,171 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .ContextUtils retrieveMAPs
INFO: retrieving MAPs from context property
javax.xml.ws.addressing.context.outb
ound
17:47:12,171 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.ws.addressing .ContextUtils retrieveMAPs
WARNING: WS-Addressing - failed to retrieve Message Addressing
Properties from c ontext
17:47:12,171 ERROR [STDERR] Jun 25, 2008 5:47:12 PM
org.apache.cxf.interceptor.L oggingOutInterceptor$LoggingCallback
onClose
INFO: Outbound Message
---------------------------
Encoding: UTF-8
Headers: {SOAPAction=[""]}
Messages:
Payload: <soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";><
soap:Body><sayHiResponse
xmlns="http://cxf.apache.org/hello_world_soap_http/type
s"><responseType>Bonjour</responseType></sayHiResponse></soap:Body></soa
p:Envelo
pe>
--------------------------------------


I have read through the online docs and the FUSE deployment guide.
Attached is my Spring configuration file. 
Can someone tell me what I am missing.

Thanks,

Mike Barlotta
Associate
Booz | Allen | Hamilton

<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:jaxws="http://cxf.apache.org/jaxws";
	xmlns:soap="http://cxf.apache.org/bindings/soap"; 
	xmlns:wsa="http://cxf.apache.org/ws/addressing";
	xmlns:http="http://cxf.apache.org/transports/http/configuration"; 
	xmlns:policy="http://cxf.apache.org/policy";
	xmlns:wsrm-mgr="http://cxf.apache.org/ws/rm/manager"; 
	xmlns:wsp="http://www.w3.org/2006/07/ws-policy";
	xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy";
	xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
	xsi:schemaLocation="
       http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
       http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd  
       http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
       http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.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/11/ws-policy.xsd
       http://schemas.xmlsoap.org/ws/2005/02/rm/policy http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd
       http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.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-servlet.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-addr.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-policy.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-rm.xml" />

	<wsp:Policy wsu:Id="WSRM">
		<wsam:Addressing xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata";>
			<wsp:Policy/>
		</wsam:Addressing>
		<wsrm-policy:RMAssertion wsp:Optional="false">
			<wsrm-policy:BaseRetransmissionInterval Milliseconds="4000" />
			<wsrm-policy:AcknowledgementInterval Milliseconds="2000" />
		</wsrm-policy:RMAssertion>			
	</wsp:Policy>
<!-- 
	<bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor" />
	<bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
	<bean id="mapAggregator" class="org.apache.cxf.ws.addressing.MAPAggregator" />
	<bean id="mapCodec" class="org.apache.cxf.ws.addressing.soap.MAPCodec" />
	<bean id="rmLogicalOut" class="org.apache.cxf.ws.rm.RMOutInterceptor">
		<property name="bus" ref="cxf" />
	</bean>
	<bean id="rmLogicalIn" class="org.apache.cxf.ws.rm.RMInInterceptor">
		<property name="bus" ref="cxf" />
	</bean>
	<bean id="rmCodec" class="org.apache.cxf.ws.rm.soap.RMSoapInterceptor" />
	<bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
		<property name="inInterceptors">
			<list>
				<ref bean="logInbound" />
				<ref bean="mapAggregator" />
				<ref bean="mapCodec" />
				<ref bean="rmLogicalIn" />
				<ref bean="rmCodec" />
			</list>
		</property>
		<property name="inFaultInterceptors">
			<list>
				<ref bean="logInbound" />
				<ref bean="mapAggregator" />
				<ref bean="mapCodec" />
				<ref bean="rmLogicalIn" />
				<ref bean="rmCodec" />
			</list>
		</property>
		<property name="outInterceptors">
			<list>
				<ref bean="mapAggregator" />
				<ref bean="mapCodec" />
				<ref bean="rmLogicalOut" />
				<ref bean="rmCodec" />
				<ref bean="logOutbound" />
			</list>
		</property>
		<property name="outFaultInterceptors">
			<list>
				<ref bean="mapAggregator" />
				<ref bean="mapCodec" />
				<ref bean="rmLogicalOut" />
				<ref bean="rmCodec" />
				<ref bean="logOutbound" />
			</list>
		</property>
	</bean>
	-->
	<!--  
	<cxf:bus>
		<cxf:features>
			<cxf:logging />
			<wsa:addressing />
			<wsrm-mgr:reliableMessaging>
				<wsrm-policy:RMAssertion wsp:Optional="false">
					<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>
-->
	<!-- 
		- 
		- WebService End-Points (CFX)
		-
	-->
	<jaxws:endpoint id="Greeter" implementor="#GreeterService" address="/greet"> 
		<jaxws:features>
			<cxf:logging/>
		    <policy:policies namespace="http://www.w3.org/2006/07/ws-policy";>
       			<wsp:PolicyReference URI="#WSRM"/>
   			</policy:policies>
		</jaxws:features>
		<jaxws:binding>
			<soap:soapBinding mtomEnabled="false" version="1.2" />
		</jaxws:binding>
	</jaxws:endpoint>

	<bean id="GreeterService" scope="singleton" class="demo.ws_rm.server.GreeterImpl" />

</beans>

Reply via email to