Search in sources :

Example 1 with SoapAddress

use of org.apache.cxf.binding.soap.wsdl.extensions.SoapAddress in project cxf by apache.

the class SoapAddressPlugin method createExtension.

public ExtensibilityElement createExtension(final boolean isSOAP12, final String address) throws WSDLException {
    SoapAddress soapAddress = SOAPBindingUtil.createSoapAddress(registry, isSOAP12);
    soapAddress.setLocationURI(address);
    return soapAddress;
}
Also used : SoapAddress(org.apache.cxf.binding.soap.wsdl.extensions.SoapAddress)

Example 2 with SoapAddress

use of org.apache.cxf.binding.soap.wsdl.extensions.SoapAddress in project cxf by apache.

the class ServiceImpl method initializePorts.

private void initializePorts() {
    try {
        Definition def = bus.getExtension(WSDLManager.class).getDefinition(wsdlURL);
        javax.wsdl.Service serv = def.getService(serviceName);
        if (serv == null) {
            throw new WebServiceException("Could not find service named " + serviceName + " in wsdl " + wsdlURL);
        }
        Map<String, Port> wsdlports = CastUtils.cast(serv.getPorts());
        for (Port port : wsdlports.values()) {
            QName name = new QName(serviceName.getNamespaceURI(), port.getName());
            String address = null;
            String bindingID = null;
            List<? extends ExtensibilityElement> extensions = CastUtils.cast(port.getBinding().getExtensibilityElements());
            if (!extensions.isEmpty()) {
                ExtensibilityElement e = extensions.get(0);
                if (e instanceof SoapBinding) {
                    bindingID = SOAPBinding.SOAP11HTTP_BINDING;
                } else if (e instanceof SOAP12Binding) {
                    bindingID = SOAPBinding.SOAP12HTTP_BINDING;
                } else if (e instanceof javax.wsdl.extensions.soap.SOAPBinding) {
                    bindingID = SOAPBinding.SOAP11HTTP_BINDING;
                }
            }
            extensions = CastUtils.cast(port.getExtensibilityElements());
            if (!extensions.isEmpty()) {
                ExtensibilityElement e = extensions.get(0);
                if (e instanceof SoapAddress) {
                    address = ((SoapAddress) e).getLocationURI();
                } else if (e instanceof AddressType) {
                    address = ((AddressType) e).getLocation();
                } else if (e instanceof SOAP12Address) {
                    address = ((SOAP12Address) e).getLocationURI();
                } else if (e instanceof SOAPAddress) {
                    address = ((SOAPAddress) e).getLocationURI();
                } else if (e instanceof HTTPAddress) {
                    address = ((HTTPAddress) e).getLocationURI();
                }
            }
            addPort(name, bindingID, address);
        }
    } catch (WebServiceException e) {
        throw e;
    } catch (Throwable e) {
        if (e instanceof UncheckedException && LOG.isLoggable(Level.FINE)) {
            LOG.log(Level.FINE, e.getLocalizedMessage(), e);
        }
        WSDLServiceFactory sf = new WSDLServiceFactory(bus, wsdlURL, serviceName);
        Service service = sf.create();
        for (ServiceInfo si : service.getServiceInfos()) {
            for (EndpointInfo ei : si.getEndpoints()) {
                String bindingID = BindingID.getJaxwsBindingID(ei.getTransportId());
                addPort(ei.getName(), bindingID, ei.getAddress());
            }
        }
    }
}
Also used : HTTPAddress(javax.wsdl.extensions.http.HTTPAddress) Port(javax.wsdl.Port) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) ServiceInfo(org.apache.cxf.service.model.ServiceInfo) EndpointInfo(org.apache.cxf.service.model.EndpointInfo) SOAP12Binding(javax.wsdl.extensions.soap12.SOAP12Binding) SOAP12Address(javax.wsdl.extensions.soap12.SOAP12Address) WSDLServiceFactory(org.apache.cxf.wsdl11.WSDLServiceFactory) WebServiceException(javax.xml.ws.WebServiceException) QName(javax.xml.namespace.QName) Definition(javax.wsdl.Definition) SOAPBinding(javax.xml.ws.soap.SOAPBinding) Service(org.apache.cxf.service.Service) WebService(javax.jws.WebService) SoapBinding(org.apache.cxf.binding.soap.wsdl.extensions.SoapBinding) UncheckedException(org.apache.cxf.common.i18n.UncheckedException) SoapAddress(org.apache.cxf.binding.soap.wsdl.extensions.SoapAddress) SOAPAddress(javax.wsdl.extensions.soap.SOAPAddress) WSDLManager(org.apache.cxf.wsdl.WSDLManager) AddressType(org.apache.cxf.wsdl.http.AddressType)

Example 3 with SoapAddress

use of org.apache.cxf.binding.soap.wsdl.extensions.SoapAddress in project cxf by apache.

the class SoapTransportFactory method createEndpointInfo.

public EndpointInfo createEndpointInfo(Bus bus, ServiceInfo serviceInfo, BindingInfo b, List<?> ees) {
    String transportURI = "http://schemas.xmlsoap.org/wsdl/soap/";
    if (b instanceof SoapBindingInfo) {
        SoapBindingInfo sbi = (SoapBindingInfo) b;
        transportURI = sbi.getTransportURI();
    }
    EndpointInfo info = new SoapEndpointInfo(serviceInfo, transportURI);
    if (ees != null) {
        for (Iterator<?> itr = ees.iterator(); itr.hasNext(); ) {
            Object extensor = itr.next();
            if (SOAPBindingUtil.isSOAPAddress(extensor)) {
                final SoapAddress sa = SOAPBindingUtil.getSoapAddress(extensor);
                info.addExtensor(sa);
                info.setAddress(sa.getLocationURI());
                if (isJMSSpecAddress(sa.getLocationURI())) {
                    info.setTransportId(SoapJMSConstants.SOAP_JMS_SPECIFICIATION_TRANSPORTID);
                }
            } else {
                info.addExtensor(extensor);
            }
        }
    }
    return info;
}
Also used : EndpointInfo(org.apache.cxf.service.model.EndpointInfo) SoapAddress(org.apache.cxf.binding.soap.wsdl.extensions.SoapAddress) SoapBindingInfo(org.apache.cxf.binding.soap.model.SoapBindingInfo)

Example 4 with SoapAddress

use of org.apache.cxf.binding.soap.wsdl.extensions.SoapAddress in project cxf by apache.

the class SoapTransportFactory method createSoapExtensors.

private void createSoapExtensors(Bus bus, EndpointInfo ei, SoapBindingInfo bi, boolean isSoap12) {
    try {
        String address = ei.getAddress();
        if (address == null) {
            address = "http://localhost:9090";
        }
        ExtensionRegistry registry = bus.getExtension(WSDLManager.class).getExtensionRegistry();
        SoapAddress soapAddress = SOAPBindingUtil.createSoapAddress(registry, isSoap12);
        soapAddress.setLocationURI(address);
        ei.addExtensor(soapAddress);
    } catch (WSDLException e) {
        e.printStackTrace();
    }
}
Also used : WSDLException(javax.wsdl.WSDLException) SoapAddress(org.apache.cxf.binding.soap.wsdl.extensions.SoapAddress) WSDLManager(org.apache.cxf.wsdl.WSDLManager) ExtensionRegistry(javax.wsdl.extensions.ExtensionRegistry)

Aggregations

SoapAddress (org.apache.cxf.binding.soap.wsdl.extensions.SoapAddress)4 EndpointInfo (org.apache.cxf.service.model.EndpointInfo)2 WSDLManager (org.apache.cxf.wsdl.WSDLManager)2 WebService (javax.jws.WebService)1 Definition (javax.wsdl.Definition)1 Port (javax.wsdl.Port)1 WSDLException (javax.wsdl.WSDLException)1 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)1 ExtensionRegistry (javax.wsdl.extensions.ExtensionRegistry)1 HTTPAddress (javax.wsdl.extensions.http.HTTPAddress)1 SOAPAddress (javax.wsdl.extensions.soap.SOAPAddress)1 SOAP12Address (javax.wsdl.extensions.soap12.SOAP12Address)1 SOAP12Binding (javax.wsdl.extensions.soap12.SOAP12Binding)1 QName (javax.xml.namespace.QName)1 WebServiceException (javax.xml.ws.WebServiceException)1 SOAPBinding (javax.xml.ws.soap.SOAPBinding)1 SoapBindingInfo (org.apache.cxf.binding.soap.model.SoapBindingInfo)1 SoapBinding (org.apache.cxf.binding.soap.wsdl.extensions.SoapBinding)1 UncheckedException (org.apache.cxf.common.i18n.UncheckedException)1 Service (org.apache.cxf.service.Service)1