DefaultInvocationEngine engine;
AxisTransport transport;
IdentityProvider idp;
WSDLCache cache;
SAMLTokenCache tokenCache;
GridClientPluginManager pluginManager;
ProxyFactory proxyFactory;
ProxyFactory rawProxyFactory;
EndpointReferenceType pesEpr;
RemotePesService pesProxy;
CertificateTrustValidator manager;
try {
// Create a keystore identity
System.out.println("Client keystore = " + clientKeystorePath);
idp = new KeystoreIdentityProvider(clientKeystorePath, password.toCharArray());
// Create transport object which invokes operations
System.out.println("Setting up secure transport layer");
transport = new AxisTransport(idp);
// We need a cache to store our wsdl files
cache = new WSDLCacheImpl(transport);
manager = validator;
transport.setCertificateTrustValidator(manager);
ITInnovSocketFactory.setHandlers(idp, manager);
// Define a cache for any tokens we get from Membership Groups
tokenCache = new SAMLTokenCache();
// Define an engine which uses the transport to invoke operations
System.out.println("Creating an invocation engine");
engine = new DefaultInvocationEngine(transport);
//Load the GRIA plugins.
pluginManager = new GridClientPluginManager();
pluginManager.loadPlugins();
// Tell the engine how to find tokens by defining an
// attribute selector, which stores tokens in the token cache
engine.setAttributeSelector(new DefaultAttributeSelector(tokenCache));
// Tell the engine to use a federation selector, which finds
// management context (SLAs, Trade Accounts) when invoking an
// operation.
engine.setFederationSelector(new DefaultFederationSelector());
// The proxy factory creates proxy object from
// EndpointReference's which help us communicate with
// the services. The helper proxy factory adds some additional
// useful methods
System.out.println("Creating endpoint reference proxy to PES service");
rawProxyFactory = new InvocationEngineProxyFactory(engine, cache);
proxyFactory = new HelperProxyFactory(rawProxyFactory, pluginManager.getHelperRegistry());
engine.setProxyFactory(proxyFactory);
return proxyFactory;
} catch (Exception ex) {
throw new RuntimeException("Error creating the proxy factory. " + ex.getMessage(), ex);