ITeye博客

axis2客户端开发

cake513 · 2010-07-12 16:58 · Web Services · 编程语言 · Markdown

import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
/*web服务方法签名:public String callService(String startTime, String endTime) */

public class ServiceTest {

	public static void main(String[] args) {
		
			String startTime = "2010-05-02";
			String endTime = "2010-05-20";
		
			String serviceSpace="http://service.xcky.com";
			String methodName = "callService";//服务方法名
			String serviceUrl= "http://localhost:8081/axis2/services/xcky?wsdl";
			
			Service service = new Service();
			Call call = null;
			try {
				call = (Call) service.createCall();
				call.setTargetEndpointAddress(new java.net.URL(serviceUrl));
				call.setOperationName(new QName(serviceSpace, methodName1));
				Object[] inargs = new Object[] {startTime,endTime};//参数数组
				String strReturn =  (String)call.invoke(inargs);
				System.out.println(strReturn);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
}
}

评论(1)

  1. #1 楼 · lunzi · 2011-10-26 14:29

    正好帮上忙,tks!

评论功能维护中,当前仅展示历史评论。