初学web service 吾知大虾们有咩好书介绍叻? 付一小例 大家一齐学
Hello.jws:public class Hello
{
public String hello(String name)
{
return name + "welcome to axis!";
}
}
WebServiceClient.java:
package coffee;
import org.apache.axis.client.*;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
public class WebServiceClient
{
public static void main(String args[])
{
System.out.println("开始调用WebService");
try
{
String endpoint = "http://localhost:8209/axis/Hello.jws";
Serviceservice = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName("hello");
String s = (String)call.invoke(new Object[] {"coffee"});
System.out.println(s);
}
catch (Exception e)
{
System.out.println(e.toString());
}
System.out.println("调用WebService正常结束");
}
} 我看oreilly的,感觉写得不好。后来翻看了好多其他资料才理解。其他书没看过。
页:
[1]