This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAX WS servlet end point

 
Jobin Mathew
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Isn't the servlet deployment descriptor generated by the container when deploying the web service?
Best wishes!
 
Jobin Mathew
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Jobin Mathew
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
jaxws.JPG
[Thumbnail for jaxws.JPG]
jaxws conf files.JPG
[Thumbnail for jaxws conf files.JPG]
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jobin Mathew
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic