serviceclient.java

来自「精通Jboss——Ejb和Web Services开发精解的随书源代码」· Java 代码 · 共 20 行

JAVA
20
字号
package com.liuyang.jboss.net.ejb.client;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;

public class ServiceClient {

	public static void main(String[] args) throws Exception {
		String endpoint = "http://localhost:8080/jboss-net/services/CalculatorService";
		Service  service = new Service();
		Call     call    = (Call) service.createCall();
		call.setTargetEndpointAddress( new java.net.URL(endpoint) );
		call.setOperationName( "getValue" );
		call.setReturnType( XMLType.XSD_INT );
		Object ret =  call.invoke( new Object [] {});
		System.out.println("返回结果 : " + ret);
	}
}

⌨️ 快捷键说明

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