Search in sources :

Example 11 with SOAP12Binding

use of javax.wsdl.extensions.soap12.SOAP12Binding in project cxf by apache.

the class SOAPBindingUtil method createSoapBinding.

public static SoapBinding createSoapBinding(ExtensionRegistry extReg, boolean isSOAP12) throws WSDLException {
    final ExtensibilityElement extElement;
    if (isSOAP12) {
        extElement = extReg.createExtension(Binding.class, new QName(WSDLConstants.NS_SOAP12, "binding"));
        ((SOAP12Binding) extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    } else {
        extElement = extReg.createExtension(Binding.class, new QName(WSDLConstants.NS_SOAP11, "binding"));
        ((SOAPBinding) extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    }
    return getSoapBinding(extElement);
}
Also used : SOAPBinding(javax.wsdl.extensions.soap.SOAPBinding) SOAP12Binding(javax.wsdl.extensions.soap12.SOAP12Binding) Binding(javax.wsdl.Binding) SoapBinding(org.apache.cxf.binding.soap.wsdl.extensions.SoapBinding) SOAP12Binding(javax.wsdl.extensions.soap12.SOAP12Binding) QName(javax.xml.namespace.QName) SOAPBinding(javax.wsdl.extensions.soap.SOAPBinding) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement)

Example 12 with SOAP12Binding

use of javax.wsdl.extensions.soap12.SOAP12Binding in project cxf by apache.

the class SOAPBindingUtil method createSoapBinding.

public static SOAPBinding createSoapBinding(ExtensionRegistry extReg, boolean isSOAP12) throws WSDLException {
    final ExtensibilityElement extElement;
    if (isSOAP12) {
        extElement = extReg.createExtension(Binding.class, new QName(WSDLConstants.NS_SOAP12, "binding"));
        ((SOAP12Binding) extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    } else {
        extElement = extReg.createExtension(Binding.class, new QName(WSDLConstants.NS_SOAP11, "binding"));
        ((SOAPBinding) extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
    }
    return getSoapBinding(extElement);
}
Also used : SOAPBinding(javax.wsdl.extensions.soap.SOAPBinding) SOAP12Binding(javax.wsdl.extensions.soap12.SOAP12Binding) Binding(javax.wsdl.Binding) SOAP12Binding(javax.wsdl.extensions.soap12.SOAP12Binding) QName(javax.xml.namespace.QName) SOAPBinding(javax.wsdl.extensions.soap.SOAPBinding) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement)

Example 13 with SOAP12Binding

use of javax.wsdl.extensions.soap12.SOAP12Binding in project cxf by apache.

the class WSDLServiceBuilder method buildEndpoint.

public EndpointInfo buildEndpoint(ServiceInfo service, BindingInfo bi, Port port) {
    List<?> elements = port.getExtensibilityElements();
    String ns = null;
    DestinationFactory factory = null;
    EndpointInfo ei = null;
    if (null != elements && !elements.isEmpty()) {
        for (ExtensibilityElement el : CastUtils.cast(elements, ExtensibilityElement.class)) {
            ns = el.getElementType().getNamespaceURI();
            try {
                factory = bus.getExtension(DestinationFactoryManager.class).getDestinationFactory(ns);
            } catch (BusException e) {
            // do nothing
            }
            if (factory != null) {
                break;
            }
        }
        if (factory == null) {
            ns = ((ExtensibilityElement) elements.get(0)).getElementType().getNamespaceURI();
        }
    }
    if (factory == null) {
        // get the transport id from bindingInfo
        elements = port.getBinding().getExtensibilityElements();
        if (null != elements && !elements.isEmpty()) {
            for (ExtensibilityElement el : CastUtils.cast(elements, ExtensibilityElement.class)) {
                if (el instanceof SOAPBinding) {
                    ns = ((SOAPBinding) el).getTransportURI();
                    break;
                } else if (el instanceof SOAP12Binding) {
                    ns = ((SOAP12Binding) el).getTransportURI();
                    break;
                // TODO: this is really ugly, but how to link between
                // this binding and this transport ?
                }
            }
        }
        if (ns == null) {
            if (ignoreUnknownBindings) {
                return null;
            }
            org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message("MISSING_DESTINATION_FACTORY", LOG, port.getName());
            throw new WSDLRuntimeException(msg);
        }
        try {
            factory = bus.getExtension(DestinationFactoryManager.class).getDestinationFactory(ns);
        } catch (BusException e) {
        // do nothing
        }
    }
    if (factory instanceof WSDLEndpointFactory) {
        WSDLEndpointFactory wFactory = (WSDLEndpointFactory) factory;
        ei = wFactory.createEndpointInfo(bus, service, bi, port.getExtensibilityElements());
    }
    if (ei == null) {
        ei = new EndpointInfo(service, ns);
    }
    copyDocumentation(ei, port);
    ei.setName(new QName(service.getName().getNamespaceURI(), port.getName()));
    ei.setBinding(bi);
    copyExtensors(ei, port.getExtensibilityElements());
    copyExtensionAttributes(ei, port);
    service.addEndpoint(ei);
    DescriptionInfo d = service.getDescription();
    if (null != d) {
        d.getDescribed().add(ei);
    }
    return ei;
}
Also used : DestinationFactory(org.apache.cxf.transport.DestinationFactory) Message(javax.wsdl.Message) QName(javax.xml.namespace.QName) SOAPBinding(javax.wsdl.extensions.soap.SOAPBinding) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) JAXBExtensibilityElement(org.apache.cxf.wsdl.JAXBExtensibilityElement) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) SOAP12Binding(javax.wsdl.extensions.soap12.SOAP12Binding) DescriptionInfo(org.apache.cxf.service.model.DescriptionInfo) BusException(org.apache.cxf.BusException)

Aggregations

SOAP12Binding (javax.wsdl.extensions.soap12.SOAP12Binding)13 SOAPBinding (javax.wsdl.extensions.soap.SOAPBinding)12 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)10 Binding (javax.wsdl.Binding)7 QName (javax.xml.namespace.QName)7 BindingOperation (javax.wsdl.BindingOperation)4 SoapBinding (org.apache.cxf.binding.soap.wsdl.extensions.SoapBinding)4 Test (org.junit.Test)4 Definition (javax.wsdl.Definition)3 SOAP12Operation (javax.wsdl.extensions.soap12.SOAP12Operation)3 File (java.io.File)2 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 BindingInput (javax.wsdl.BindingInput)2 HTTPBinding (javax.wsdl.extensions.http.HTTPBinding)2 SOAP12Body (javax.wsdl.extensions.soap12.SOAP12Body)2 WSDLReader (javax.wsdl.xml.WSDLReader)2 SoapBody (org.apache.cxf.binding.soap.wsdl.extensions.SoapBody)2 SoapOperation (org.apache.cxf.binding.soap.wsdl.extensions.SoapOperation)2