Making a Simple Invocation from Java
Follow this guide to make a web service call on a GRIA Service using a test identity.
The full java file can be found here Simple Invocation Java File.
Simple Invocation Guide
Create a test identity for "bob"
IdentityProvider idp = new TestIdentityProvider("bob");
Create our transport, in this case we will use Axis
AxisTransport transport = new AxisTransport(idp);
The WSDL Cache keeps track of the wsdl's we get from services
WSDLCache cache = new WSDLCacheImpl(transport);
Now configure it to use a graphical trust validator, which will display a confirmation box in case the service's certificate isn't trusted
CertificateTrustValidator manager = new InteractiveX509TrustManager(new SwingInputHandler());
transport.setCertificateTrustValidator(manager);
ITInnovSocketFactory.setHandlers(idp, manager);
The engine makes the invocations on the service and can be configured to choose SLA's and Tokens. A DefaultInvocationEngine is all that is required at this stage
DefaultInvocationEngine engine = new DefaultInvocationEngine(transport);
To load GRIA plugins we use the GridClientPluginManager. This loads the default plugins which understand the standard GRIA services and resources.
GridClientPluginManager pluginManager = new GridClientPluginManager();
pluginManager.loadPlugins();
In order to create Proxys to our service from the address we can use a ProxyFactory. A HelperProxyFactory wraps some functionality of the Proxys in order to simplfy the interface to the service
ProxyFactory rawProxyFactory = new InvocationEngineProxyFactory(engine, cache);
HelperProxyFactory proxyFactory = new HelperProxyFactory(rawProxyFactory, pluginManager.getHelperRegistry());
Define the URL of the service we wish to connect to
Change this to the address of your service.
eg. https://griademo1.it-innovation.soton.ac.uk/gria-basic-app-services/services/DataService
String dataServiceURL = "https://griademo1.it-innovation.soton.ac.uk/gria-basic-app-services/services/DataService";
EndpointReferenceType dataServiceEPR = ConversationID.getEPR(dataServiceURL);
Create a RemoteDataService Proxy from the address
RemoteDataService dataService = proxyFactory.createProxy(dataServiceEPR, RemoteDataService.class);
Make a call to retreive the identity of the remote service and print it to the console.
System.out.println(dataService.getServiceProviderID());