`
coolpep
  • 浏览: 77106 次
社区版块
存档分类
最新评论

axis 调用webservice (客户端)

 
阅读更多

package com.client;

import javax.xml.namespace.QName;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;

public class AxisClient {
public static void main(String[] args) {
try {
String endpoint = "http://localhost:8080/ServiceTest/services/Math?wsdl";

Service service = new Service();
Call call = (Call) service.createCall();

call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName("http://demo.webservice.samland/","echo"));

String ret = (String) call.invoke(new Object[] {"Samland"});

System.out.println("Sent 'Hello!', got '" + ret + "'");
} catch (Exception e) {
System.err.println(e.toString());
}
}

}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics