Axis2是Apache开源的Web Services工具集,可以用来创建和调用SOAP和REST风格的Web Services。使用Axis2调用Web Service的步骤如下:
// 创建服务客户端
MyServiceStub stub = new MyServiceStub();
// 设置调用Web Service的参数
Options options = stub._getServiceClient().getOptions();
options.setTo(new EndpointReference(endpoint)); // Endpoint URL
options.setSoapAction("http://example.org/Action");
options.setUserName(username);
options.setPassword(password);
// 调用Web Service方法
MyServiceStub.SayHelloE sayHello = new MyServiceStub.SayHelloE();
sayHello.setArgument0(name);
MyServiceStub.SayHelloResponseE resp = stub.sayHello(sayHello);
// 处理响应
System.out.println(resp.get_return());
你需要说明白你的这个错误出现在哪个阶段,调用的地址又是什么样的。