Search in sources :

Example 1 with FTPLocation

use of com.ibm.wsdl.extensions.ftp.FTPLocation in project cdmlib by cybertaxonomy.

the class LsidWsdlWrapperImpl method extractPort.

private static LsidStandardPortImpl extractPort(Service service, Port port, QName portTypeName) throws LSIDException {
    String portName = port.getName();
    LsidStandardPortImpl portImpl = new LsidStandardPortImpl();
    portImpl.setName(portName);
    // might have to use whole QName, not sure for now
    portImpl.setServiceName(service.getQName().getLocalPart());
    Iterator portElts = port.getExtensibilityElements().listIterator();
    while (portElts.hasNext()) {
        // expecting only 1
        Object portElt = portElts.next();
        if (portElt instanceof SOAPAddress) {
            SOAPAddress soapaddr = (SOAPAddress) portElt;
            portImpl.setLocation(soapaddr.getLocationURI());
            portImpl.setProtocol(SOAP);
        } else if (portElt instanceof HTTPAddress) {
            HTTPAddress httpaddr = (HTTPAddress) portElt;
            portImpl.setLocation(httpaddr.getLocationURI());
            portImpl.setProtocol(HTTP);
            QName bindingName = port.getBinding().getQName();
            if (bindingName.equals(DATA_HTTP_BINDING_DIRECT))
                portImpl.setPath(LSIDStandardPort.PATH_TYPE_DIRECT);
            else
                portImpl.setPath(LSIDStandardPort.PATH_TYPE_URL_ENCODED);
        } else if (portElt instanceof FTPLocation) {
            FTPLocation ftploc = (FTPLocation) portElt;
            portImpl.setLocation(ftploc.getServer());
            portImpl.setPath(ftploc.getFilePath());
            portImpl.setProtocol(FTP);
        } else if (portElt instanceof FileLocation) {
            FileLocation fileloc = (FileLocation) portElt;
            portImpl.setLocation(fileloc.getFilename());
            portImpl.setProtocol(FILE);
        } else {
            throw new LSIDException("Unknown Port impl");
        }
    }
    return portImpl;
}
Also used : HTTPAddress(javax.wsdl.extensions.http.HTTPAddress) LSIDException(com.ibm.lsid.LSIDException) QName(javax.xml.namespace.QName) SOAPAddress(javax.wsdl.extensions.soap.SOAPAddress) FileLocation(com.ibm.wsdl.extensions.file.FileLocation) Iterator(java.util.Iterator) FTPLocation(com.ibm.wsdl.extensions.ftp.FTPLocation)

Example 2 with FTPLocation

use of com.ibm.wsdl.extensions.ftp.FTPLocation in project cdmlib by cybertaxonomy.

the class LsidWsdlWrapperImpl method createPort.

/**
 * Create a port for the given binding, protocol, hostname, port and name.
 * In the case of some protocols, the hostname might be the entire endpoing, (for SOAP this is the case).
 * If the portname is null, then a default name for the given protocol is chosen.
 */
public Port createPort(Binding binding, LSIDStandardPort port) {
    Port newPort = definition.createPort();
    newPort.setBinding(binding);
    String portName = port.getName();
    String protocol = port.getProtocol();
    if (portName == null)
        portName = newPortName(protocol);
    newPort.setName(portName);
    if (protocol.equals(HTTP)) {
        HTTPAddress addr = new HTTPAddressImpl();
        addr.setLocationURI(port.getLocation());
        newPort.addExtensibilityElement(addr);
    } else if (protocol.equals(FTP)) {
        FTPLocation loc = new FTPLocationImpl(port.getLocation(), port.getPath());
        newPort.addExtensibilityElement(loc);
    } else if (protocol.equals(FILE)) {
        FileLocation loc = new FileLocationImpl(port.getLocation());
        newPort.addExtensibilityElement(loc);
    } else if (protocol.equals(SOAP)) {
        SOAPAddress addr = new SOAPAddressImpl();
        addr.setLocationURI(port.getLocation());
        newPort.addExtensibilityElement(addr);
    }
    return newPort;
}
Also used : SOAPAddressImpl(com.ibm.wsdl.extensions.soap.SOAPAddressImpl) FileLocationImpl(com.ibm.wsdl.extensions.file.FileLocationImpl) HTTPAddress(javax.wsdl.extensions.http.HTTPAddress) FTPLocationImpl(com.ibm.wsdl.extensions.ftp.FTPLocationImpl) HTTPAddressImpl(com.ibm.wsdl.extensions.http.HTTPAddressImpl) LSIDPort(com.ibm.lsid.wsdl.LSIDPort) LSIDDataPort(com.ibm.lsid.wsdl.LSIDDataPort) DefaultLSIDPort(com.ibm.lsid.wsdl.DefaultLSIDPort) LSIDStandardPort(com.ibm.lsid.wsdl.LSIDStandardPort) Port(javax.wsdl.Port) LSIDMetadataPort(com.ibm.lsid.wsdl.LSIDMetadataPort) LSIDAuthorityPort(com.ibm.lsid.wsdl.LSIDAuthorityPort) FileLocation(com.ibm.wsdl.extensions.file.FileLocation) SOAPAddress(javax.wsdl.extensions.soap.SOAPAddress) FTPLocation(com.ibm.wsdl.extensions.ftp.FTPLocation)

Aggregations

FileLocation (com.ibm.wsdl.extensions.file.FileLocation)2 FTPLocation (com.ibm.wsdl.extensions.ftp.FTPLocation)2 HTTPAddress (javax.wsdl.extensions.http.HTTPAddress)2 SOAPAddress (javax.wsdl.extensions.soap.SOAPAddress)2 LSIDException (com.ibm.lsid.LSIDException)1 DefaultLSIDPort (com.ibm.lsid.wsdl.DefaultLSIDPort)1 LSIDAuthorityPort (com.ibm.lsid.wsdl.LSIDAuthorityPort)1 LSIDDataPort (com.ibm.lsid.wsdl.LSIDDataPort)1 LSIDMetadataPort (com.ibm.lsid.wsdl.LSIDMetadataPort)1 LSIDPort (com.ibm.lsid.wsdl.LSIDPort)1 LSIDStandardPort (com.ibm.lsid.wsdl.LSIDStandardPort)1 FileLocationImpl (com.ibm.wsdl.extensions.file.FileLocationImpl)1 FTPLocationImpl (com.ibm.wsdl.extensions.ftp.FTPLocationImpl)1 HTTPAddressImpl (com.ibm.wsdl.extensions.http.HTTPAddressImpl)1 SOAPAddressImpl (com.ibm.wsdl.extensions.soap.SOAPAddressImpl)1 Iterator (java.util.Iterator)1 Port (javax.wsdl.Port)1 QName (javax.xml.namespace.QName)1