代码之家  ›  专栏  ›  技术社区  ›  Dan TheCodeJunkie

Java Axis Web服务存根引发NoEndPointException

  •  5
  • Dan TheCodeJunkie  · 技术社区  · 16 年前

    我正在使用axis的web服务。我正在从我调用的任何webservice方法中获取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 回复  |  直到 10 年前
        1
  •  7
  •   Guillaume    16 年前

    这可能取决于Axis版本(我使用的是1.4版),但我建议您使用定位器中的getYourPortType()方法。您不必给出您的webservice URL(因为它存储在生成的文件中)。

    使用您的示例,它将类似于:

    MyService_ServiceLocator myService_ServiceLocator = new MyService_ServiceLocator();
    MyService_PortType webservice = myService_ServiceLocator.getMyService_PortType();
    
    推荐文章