Why am I getting the following error when I execute my web service client?
Exception in thread "main" javax.xml.ws.WebServiceException: Failed to access
the WSDL at:
http://localhost:9090/SimpleWebServicePort?wsdl.
.....
Caused by: java.io.FileNotFoundException:
http://localhost:9090/SimpleWebServicePort?wsdl
The following are several questions related to supporting data for the above
error:
1) Why is WSDL location generated with port 9090?
2) Why are namespaces generated in the reverse order of my Java package?
3) Why is the WSDL location in the @WebServiceClient annotation generated with
the port
for the WSDL when the WSDL is clearly called simplewebservice.wsdl as can be
seen
from the Tomcat log extract?
*** ENVIRONMENT ***
Java JDK 1.6.0_20
Java EE 6
CXF 2.3.0
Tomcat 6.0
Eclipse Helios (with WTP which includes CXF plug-ins and facets)
Windows XP
*** WSDL GENERATED FROM MY JAVA FIRST CODE BY CXF USING ECLIPSE HELIOS ***
<wsdl:service name="SimpleWebServiceService">
<wsdl:port name="SimpleWebServicePort"
binding="tns:SimpleWebServiceServiceSoapBinding">
<soap:address location="http://localhost:9090/SimpleWebServicePort"/>
</wsdl:port>
</wsdl:service>
*** EXTRACT FROM TOMCAT CATALINA LOG ***
Jan 1, 2011 9:04:39 AM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service {http://ws.simple.org/}SimpleWebServiceService from WSDL:
wsdl/simplewebservice.wsdl
*** MY ENTIRE CLIENT CODE ***
public class SimpleWebService_SimpleWebServicePort_Client
{
public static void main(String args[]) throws Exception
{
SimpleWebServiceService swss = new SimpleWebServiceService( );
SimpleWebService sws = swss.getSimpleWebServicePort( );
System.out.println( sws.sayHello( ) );
}
}
*** EXTRACT OF CLASS CREATED BY GENERATING CLIENT FROM WSDL ***
@WebServiceClient(name = "SimpleWebServiceService",
wsdlLocation =
"http://localhost:9090/SimpleWebServicePort?wsdl",
targetNamespace = "http://ws.simple.org/")
public class SimpleWebServiceService extends Service
{
public final static URL WSDL_LOCATION;
public final static QName SERVICE = new QName("http://ws.simple.org/",
"SimpleWebServiceService");
public final static QName SimpleWebServicePort = new
QName("http://ws.simple.org/", "SimpleWebServicePort");
static
{
URL url = null;
try
{
url = new URL("http://localhost:9090/SimpleWebServicePort?wsdl");
}
catch (MalformedURLException e)
{
System.err.println("Can not initialize the default wsdl from
http://localhost:9090/SimpleWebServicePort?wsdl");
// e.printStackTrace();
}
WSDL_LOCATION = url;
}