Question

I am using Apache Axis to connect my Java app to a web server. I used wsdl2java to create the stubs for me, but when I try to use the stubs, I get the following exception:

org.apache.axis.ConfigurationException: No service named <web service name> is available

any idea?

Was it helpful?

Solution

Just a guess, but it looks like that error message is reporting that you've left the service name blank. I imagine the code that generates that error message looks like this:

throw new ConfigurationException("No service named" + serviceName + " is available");

OTHER TIPS

According to the documentation linked to by @arnonym, this exception is somewhat misleading. In the first attempt to find the service a ConfigurationException is thrown and caught. It is logged at DEBUG level by the ConfigurationException class. Then another attempt is made using a different method to find the service that may then succeed. The workaround for this is to just change the log level on the ConfigurationException class to INFO in your log4j.properties:

log4j.logger.org.apache.axis.ConfigurationException = INFO

It is an exception used by Axis' control flow.

http://wiki.apache.org/ws/FrontPage/Axis/DealingWithCommonExceptions --> org.apache.axis.ConfigurationException: No service named XXX is available

This is what my code looks like. It seems to work fine. Are you using a service locator or just creating your service?

SomeServiceLocator locator = new SomeServiceLocator();
SomeService service = null;
try
{
    service = locator.getSomeServiceImplPort();
}
catch (ServiceException e)
{
    e.printStackTrace();
}

I don't know what version of Axis you're using but I'm using Axis2 for both server and client and the Java2WSDL create a default endpoint for the service on localhost. If you create the client stub with WSDL2Java, the default constructor of the stub will then point to localhost. If the service is on other endpoint you must use the constructor with the endpoint as parameter... Maybe the problem is not that at all but as said on other answers, without the WSDL you're using as WSDL2Java input it's hard to say.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top