public class HelloService {
public String sayHello(String username) {
return "Hello: " + username;
}
}
以上是发布的方法,发布后显示的路径是:http://localhost:8080/eclipse4WS/services/HelloService
我的方法名为sayHello()
发布结果没有显示方法名等信息,只是提示:
HelloService
Hi there, this is an AXIS service!
Perhaps there will be a form for invoking the service here...
不知道算不算成功,后来使用webservice协议来调取此端口成功。
httpget方法:
public class newhttp {
public static void main(String[] args) throws ClientProtocolException, IOException{
String url="http://localhost:8080/eclipse4WS/services/HelloService";
String param="username="+URLEncoder.encode("000000", "utf-8");
HttpClient httpclient=new DefaultHttpClient();
httpclient.getParams().setParameter(HttpProtocolParams.HTTP_CONTENT_CHARSET, "UTF-8");
HttpGet httpget=new HttpGet(url+"?"+param);
ResponseHandler<String> responseHandler = new BasicResponseHandler();
String responseBody = httpclient.execute(httpget, responseHandler);
System.out.println(responseBody);
httpclient.getConnectionManager().shutdown();
}
}
放落上找的方法,但不能成功,是不是url不对,如何修改?