Popular Posts

Monday, June 30, 2008

How to avoid "Unable to generate EPR for transport" error in Axis2

"Unable to generate EPR for transport: http" is a FAQ in Axis2 mailing list. You may have experienced this when invoking a service using generated stubs.

Solution:

It's really simple. When creating the instance of stub, pass the actual service end point (epr) to the constructor as follows.

YourserviceStub stub = new YourserviceStub("http://<IP>:<PORT>/axis2/services/YourService")


Ideally when u generate a stub for a service it will pick up the Endpoint reference from the WSDL. So just instantiating stub with YourserviceStub stub = new YourserviceStub() could send the request to the address defined in the WSDL. In case you get the "Unable to generate EPR for transport: http" error, give a try with the above as well.

2 comments:

hafez.ha said...

Hi Charitha,

Your solution suggests this error message appears only when a client is calling a webservice. However, I get this error when generating the webservice using the maven plugin tool java2wsdl (for Spring/Axis2).

Any thoughts?

Salim said...

saved me hours of frustration! Thanks for the tip.