a0f69f708569001b17ebfb69563bbe4c
来自「《精通SOA:基于服务总线的Struts+EJB+Web Service整合应用」· 代码 · 共 34 行
TXT
34 行
package com.ws.javabean;
import java.net.MalformedURLException;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class JavaBeanWSTestor {
/**
* @param args
* @throws ServiceException
* @throws MalformedURLException
* @throws RemoteException
*/
public static void main(String[] args) throws ServiceException, MalformedURLException, RemoteException {
String endpoint = "http://localhost:" +"7001"+ "/webModule/services/getJavaBeanWsService";//指明服务所在位置
Service service = new Service(); //创建一个Service实例,注意是必须的!
Call call = (Call) service.createCall();//创建Call实例,也是必须的!
call.setTargetEndpointAddress( new java.net.URL(endpoint) );//为Call设置服务的位置
call.setOperationName( "getJavaBeanWs" );//注意方法名与JavaBeanWS.java中一样!!
String res = (String) call.invoke( new Object[] {"Aihu"} );//返回String,传入参数 "Aihu"
System.out.println( res );
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?