use of com.ibm.wsdl.extensions.file.FileLocation 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;
}
use of com.ibm.wsdl.extensions.file.FileLocation 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;
}
Aggregations