⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serviceclient.java

📁 精通Jboss——Ejb和Web Services开发精解的随书源代码
💻 JAVA
字号:
package com.liuyang.axis.client;

import javax.xml.rpc.ParameterMode;

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/axis/services/HelloService";
		String name = "liuyang";
		Service  service = new Service();
		Call     call    = (Call) service.createCall();
		call.setUsername("user1");
		call.setPassword("pass1");
		call.setTargetEndpointAddress( new java.net.URL(endpoint) );
		call.setOperationName( "sayHello" );
		call.addParameter( "param1", XMLType.XSD_STRING, ParameterMode.IN );
		call.setReturnType( XMLType.XSD_STRING );
		String ret = (String) call.invoke( new Object [] { name });
		System.out.println("返回结果 : " + ret);
	}
}

⌨️ 快捷键说明

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