}
FactoryExtensionPoint factories = extensionsRegistry.getExtensionPoint(FactoryExtensionPoint.class);
AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
ProxyFactory proxyFactory = new ExtensibleProxyFactory(extensionsRegistry.getExtensionPoint(ProxyFactoryExtensionPoint.class));
CompositeContext compositeContext = new CompositeContext(extensionsRegistry, domainRegistry, null, domainURI, null, null);
List<Endpoint> eps = domainRegistry.findEndpoint(serviceName);
if (eps == null || eps.size() < 1) {
throw new NoSuchServiceException(serviceName);
}
Endpoint endpoint = eps.get(0); // TODO: what should be done with multiple endpoints?
if (serviceInterface == null) {
try {
findInterface(endpoint);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
RuntimeEndpointReference epr;
try {
epr = createEndpointReference(javaInterfaceFactory, compositeContext, assemblyFactory, endpoint, serviceInterface);
} catch (Exception e) {
throw new ServiceRuntimeException(e);
}
this.handler = Proxy.getInvocationHandler(proxyFactory.createProxy(serviceInterface, epr));
}
return handler;
}