On Sunday 02 January 2011 7:57:15 am Michael wrote: > 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:
Uhh... this isn't using CXF on the client side. This is using the JAX-WS stack built into the JDK. Make sure the CXF jars are there. 1) Why is WSDL location generated with port 9090? I think that is just a default that is in the wsdl generator.. The java2ws command line tool has a "-address" flag that can be used to specify what gets output, but the Eclipse tooling may not allow setting that. > 2) Why are namespaces generated in the reverse order of my Java package? This algorithm is dictated by the JAX-WS and JAXB specs. > 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? Again, it depends on how Eclipse is passing the wsdl location to the tools. If it's being called with the URL of the running service, it would be the http://..... URL (with ?wsdl). If it's calling it with the file off the filesystem, it would likely be some sort of "file:/" URL. The command line tool does have a "-wsdlLocation" flag to allow setting the value that is stuck in the annotation. Again, I'm not sure what the Eclipse tools are setting. Dan > 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(Un > known Source) at > com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processReq > uest(Unknown Source) at > com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(Unk > nown 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; > } -- Daniel Kulp [email protected] http://dankulp.com/blog
