Dan Dan - 3 months ago 20
Java Question

Java Axis Webservice stub throwing a NoEndPointException

I am consuming a web-service with axis. I am getting a NoEndpointException from any webservice method I call.

It's coming from this generated code.

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


So it seems to suggest I haven't set up the endpoint correctly.

This is how I've instantiated the stubs:

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


I assume something is wrong with this. Do I need to pass in the webservice address? It already appears to be integrated into the stubs.

Answer

It might depends on Axis version (I'm using version 1.4) but I suggest you to use the getYourPortType() method from the locator. You won't have to give your webservice URL (as it is stored in the generated files).

Using your sample it would be something like that:

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