Axis1.4-based WebService Interface Development (interface invocation)
First, WebService interface code refer to the previous blog:
Http://www.cnblogs.com/zhukunqiang/p/7125668.html
Second, the code part
1, new Web Project project, named Axiswebserviceclint, and import Axis1.4 required jar package (paste the jar package into the Lib directory).
2. New WebService interface Call class:
Package Com.no8.clint;import Java.net.url;import Javax.xml.rpc.serviceexception;import org.apache.axis.AxisFault; Import Org.apache.axis.client.call;import Org.apache.axis.client.service;public class WebClient {public static void Main (string[] args) throws Exception {String endpoint = "Http://localhost:8080/axiswebservice/services/HelloWorld? WSDL ";//Create a service call (calling) Service service = new service (); Call Call Service.createcall ();//Set the Urlcall.settargetendpointaddress (new Java.net.URL (endpoint)) where the service resides; Call.setoperation ("SayHello"); string ret = (string) call.invoke (new object[]{"Zhang San"}); SYSTEM.OUT.PRINTLN (ret);}}
3. Click Run Java class (run the Java file directly, do not need to deploy the Web project to Tomcat to run directly):
Call succeeded!
Axis1.4-based WebService Interface Development (interface invocation)