Java Axis Webservice存根抛出NoEndPointException异常

5

我正在使用Axis消费一个Web服务。当我调用任何Web服务方法时,都会收到NoEndpointException异常。

这个异常是由生成的代码引起的。

if (super.cachedEndpoint == null) {
    throw new org.apache.axis.NoEndPointException();
}

看起来我没有正确设置端点。

这是我实例化存根的方式:

MyService_ServiceLocator myService_ServiceLocator = new MyService_ServiceLocator();
MyService_PortType webservice = new MYServiceSOAPStub(myService_ServiceLocator);

我猜这里有些问题。我需要传入 Web 服务地址吗?它似乎已经集成到存根中了。

1个回答

7

可能取决于Axis版本(我正在使用1.4版本),但我建议您使用定位器中的getYourPortType()方法。您不必提供Web服务URL(因为它存储在生成的文件中)。

使用您的示例,代码应该类似于:

MyService_ServiceLocator myService_ServiceLocator = new MyService_ServiceLocator();
MyService_PortType webservice = myService_ServiceLocator.getMyService_PortType();

1
创建了WSDL文件后,有没有关于如何访问任何Web服务的教程? - Himanshu.MarJAVA

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接