}
if (endpointName == null) {
endpointName = serviceFactory.getEndpointName();
}
EndpointInfo ei = service.getEndpointInfo(endpointName);
if (ei != null) {
if (transportId != null
&& !ei.getTransportId().equals(transportId)) {
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 (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());
}
}