* @param oiEndpointAddress Workspace OpenInterface endpoint address (URL suffix)
* @param openInterfaceHost Workspace OpenInterface host address (URL)
* @return OpenInterface remote interface stub
*/
public static OpenInterfaceIF getOpenInterfaceIF(String oiEndpointAddress, String openInterfaceHost) {
Stub stub = createOpenInterfaceProxy();
/*
* If host string contains one or more slash ('/') character(s), we need to remove
* everything after and including the slash char. Otherwise OI problems (HTTP error 404)
* will occur with installations not located in the document root path.
*/
int hostNameStartIndex = 0;
String fullAddress;
if(openInterfaceHost.indexOf("://") != -1) {
hostNameStartIndex = openInterfaceHost.indexOf("://") + 3; // Skip slash characters in protocol
// specification
}
if(openInterfaceHost.indexOf('/', hostNameStartIndex) != -1) {
fullAddress = openInterfaceHost.substring(0, openInterfaceHost.indexOf('/', hostNameStartIndex))
+ oiEndpointAddress;
} else {
fullAddress = openInterfaceHost + oiEndpointAddress;
}
stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, fullAddress);
OpenInterfaceIF oi = (OpenInterfaceIF) stub;
return oi;
}