📄 javabeanwstestor.java
字号:
package com.jessica.ws;
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://127.0.0.1:8081/mywebservice/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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -