Search code examples
javaapache-axis

Getting the endpoint URL from an Axis2 generated Stub


I've generated a web service stub using wsdl2java on Axis2 1.5.6 and I'm creating the Stub and injecting it into my code in my Spring context.

I'd like to log the endpoint URL that the stub is using, but I can't seem to find a way to access it.

The closest I can find is: stub._getServiceClient().getServiceContext().getTargetEPR().getAddress()

But that throws a null pointer exception.


Solution

  • I believe this will get you what you want.

    stub._getServiceClient().getOptions().getTo().getAddress();