我创建了一个 CXF 网络服务示例:
@WebService
public interface InterfaceWebService {
boolean doLogin(@WebParam(name="username")String username,@WebParam(name="password")String password);
}
服务器代码:
public class WebServer {
protected WebServer() throws Exception {
// START SNIPPET: publish
System.out.println("Starting Server");
WebServiceImpl implementor = new WebServiceImpl();
String address = "http://192.168.0.76:9000/sample";
Endpoint.publish(address, implementor);
// END SNIPPET: publish
}
public static void main(String args[]) throws Exception {
new WebServer();
System.out.println("Server ready...");
Thread.sleep(5 * 60 * 5000);
System.out.println("Server exiting");
System.exit(0);
}
}
WebServiceImpl 类
@WebService(endpointInterface = "com.nextenders.services.InterfaceWebService",
serviceName = "sample")
public class WebServiceImpl implements InterfaceWebService{
@Override
public boolean doLogin(String username, String password) {
//Here some business logic call
return true;
}
}
现在我正在尝试通过以下网址调用此网络服务:http: //192.168.0.76 :9000/sample/services/doLogin?username=abc&password=abc
但我得到了 wsdl xml 结构。但我只需要特定的方法结果!!。我在这里做错了吗?如何在 CXF 网络服务中传递参数?