I'm quite new to the webservices world and try to create my first JAX-WS webservice. I've documented all the steps that I've done:
I think that my Service Provider works correctly, because I can succesfull test it over the Glassfish Console (slide 11). When I run my service client (slide 17) then I get an UnsupportedMediaException:
I've looked at several places, but I'm not able to figure out how I can solve this problem. Any ideas?
I would suspect that instead of accessing the web service, your client accesses a web page - thus the text/html content type.
To determine if this is indeed the case, use a packet sniffer like Wireshark or the TCP monitor that is built-into Eclipse to look at the data passed between the client and the web service.
Nicely written notes, by the way! :-)
thank you for your answer. Your idea with accessing a webpage is comprehensible, but after tracing the request with the "TCP/IP Monitor" view it seams obvious that my client tries to access the wsdl-file. Here is the header of my client-request:
GET /HelloWorldServiceProvider/HelloWorldService/HelloWorldImplService.wsdl HTTP/1.1
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
My server then responds with the wsdl-file:
HTTP/1.1 200 OK
Server: Sun GlassFish Enterprise Server v2.1
Last-Modified: Sat, 13 Mar 2010 14:19:55 GMT
Content-Type: text/html; charset=iso-8859-1
Date: Mon, 15 Mar 2010 18:58:50 GMT
And then my Java-Client throws the lower exception.
I'm asking my self why my client tries to access the wsdl on not the service?
By the way, Ivan I'm happy for the feedback of my slides. I'll try to continue working on this "brain-friendly" stuff. I've also read nearly the half of your study guide. It is a huge help. Thank you for this.
It is normal that the client accesses the WSDL. What is not normal is that the content type of the WSDL is text/html.
I just checked with a web service I have deployed to GlassFish and, using Firefox, retrieved the WSDL while monitoring with Wireshark.
The content type of the WSDL I retrieved is text/xml.
I need to take a closer look at how you develop your web service and then get back to you.
I know what the cause of your problem is.
You generate a WSDL file that you store in the HelloWorldService directory in the web contents directory. This way you are making the WSDL accessible as a web resource, which cause the type to be text/html.
If a web service has any WSDL file(s), then the WSDL files must be placed in the WEB-INF/wsdl directory.
Since you already have my SCDJWS Study notes, please refer to section 4.7 for an example on how to create a web service with a generated WSDL.
In your case, I would not recommend generating a WSDL yourself - this is taken care of by GlassFish when you deploy the web service.
thank you very much for this tremendous support . I've tried out your suggestions and so I've made a few changes to my existing application:
In the next days I'll update my slides and try to continue working on this stuff.
With best regards, Christian