61 lines
2.0 KiB
Java
61 lines
2.0 KiB
Java
package org.gcube.informationsystem.collector.stubs.testsuite.xmlcollectionaccess;
|
|
|
|
import java.net.URL;
|
|
import java.rmi.RemoteException;
|
|
|
|
import org.gcube.common.core.contexts.GCUBERemotePortTypeContext;
|
|
import org.gcube.common.core.scope.GCUBEScope;
|
|
import org.gcube.common.core.utils.logging.GCUBEClientLog;
|
|
import org.gcube.informationsystem.collector.stubs.DocumentNotFoundFaultType;
|
|
import org.gcube.informationsystem.collector.stubs.GetProfileCriteria;
|
|
import org.gcube.informationsystem.collector.stubs.XMLCollectionAccessPortType;
|
|
import org.gcube.informationsystem.collector.stubs.service.XMLCollectionAccessServiceLocator;
|
|
|
|
/**
|
|
* Tester for <em>GetProfile</em> operation of the
|
|
* <em>gcube/informationsystem/collector/XMLCollectionAccess</em> portType
|
|
*
|
|
* @author Manuele Simi (ISTI-CNR)
|
|
*
|
|
*/
|
|
public class GetProfileTester {
|
|
|
|
private static GCUBEClientLog logger = new GCUBEClientLog(GetProfileTester.class);
|
|
|
|
/**
|
|
* @param args
|
|
*/
|
|
public static void main(String[] args) {
|
|
if (args.length != 5) {
|
|
logger.fatal("Usage: GetProfileTester <host> <port> <Scope> <ID> <profileType>");
|
|
return;
|
|
}
|
|
final String portTypeURI = "http://" + args[0] + ":" + args[1] + "/wsrf/services/gcube/informationsystem/collector/XMLCollectionAccess";
|
|
|
|
|
|
XMLCollectionAccessPortType port = null;
|
|
try {
|
|
port = new XMLCollectionAccessServiceLocator().getXMLCollectionAccessPortTypePort(new URL(portTypeURI));
|
|
port = GCUBERemotePortTypeContext.getProxy(port, GCUBEScope.getScope(args[2]));
|
|
} catch (Exception e) {
|
|
logger.error("",e);
|
|
}
|
|
|
|
logger.info("Submitting the request...");
|
|
|
|
String profile;
|
|
try {
|
|
GetProfileCriteria criteria = new GetProfileCriteria();
|
|
criteria.setID(args[3]);
|
|
criteria.setProfileType(args[4]);
|
|
profile = port.getProfile(criteria);
|
|
logger.info("Retrieved profile: \n" + profile);
|
|
} catch (DocumentNotFoundFaultType e) {
|
|
logger.error("",e);
|
|
} catch (RemoteException e) {
|
|
logger.error("",e);
|
|
}
|
|
}
|
|
|
|
}
|