??????? WEB-INF ???? ??web.xml??????У?WEB.XML???????????????axis???????????????????????????????
<servlet>
<servlet-name>AxisServlet</servlet-name>
<servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
?????????????????????
package server;
public class SayHello {
public String getName(String name) {
return "hello====>" + name;
}
}
?????壺??????????????????????????
package client;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class TestClient {
public static void main(String[] args) throws Exception {
// ???service????URL
String endpoint = "http://127.0.0.1:8082/webservice/services/Login.jws";
// ???????????(service)????(call)
Service service = new Service();
Call call = (Call) service.createCall();// ???service????call????
// ????service????URL
call.setTargetEndpointAddress(new java.net.URL(endpoint));
// ??????(processService)??MyService.java?????????????
call.setOperationName("getName");
// Object ??????????????????"This is Test!"??????processService(String arg)
String ret = (String) call.invoke(new Object[] { "????" });
System.out.println(ret);
}
}
???????????tomcat???????http://127.0.0.1:8082/webservice/services????????з??????????????????????????????????????????
???????Ч??????????
And now... Some Services
Login.jws (wsdl)
getName
?????????????????????TestClient??????н?????????????ɡ?