📄 client_immed.java
字号:
package org.globus.examples.clients.FactoryService_Math_rl;import org.apache.axis.message.addressing.Address;import org.apache.axis.message.addressing.EndpointReferenceType;import org.globus.examples.stubs.MathService_instance_rl.MathPortType;import org.globus.examples.stubs.MathService_instance_rl.service.MathServiceAddressingLocator;import org.globus.examples.stubs.Factory.service.FactoryServiceAddressingLocator;import org.globus.examples.stubs.Factory.FactoryPortType;import org.globus.examples.stubs.Factory.CreateResource;import org.globus.examples.stubs.Factory.CreateResourceResponse;import org.oasis.wsrf.lifetime.Destroy;/* This client creates a new MathService instance through a FactoryService. This client * expects one parameter: the factory URI. */public class Client_immed { public static void main(String[] args) { FactoryServiceAddressingLocator factoryLocator = new FactoryServiceAddressingLocator(); MathServiceAddressingLocator instanceLocator = new MathServiceAddressingLocator(); try { String factoryURI = args[0]; EndpointReferenceType factoryEPR, instanceEPR; FactoryPortType mathFactory; MathPortType math; // Get factory portType factoryEPR = new EndpointReferenceType(); factoryEPR.setAddress(new Address(factoryURI)); mathFactory = factoryLocator.getFactoryPortTypePort(factoryEPR); // Create resource and get endpoint reference of WS-Resource. // This resource is our "instance". CreateResourceResponse createResponse = mathFactory .createResource(new CreateResource()); instanceEPR = createResponse.getEndpointReference(); // Get instance PortType math = instanceLocator.getMathPortTypePort(instanceEPR); System.out.println("Created instance."); // Perform an addition math.add(10); // Perform another addition math.add(5); // Perform a subtraction math.subtract(5); math.destroy(new Destroy()); System.out.println("Destroyed instance."); } catch (Exception e) { e.printStackTrace(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -