clientadd.java

来自「globus toolkit Math例子」· Java 代码 · 共 70 行

JAVA
70
字号
package org.globus.examples.clients.MathService_instance_notif;import java.io.FileInputStream;import org.apache.axis.message.addressing.Address;import org.apache.axis.message.addressing.EndpointReferenceType;import org.globus.examples.services.core.notifications.impl.MathQNames;import org.globus.examples.stubs.MathService_instance_notif.MathPortType;import org.globus.examples.stubs.MathService_instance_notif.service.MathServiceAddressingLocator;import org.oasis.wsrf.properties.GetResourcePropertyResponse;import org.globus.wsrf.encoding.ObjectDeserializer;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);				// Print resource properties				printResourceProperties(math);			} catch (Exception e) {				e.printStackTrace();			}		}	}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?