`

axis2客户端开发

阅读更多
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();
			}
			
}
}

 

0
0
分享到:
评论
1 楼 lunzi 2011-10-26  
正好帮上忙,tks!

相关推荐

Global site tag (gtag.js) - Google Analytics