}
}
}
// Get the Service from the ServiceFactory if specified
Service service = serviceFactory.getService();
// SOAP nonsense
BindingInfo bindingInfo = createBindingInfo();
if (bindingInfo instanceof SoapBindingInfo
&& (((SoapBindingInfo) bindingInfo).getTransportURI() == null
|| LocalTransportFactory.TRANSPORT_ID.equals(transportId))) {
((SoapBindingInfo) bindingInfo).setTransportURI(transportId);
transportId = "http://schemas.xmlsoap.org/wsdl/soap/";
}
if (transportId == null) {
if (bindingInfo instanceof SoapBindingInfo) {
// TODO: we shouldn't have to do this, but the DF is null because the
// LocalTransport doesn't return for the http:// uris
// People also seem to be supplying a null JMS getAddress(), which is worrying
transportId = "http://schemas.xmlsoap.org/wsdl/soap/";
} else {
transportId = "http://schemas.xmlsoap.org/wsdl/http/";
}
}
service.getServiceInfos().get(0).addBinding(bindingInfo);
setTransportId(transportId);
if (destinationFactory == null) {
DestinationFactoryManager dfm = getBus().getExtension(DestinationFactoryManager.class);
destinationFactory = dfm.getDestinationFactory(transportId);
}
EndpointInfo ei;
if (destinationFactory instanceof WSDLEndpointFactory) {
ei = ((WSDLEndpointFactory)destinationFactory)
.createEndpointInfo(service.getServiceInfos().get(0), bindingInfo, null);
ei.setTransportId(transportId);
} else {
ei = new EndpointInfo(service.getServiceInfos().get(0), transportId);
}
int count = 1;
while (service.getEndpointInfo(endpointName) != null) {
endpointName = new QName(endpointName.getNamespaceURI(),
endpointName.getLocalPart() + count);
count++;
}
ei.setName(endpointName);
ei.setAddress(getAddress());
ei.setBinding(bindingInfo);
if (publishedEndpointUrl != null && !"".equals(publishedEndpointUrl)) {
ei.setProperty("publishedEndpointUrl", publishedEndpointUrl);
}
if (destinationFactory instanceof WSDLEndpointFactory) {
WSDLEndpointFactory we = (WSDLEndpointFactory) destinationFactory;
we.createPortExtensors(ei, service);
} else {
// ?
}
service.getServiceInfos().get(0).addEndpoint(ei);
return ei;
}