I've made some progress on my original question(see thread below), that is the
question relating to why my client code was failing to access the WSDL. I
tried several variations of changes to the soap:address location element of the
WSDL and come up with the correct URL, verified by trying to access the WSDL on
Tomcat from my browser, which I was able to do.
First I would still like someone to answer the other questions I posted, if
possible.
Also, now I getting the following error when I execute my client code:
Exception in thread "main" javax.xml.ws.WebServiceException: No Content-type in
the header!
at
com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(Unknown
Source)
at
com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(Unknown
Source)
at
com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(Unknown
Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Unknown Source)
at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Unknown Source)
at com.sun.xml.internal.ws.client.Stub.process(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown
Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown
Source)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)
at $Proxy28.sayHello(Unknown Source)
at org.simple.ws.Client.main(Client.java:9)
Can someone help out with this?
Thanks!!!
----- Original Message -----
From: Michael
To: [email protected]
Sent: Saturday, January 01, 2011 10:26 AM
Subject: Problem executing my CXF client
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;
}