Implementing Simple Web Services Registry Using CXF
UDDI is an enterprise-grade solution for Web Services Directory. Most of
Java EE application servers are shipped with UDDI applications. I wrote
about UDDI and JAXR previously: Preparing for SCDJWS Part 8: UDDI, Fixing jUDDI 0.9rc4 and Scout 1.2 bugs, and Preparing for SCDJWS Part 15: JAXR and Web Services Registries.
Today I will show you a more flyweight approach to Web Services Registry. I will use Apache CXF for it.
Bean configuration
Let's start with beans.xml configuration:
The implementation
Assume our registry service expects namespace and portType arguments, and returns a list of W3CEndpointReference (WS-Addressing) endpoints:
I think no comments are required, but if you have any questions give me a shout.
cheers,
Łukasz
Published at DZone with permission of Łukasz Budnik, author and DZone MVB. (source)Today I will show you a more flyweight approach to Web Services Registry. I will use Apache CXF for it.
Bean configuration
Let's start with beans.xml configuration:
<bean id="RegistryServiceBean" class="pl.gda.pg.eti.nuntius.testcases.orders_local_business_process_services.registry.RegistryServiceImpl " /> <jaxws:endpoint id="RegistryService" implementor="#RegistryServiceBean" address="/Registry" />:) Simple isn't it?
The implementation
Assume our registry service expects namespace and portType arguments, and returns a list of W3CEndpointReference (WS-Addressing) endpoints:
@WebService(name = "Registry", serviceName = "RegistryService")
public class RegistryServiceImpl implements ApplicationContextAware {
private ServletTransportFactory servletTransportFactory;
public List<W3CEndpointReference> findWebServices(
@WebParam(name = "namespace") String namespace,
@WebParam(name = "portType") String portType) {
QName portTypeQName = new QName(namespace, portType);
List<W3CEndpointReference> endpointReferences = new ArrayList<W3CEndpointReference>();
for (ServletDestination servletDestination : servletTransportFactory
.getDestinations()) {
EndpointInfo endpointInfo = servletDestination.getEndpointInfo();
if (portTypeQName.equals(endpointInfo.getInterface().getName())) {
String address = endpointInfo.getAddress();
W3CEndpointReference endpointReference = new W3CEndpointReferenceBuilder()
.address(address).build();
endpointReferences.add(endpointReference);
}
}
return endpointReferences;
}
@Override
@WebMethod(exclude = true)
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException {
servletTransportFactory = (ServletTransportFactory) applicationContext
.getBean(ServletTransportFactory.class.getCanonicalName());
}
}SummaryI think no comments are required, but if you have any questions give me a shout.
cheers,
Łukasz
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)
Tags:






Comments
Fahmeed Nawaz replied on Tue, 2012/06/12 - 11:03am
We use java client driver for the connection.If you confront that kind of problem before how did you solve it? I do have couple questions and I wii be gladful if you answer them.
1. when you connect to mongo pooling is by default true. Is there any way change the pooling=false?
2. Centos 64 bit mongo default connection limit is 10.000 and I have changed ulimit 65000 setting in /etc/init.d/mongod file but It can be increased to 20.000 Is there any way to more than 20.000
3. Is there any settingsfor connection lifetime? for example /etc/mongo.conf ...