📄 clientadd.java
字号:
package org.globus.examples.clients.MathService_instance_rp;import java.io.FileInputStream;import org.apache.axis.message.addressing.Address;import org.apache.axis.message.addressing.EndpointReferenceType;import org.globus.examples.services.core.rp.impl.MathQNames;import org.globus.examples.stubs.MathService_instance_rp.MathPortType;import org.globus.examples.stubs.MathService_instance_rp.service.MathServiceAddressingLocator;import org.globus.wsrf.encoding.ObjectDeserializer;import org.oasis.wsrf.properties.GetResourcePropertyResponse;import org.xml.sax.InputSource;public class ClientAdd { private static void printResourceProperties(MathPortType math) throws Exception { GetResourcePropertyResponse valueRP, lastOpRP, lastLogRP; String value, lastOp, lastLog; valueRP = math.getResourceProperty(MathQNames.RP_VALUE); lastOpRP = math.getResourceProperty(MathQNames.RP_LASTOP); value = valueRP.get_any()[0].getValue(); lastOp = lastOpRP.get_any()[0].getValue(); System.out.println("Value RP: " + value); System.out.println("LastOp RP: " + lastOp); } public static void main(String[] args) { MathServiceAddressingLocator instanceLocator = new MathServiceAddressingLocator(); try { int value = Integer.parseInt(args[1]); EndpointReferenceType instanceEPR; if (args[0].startsWith("http")) { // First argument contains a URI String serviceURI = args[0]; // Create endpoint reference to service instanceEPR = new EndpointReferenceType(); instanceEPR.setAddress(new Address(serviceURI)); } else { // First argument contains an EPR file name String eprFile = args[0]; // Get endpoint reference of WS-Resource from file FileInputStream fis = new FileInputStream(eprFile); instanceEPR = (EndpointReferenceType) ObjectDeserializer .deserialize(new InputSource(fis), EndpointReferenceType.class); fis.close(); } // Get PortType MathPortType math = instanceLocator .getMathPortTypePort(instanceEPR); // Perform addition math.add(value); // Access value } catch (Exception e) { e.printStackTrace(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -