cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matteo <matteo.ru...@abodata.com>
Subject CXF Interceptors problem in OSGi
Date Tue, 07 Sep 2010 10:29:17 GMT

Dear all,
Let me briefly introduce my environment:
	OSGi exec environment - equinox implementation, version
org.eclipse.osgi_3.5.2.R35x_v20100126
	Apache CXF  		  - version 2.2.10

I'm trying to enable CXF interceptors to address security issues in my web
services but I cannot get these in/out interceptors be called. Here are some
details of the problem:

I have a bundle called CXFBundle where I stashed all the modules and
libraries that come with the CXF 2.2.10 binary distribution and a bundle
called BundleCXFServer where I publish my endpoint with

	IPersistence pers = PersistenceFactory.getPersist(); // returns the
IPersistence implementation
	String addr = "http://myServerIP:8160/Persistence";
	javax.xml.ws.Endpoint ep = org.apache.cxf.jaxws.EndpointImpl.publish(addr,
pers);

The IPersistence interface is declared inside a osgi service called
DataTypeService and the IPersistence implementation (the
dbproxyservice.PersistenceHandler class) is defined within a bundle called
DBProxyService:

@WebService(targetNamespace = "http://dbproxyservice/")
public interface IPersistence {
	/**
	 * Clean the database.
	 * @param list
	 */
	public void CleanDb();
}

@WebService(serviceName=PersistenceService,
			endpointInterface= "datatype.IPersistence",
			portName=PersistencePort)
@InInterceptors (interceptors =
{"dbproxyservice.ws.security.interceptors.WSSecurityInterceptor"})
public class PersistenceHandler implements IPersistence {
	public void CleanDb(){
		// do actions...
	}
}

and in the bundle DBProxyService I also put the WSSecurityInterceptor class:

public class WSSecurityInterceptor extends AbstractSoapInterceptor{
	public WSSecurityInterceptor() {     
		super(Phase.PRE_PROTOCOL);
	}

	public WSSecurityInterceptor(String s) {
		super(Phase.PRE_PROTOCOL);
	}

	public void handleMessage(SoapMessage message) throws Fault {
		Map props = new HashMap();
		props.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
		props.put(WSHandlerConstants.PW_CALLBACK_REF, new PasswordHandler());
		WSS4JInInterceptor wss4jInHandler = new WSS4JInInterceptor(props);
		ValidateUserTokenInterceptor userTokenInterceptor = new
ValidateUserTokenInterceptor(Phase.POST_PROTOCOL);
		message.getInterceptorChain().add(wss4jInHandler);
		message.getInterceptorChain().add(new SAAJInInterceptor());
		message.getInterceptorChain().add(userTokenInterceptor);
	}	
}

If I put a breakpoint in the first line of my handleMessage method it never
gets hit. And the interesting fact is that the CleanDb() service works
perfectly when the client invokes it even if I don't specify any client-side
interceptor and no exception is thrown (both client-side and server-side).
I cannot understand if this is a CXF-OSGi interoperability problem or just a
silly error of mine in the procedure that I reported above.

Thank you very much,
matteo

-- 
View this message in context: http://cxf.547215.n5.nabble.com/CXF-Interceptors-problem-in-OSGi-tp2805910p2805910.html
Sent from the cxf-user mailing list archive at Nabble.com.

Mime
View raw message