aspose file tools*
The moose likes Web Services and the fly likes JAX WS servlet end point Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAX WS servlet end point" Watch "JAX WS servlet end point" New topic
Author

JAX WS servlet end point

Jobin Mathew
Ranch Hand

Joined: Oct 17, 2006
Posts: 83
I tried deploying JAX Ws Servlet webservice in tomcat. If i give servlet class as <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class> , i am getting the wsdl when i hit the URL.
But if i give my implementation class as servlet class it is not showing the wsdl.
<servlet-class>test.myService</servlet-class>

the following is my web.xml file.

<servlet>
<description>JAX-WS endpoint - fromjava</description>
<display-name>hello</display-name>
<servlet-name>hello</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>



<servlet>
<description>JAX-WS endpoint - fromjava</description>
<display-name>helloRPC</display-name>
<servlet-name>hello2</servlet-name>
<servlet-class>test.myService</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>


<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/HelloService</url-pattern>
</servlet-mapping>


<servlet-mapping>
<servlet-name>hello2</servlet-name>
<url-pattern>/HelloService2</url-pattern>
</servlet-mapping>
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Isn't the servlet deployment descriptor generated by the container when deploying the web service?
Best wishes!
Jobin Mathew
Ranch Hand

Joined: Oct 17, 2006
Posts: 83
I already created web.xml and sun-jaxws.xml. Are you talking about server-config.wsdd?
Everything is fine if i give <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41466
    
  51
Are you developing a servlet or a web service? If the latter, then it should be listed in the sun-jaxws.xml file, not the web.xml file. In the web.xml file you need just the WSServlet declaration (and the WSServletContextListener listener).


Ping & DNS - my free Android networking tools app
Jobin Mathew
Ranch Hand

Joined: Oct 17, 2006
Posts: 83
I removed the entry from web.xml, but still i am getting 'resource not available' when i tried to see the wsdl.
Please find the attachments.


[Thumbnail for jaxws.JPG]

[Thumbnail for jaxws conf files.JPG]

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41466
    
  51
Not sure what's going on, you might want to compare your setup with the one described in http://www.coderanch.com/t/223670/Web-Services/java/Deploy-JAXWS-Mustang-WS-Tomcat
Jobin Mathew
Ranch Hand

Joined: Oct 17, 2006
Posts: 83
In that post also, the servlet class is given as

<servlet-class>
com.sun.xml.ws.transport.http.servlet.WSServlet
</servlet-class>


But in some tutorials they listed only the implementation class here.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Specifying the endpoint implementation class that not is associated with an EJB is, according to the JSR-109 specification, allowed.
This would be a so-called servlet-based web service.

I recall that, when playing around with deployment descriptors when deploying a web service, if I had a web.xml deployment descriptor, then I also needed a webservices.xml deployment descriptor.
For details, see page 263- in my document that can be found here: http://www.javaforum.se/jforum/posts/list/549.page
Best wishes!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41466
    
  51
I recall that, when playing around with deployment descriptors when deploying a web service, if I had a web.xml deployment descriptor, then I also needed a webservices.xml deployment descriptor.

I don't think that applies here - it's a "JAX-WS RI in Tomcat" scenario, where no webservices.xml file is involved.
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
Jobin Mathew wrote:I removed the entry from web.xml, but still i am getting 'resource not available' when i tried to see the wsdl.

The listing of HelloService2 is visible because it is defined in sun-jaxws.xml file but WSDL is inaccessible as there is no Servlet configured in web.xml to handle the /HelloService2 URL.


My Blog
Jobin Mathew
Ranch Hand

Joined: Oct 17, 2006
Posts: 83
"The listing of HelloService2 is visible because it is defined in sun-jaxws.xml file but WSDL is inaccessible as there is no Servlet configured in web.xml to handle the /HelloService2 URL"

I agreed with this. But how can i see the wsdl here? In many examples i can see the servlet class is gievn as the implementation class instead of <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>. But I can see WSDL only if i give servlet class as com.sun.xml.ws.transport.http.servlet.WSServlet


http://java.sun.com/blueprints/guidelines/designing_webservices/html/architecture5.html#1127196
http://www.lalitbhatt.com/tiki-index.php?page=JAX-WS%20Servlet%20Endpoint
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
Jobin Mathew wrote:I agreed with this. But how can i see the wsdl here?

Just uncomment the servlet mapping part for the HelloService2 in web.xml, you should be able to see the WSDL.
Jobin Mathew
Ranch Hand

Joined: Oct 17, 2006
Posts: 83
In that case also it is giving "The requested resource (Servlet hello2 is not available) is not available."
But I can see the WSDL only if i give servlet class as <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
Jobin Mathew
Ranch Hand

Joined: Oct 17, 2006
Posts: 83
If am adding my servlet service in web.xml, the servlet class should be WSServlet or my own servlet class?
From my experience only WSServlet is working properly. Is this correct?

<servlet-class>
com.sun.xml.ws.transport.http.servlet.WSServlet
</servlet-class>
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
Jobin Mathew wrote:If am adding my servlet service in web.xml, the servlet class should be WSServlet or my own servlet class?
From my experience only WSServlet is working properly. Is this correct?

<servlet-class>
com.sun.xml.ws.transport.http.servlet.WSServlet
</servlet-class>

Yes, this is the right configuration.

Thanks,
Vinod
Jobin Mathew
Ranch Hand

Joined: Oct 17, 2006
Posts: 83
Thanks Vinod.

So, for all the webservices i need to give the same servlet class as "com.sun.xml.ws.transport.http.servlet.WSServlet", right?
and there is no need of giving my own servlet class in web.xml?
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
Jobin Mathew wrote:So, for all the webservices i need to give the same servlet class as "com.sun.xml.ws.transport.http.servlet.WSServlet", right?

Yes, one Servlet can serve multiple URL patterns.
Jobin Mathew wrote:and there is no need of giving my own servlet class in web.xml?

Yes, unless there is a good reason to extend the WSServlet.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAX WS servlet end point