LOG.log(Level.FINE, "endpoint reference:", epr);
LOG.log(Level.FINE, "endpoint interface:", serviceEndpointInterface);
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
JaxWsClientFactoryBean clientFac = (JaxWsClientFactoryBean) proxyFac.getClientFactoryBean();
JaxWsServiceFactoryBean serviceFactory = (JaxWsServiceFactoryBean) proxyFac.getServiceFactory();
proxyFac.initFeatures();
WebServiceFeature f[] = getAllFeatures(features);
if (f != null) {
serviceFactory.setWsFeatures(Arrays.asList(f));
}
proxyFac.setBus(bus);
proxyFac.setServiceClass(serviceEndpointInterface);
proxyFac.setServiceName(serviceName);
if (epr != null
&& epr.getAddress() != null
&& epr.getAddress().getValue() != null) {
clientFac.setAddress(epr.getAddress().getValue());
}
if (wsdlURL != null) {
proxyFac.setWsdlURL(wsdlURL);
}
configureObject(proxyFac);
configureObject(clientFac);
if (portName == null) {
QName portTypeName = getPortTypeName(serviceEndpointInterface);
Service service = serviceFactory.getService();
if (service == null) {
serviceFactory.setServiceClass(serviceEndpointInterface);
serviceFactory.setBus(getBus());
service = serviceFactory.create();
}
EndpointInfo ei = ServiceModelUtil.findBestEndpointInfo(portTypeName, service.getServiceInfos());
if (ei != null) {
portName = ei.getName();
} else {
portName = serviceFactory.getEndpointName();
}
}
serviceFactory.setEndpointName(portName);
if (epr != null) {
clientFac.setEndpointReference(epr);
}
PortInfoImpl portInfo = portInfos.get(portName);
if (portInfo != null) {
clientFac.setBindingId(portInfo.getBindingID());
clientFac.setAddress(portInfo.getAddress());
}
//configureObject(portName.toString() + ".jaxws-client.proxyFactory", proxyFac);
if (clazz != ServiceImpl.class) {
// handlerchain should be on the generated Service object
proxyFac.setLoadHandlers(false);
}
Object obj = proxyFac.create();
// Configure the Service
Service service = serviceFactory.getService();
configureObject(service);
// Configure the JaxWsEndpoitnImpl
Client client = ClientProxy.getClient(obj);
client.getEndpoint().setExecutor(executor);