in rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractWSDLBasedEndpointFactory.java [89:213]
protected Endpoint createEndpoint() throws BusException, EndpointException {
serviceFactory.setFeatures(getFeatures());
if (serviceName != null) {
serviceFactory.setServiceName(serviceName);
}
if (endpointName != null) {
serviceFactory.setEndpointName(endpointName);
}
Service service = serviceFactory.getService();
if (service == null) {
initializeServiceFactory();
service = serviceFactory.create();
}
if (endpointName == null) {
endpointName = serviceFactory.getEndpointName();
}
EndpointInfo ei = service.getEndpointInfo(endpointName);
if (ei != null) {
if ((transportId != null
&& !ei.getTransportId().equals(transportId))
|| (bindingId != null && !ei.getBinding().getBindingId().equals(bindingId))) {
ei = null;
} else {
BindingFactoryManager bfm = getBus().getExtension(BindingFactoryManager.class);
bindingFactory = bfm.getBindingFactory(ei.getBinding().getBindingId());
}
}
if (ei == null) {
if (getAddress() == null) {
ei = ServiceModelUtil.findBestEndpointInfo(serviceFactory.getInterfaceName(), service
.getServiceInfos());
}
if (ei == null && !serviceFactory.isPopulateFromClass()) {
ei = ServiceModelUtil.findBestEndpointInfo(serviceFactory.getInterfaceName(), service
.getServiceInfos());
if (ei != null) {
BindingFactoryManager bfm = getBus().getExtension(BindingFactoryManager.class);
bindingFactory = bfm.getBindingFactory(ei.getBinding().getBindingId());
}
if (ei == null) {
LOG.warning("Could not find endpoint/port for "
+ endpointName + " in wsdl. Creating default.");
} else if (!ei.getName().equals(endpointName)) {
LOG.warning("Could not find endpoint/port for "
+ endpointName + " in wsdl. Using "
+ ei.getName() + ".");
}
}
if (ei == null) {
ei = createEndpointInfo(null);
} else if (transportId != null
&& !ei.getTransportId().equals(transportId)) {
LOG.warning("Transport for endpoint/port "
+ endpointName + " in wsdl doesn't match " + transportId + ".");
BindingInfo bi = ei.getBinding();
ei = createEndpointInfo(bi);
} else if (bindingId != null && !ei.getBinding().getBindingId().equals(bindingId)
//consider SoapBinding has multiple default namespace
&& !(SoapBindingFactory.DEFAULT_NAMESPACES.contains(bindingId)
&& SoapBindingFactory.DEFAULT_NAMESPACES.contains(ei.getBinding().getBindingId()))) {
LOG.warning("Binding for endpoint/port "
+ endpointName + " in wsdl doesn't match " + bindingId + ".");
ei = createEndpointInfo(null);
} else if (getAddress() != null) {
ei.setAddress(getAddress());
if (ei.getAddress().startsWith("camel")
|| ei.getAddress().startsWith("local")) {
modifyTransportIdPerAddress(ei);
}
}
} else if (getAddress() != null) {
ei.setAddress(getAddress());
}
if (publishedEndpointUrl != null && !"".equals(publishedEndpointUrl)) {
ei.setProperty("publishedEndpointUrl", publishedEndpointUrl);
}
if (endpointReference != null) {
ei.setAddress(endpointReference);
}
Endpoint ep = service.getEndpoints().get(ei.getName());
if (ep == null) {
ep = serviceFactory.createEndpoint(ei);
((EndpointImpl)ep).initializeActiveFeatures(getFeatures());
} else {
serviceFactory.setEndpointName(ei.getName());
if (ep.getActiveFeatures() == null) {
((EndpointImpl)ep).initializeActiveFeatures(getFeatures());
}
}
if (properties != null) {
ep.putAll(properties);
}
service.getEndpoints().put(ep.getEndpointInfo().getName(), ep);
if (getInInterceptors() != null) {
ep.getInInterceptors().addAll(getInInterceptors());
ep.getInInterceptors().add(WSDLGetInterceptor.INSTANCE);
}
if (getOutInterceptors() != null) {
ep.getOutInterceptors().addAll(getOutInterceptors());
}
if (getInFaultInterceptors() != null) {
ep.getInFaultInterceptors().addAll(getInFaultInterceptors());
}
if (getOutFaultInterceptors() != null) {
ep.getOutFaultInterceptors().addAll(getOutFaultInterceptors());
}
serviceFactory.sendEvent(FactoryBeanListener.Event.ENDPOINT_SELECTED, ei, ep,
serviceFactory.getServiceClass(), getServiceClass());
return ep;
}