tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Fryer <>
Subject WebServiceRef injection of CXF configured jax-ws client
Date Mon, 26 Aug 2013 13:22:24 GMT
I was wondering if it is possible to inject a cxf jax-ws client using the
@WebServiceRef annotation?  My scenario is that there is a web service that
is running in an external system that i want to call from a stateless ejb.  

I have run wsimport over the WSDL to generate the service
(@WebServiceClient) and port (@WebService) classes and packaged them up into
a jar file.

In my stateless ejb, i am using @WebServiceRef to inject a reference to the
generated service class.  This works ok if i want a standard reference
injected, but if i want to start configuring some things, like the endpoint
address or ws-security, i'm coding these things, which i don't want to do. 
I think there must be a way to configure cxf to do what i'm doing
programatically and have the @WebServiceRef inject a configured service

My ejb looks like this...

public class CreateLoyaltyAccountServiceImpl implements
CreateLoyaltyAccountService {
	MemberProfileMediatorService memberProfileService;
	MemberProfileMediatorPpt memberProfilePort;
	private void postConstruct() {
		memberProfilePort =
		Map<String, Object> ctx =
		ctx.put("ws-security.username", "fffff");
		ctx.put("ws-security.password", "*****");

You can see above i'm using postConstruct to do configure the ws-security of
the webservice interface.  Is it possible to have a cxf config file to do
this?  Something similar to below (with more properties than what i have
below to configure security and other things)...

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
    <jaxws:client id="memberProfileService"

One other minor thing that i have noticed while unit testing in openejb, i
have to specify the openejb.embedded.remotable = true property for
@WebServiceRef to work, even though i'm not actually hosting any service
implementations, only the client references.  Why is it necessary to enable
remotable in this case?  I think it is initializing cxf perhaps?

View this message in context:
Sent from the OpenEJB User mailing list archive at

View raw message