Search in sources :

Example 1 with SOAPAddress

use of javax.wsdl.extensions.soap.SOAPAddress in project tdi-studio-se by Talend.

the class DynamicInvoker method selectPort.

/**
     * Method selectPort
     * 
     * @param ports
     * @param portName
     * 
     * @return
     * 
     * @throws Exception
     */
public Port selectPort(Map ports, String portName) throws Exception {
    Iterator valueIterator = ports.keySet().iterator();
    while (valueIterator.hasNext()) {
        String name = (String) valueIterator.next();
        if ((portName == null) || (portName.length() == 0)) {
            Port port = (Port) ports.get(name);
            List list = port.getExtensibilityElements();
            for (int i = 0; (list != null) && (i < list.size()); i++) {
                Object obj = list.get(i);
                if (obj instanceof SOAPAddress) {
                    return port;
                }
            }
        } else if ((name != null) && name.equals(portName)) {
            return (Port) ports.get(name);
        }
    }
    return null;
}
Also used : Port(javax.wsdl.Port) SOAPAddress(javax.wsdl.extensions.soap.SOAPAddress) Iterator(java.util.Iterator) List(java.util.List)

Example 2 with SOAPAddress

use of javax.wsdl.extensions.soap.SOAPAddress in project Activiti by Activiti.

the class WSDLImporter method importService.

/**
   * Imports the service from the WSDL service definition
   */
private WSService importService(Service service) {
    String name = service.getQName().getLocalPart();
    Port port = (Port) service.getPorts().values().iterator().next();
    String location = "";
    List extensionElements = port.getExtensibilityElements();
    for (Object extension : extensionElements) {
        if (extension instanceof SOAPAddress) {
            SOAPAddress address = (SOAPAddress) extension;
            location = address.getLocationURI();
        }
    }
    WSService wsService = new WSService(this.namespace + name, location, this.wsdlLocation);
    return wsService;
}
Also used : Port(javax.wsdl.Port) SOAPAddress(javax.wsdl.extensions.soap.SOAPAddress) NodeList(org.w3c.dom.NodeList) List(java.util.List)

Example 3 with SOAPAddress

use of javax.wsdl.extensions.soap.SOAPAddress in project cxf by apache.

the class FailoverTest method updateWsdlExtensors.

/**
 * Exchange the port number in all service addresses on the bus.
 * @param port1 current port
 * @param port2 new port
 */
private void updateWsdlExtensors(String port1, String port2) {
    try {
        Definition def = bus.getExtension(WSDLManager.class).getDefinition(wsdlLocation);
        Map<?, ?> map = def.getAllServices();
        for (Object o : map.values()) {
            Service service = (Service) o;
            Map<?, ?> ports = service.getPorts();
            for (Object p : ports.values()) {
                Port port = (Port) p;
                List<?> l = port.getExtensibilityElements();
                for (Object e : l) {
                    if (e instanceof SOAPAddress) {
                        String add = ((SOAPAddress) e).getLocationURI();
                        int idx = add.indexOf(":" + port1);
                        if (idx != -1) {
                            add = add.substring(0, idx) + ":" + port2 + add.substring(idx + port1.length() + 1);
                            ((SOAPAddress) e).setLocationURI(add);
                        }
                    }
                }
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Port(javax.wsdl.Port) SOAPAddress(javax.wsdl.extensions.soap.SOAPAddress) Definition(javax.wsdl.Definition) WSDLManager(org.apache.cxf.wsdl.WSDLManager) ClusteredGreeterService(org.apache.cxf.greeter_control.ClusteredGreeterService) Service(javax.wsdl.Service) ControlService(org.apache.cxf.greeter_control.ControlService) Endpoint(org.apache.cxf.endpoint.Endpoint) ConnectException(java.net.ConnectException) HTTPException(org.apache.cxf.transport.http.HTTPException)

Example 4 with SOAPAddress

use of javax.wsdl.extensions.soap.SOAPAddress in project Lucee by lucee.

the class WSUtil method getSoapPort.

public static Port getSoapPort(javax.wsdl.Service service) throws RPCException {
    String name = null;
    Port port = null;
    List list = null;
    Map ports = service.getPorts();
    Iterator it;
    Iterator<Port> itr = ports.values().iterator();
    Object v;
    while (itr.hasNext()) {
        port = itr.next();
        list = port.getExtensibilityElements();
        if (list != null) {
            it = list.iterator();
            while (it.hasNext()) {
                v = it.next();
                if (v instanceof SOAPAddress) {
                    return port;
                }
            }
        }
    }
    throw new RPCException("Can't locate port entry for service " + service.getQName().toString() + " WSDL");
}
Also used : RPCException(lucee.runtime.net.rpc.RPCException) Port(javax.wsdl.Port) SOAPAddress(javax.wsdl.extensions.soap.SOAPAddress) Iterator(java.util.Iterator) List(java.util.List) Map(java.util.Map)

Example 5 with SOAPAddress

use of javax.wsdl.extensions.soap.SOAPAddress in project cxf by apache.

the class PartialWSDLProcessor method doAppendService.

public static javax.wsdl.Service doAppendService(Definition wsdlDefinition, String existPortName, ExtensionRegistry extReg, Binding binding) throws Exception {
    javax.wsdl.Service wsdlService = wsdlDefinition.createService();
    wsdlService.setQName(new QName(wsdlDefinition.getTargetNamespace(), existPortName + serviceName));
    Port port = wsdlDefinition.createPort();
    port.setName(existPortName + portName);
    port.setBinding(binding);
    SOAPAddress address = PartialWSDLProcessor.setAddrElement(wsdlDefinition, port, extReg);
    port.addExtensibilityElement(address);
    wsdlService.addPort(port);
    return wsdlService;
}
Also used : QName(javax.xml.namespace.QName) Port(javax.wsdl.Port) SOAPAddress(javax.wsdl.extensions.soap.SOAPAddress)

Aggregations

SOAPAddress (javax.wsdl.extensions.soap.SOAPAddress)22 Port (javax.wsdl.Port)12 QName (javax.xml.namespace.QName)9 Service (javax.wsdl.Service)7 SOAP12Address (javax.wsdl.extensions.soap12.SOAP12Address)7 Definition (javax.wsdl.Definition)5 Test (org.junit.Test)5 List (java.util.List)4 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)4 HTTPAddress (javax.wsdl.extensions.http.HTTPAddress)4 URL (java.net.URL)3 Iterator (java.util.Iterator)3 Binding (javax.wsdl.Binding)3 File (java.io.File)2 Map (java.util.Map)2 BindingOperation (javax.wsdl.BindingOperation)2 UnknownExtensibilityElement (javax.wsdl.extensions.UnknownExtensibilityElement)2 SOAPBinding (javax.wsdl.extensions.soap.SOAPBinding)2 SOAPOperation (javax.wsdl.extensions.soap.SOAPOperation)2 ToolException (org.apache.cxf.tools.common.ToolException)2