client_gsisecconv_signed.java

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

JAVA
95
字号
/* * This file is licensed under the terms of the Globus Toolkit Public License * v3, found at http://www.globus.org/toolkit/legal/4.0/license-v3.html. *  * This notice must appear in redistributions of this file, with or without * modification. */package org.globus.examples.clients.MathService_instance_4op;import javax.xml.rpc.Stub;import org.apache.axis.message.addressing.Address;import org.apache.axis.message.addressing.EndpointReferenceType;import org.globus.axis.util.Util;import org.globus.examples.services.security.first.impl.MathConstants;import org.globus.examples.stubs.MathService_instance_4op.MathPortType;import org.globus.examples.stubs.MathService_instance_4op.service.MathServiceAddressingLocator;import org.globus.wsrf.impl.security.authorization.NoAuthorization;import org.globus.wsrf.security.Constants;import org.oasis.wsrf.properties.GetResourcePropertyResponse;public class Client_GSISecConv_Signed {	static {		Util.registerTransport();	}	public static void main(String[] args) {		MathServiceAddressingLocator locator = new MathServiceAddressingLocator();		GetResourcePropertyResponse valueRP;		String value;		try {			String serviceURI = args[0];			// Create endpoint reference to service			EndpointReferenceType endpoint = new EndpointReferenceType();			endpoint.setAddress(new Address(serviceURI));			MathPortType math = locator.getMathPortTypePort(endpoint);			// Get PortType			math = locator.getMathPortTypePort(endpoint);			// Setup security options			((Stub) math)._setProperty(Constants.GSI_SEC_CONV,					Constants.SIGNATURE);			((Stub) math)._setProperty(Constants.AUTHORIZATION, NoAuthorization					.getInstance());			// Perform an addition			try {				math.add(60);				System.out.println("Addition was successful");			} catch (Exception e) {				System.out.println("[add]      ERROR: " + e.getMessage());			}			// Perform a subtraction			try {				math.subtract(50);				System.out.println("Subtraction was successful");			} catch (Exception e) {				System.out.println("[subtract] ERROR: " + e.getMessage());			}			// Perform a multiplication			try {				math.multiply(4);				System.out.println("Multiplication was successful");			} catch (Exception e) {				System.out.println("[multiply] ERROR: " + e.getMessage());			}			// Perform a division			try {				math.divide(2);				System.out.println("Division was successful");			} catch (Exception e) {				System.out.println("[divide]   ERROR: " + e.getMessage());			}			// Access value			try {				valueRP = math.getResourceProperty(MathConstants.RP_VALUE);				value = valueRP.get_any()[0].getValue();				System.out.println("Current value: " + value);			} catch (Exception e) {				System.out.println("[getRP]    ERROR: " + e.getMessage());			}		} catch (Exception e) {			e.printStackTrace();		}	}}

⌨️ 快捷键说明

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