Search in sources :

Example 1 with WSDLEndpointFactory

use of org.apache.cxf.wsdl11.WSDLEndpointFactory in project cxf by apache.

the class AbstractWSDLBasedEndpointFactory method createEndpointInfo.

protected EndpointInfo createEndpointInfo(BindingInfo bindingInfo) throws BusException {
    // setup the transport ID for the soap over jms if there is only address information
    if (transportId == null && getAddress() != null && getAddress().startsWith("jms:") && !"jms://".equals(getAddress())) {
        // Set the transportId to be soap over jms transport
        transportId = SoapJMSConstants.SOAP_JMS_SPECIFICIATION_TRANSPORTID;
    }
    // Get the Service from the ServiceFactory if specified
    Service service = serviceFactory.getService();
    if (bindingInfo == null) {
        // SOAP nonsense
        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/";
        }
        service.getServiceInfos().get(0).addBinding(bindingInfo);
    }
    if (transportId == null) {
        if (bindingInfo instanceof SoapBindingInfo) {
            transportId = ((SoapBindingInfo) bindingInfo).getTransportURI();
        }
        if (transportId == null && getAddress() != null && getAddress().contains("://")) {
            transportId = detectTransportIdFromAddress(getAddress());
        }
        if (transportId == null) {
            transportId = "http://schemas.xmlsoap.org/wsdl/http/";
        }
    }
    setTransportId(transportId);
    WSDLEndpointFactory wsdlEndpointFactory = getWSDLEndpointFactory();
    EndpointInfo ei;
    if (wsdlEndpointFactory != null) {
        ei = wsdlEndpointFactory.createEndpointInfo(bus, 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 (wsdlEndpointFactory != null) {
        wsdlEndpointFactory.createPortExtensors(bus, ei, service);
    }
    service.getServiceInfos().get(0).addEndpoint(ei);
    serviceFactory.sendEvent(FactoryBeanListener.Event.ENDPOINTINFO_CREATED, ei);
    return ei;
}
Also used : EndpointInfo(org.apache.cxf.service.model.EndpointInfo) WSDLEndpointFactory(org.apache.cxf.wsdl11.WSDLEndpointFactory) QName(javax.xml.namespace.QName) SoapBindingInfo(org.apache.cxf.binding.soap.model.SoapBindingInfo) Service(org.apache.cxf.service.Service) Endpoint(org.apache.cxf.endpoint.Endpoint)

Aggregations

QName (javax.xml.namespace.QName)1 SoapBindingInfo (org.apache.cxf.binding.soap.model.SoapBindingInfo)1 Endpoint (org.apache.cxf.endpoint.Endpoint)1 Service (org.apache.cxf.service.Service)1 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)1 WSDLEndpointFactory (org.apache.cxf.wsdl11.WSDLEndpointFactory)1