• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can service class be accessed directly?

 
Jim Wang
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using Axis' wsdl2java to develop my web service package. After deployment, the service works fine. According to Axis' instruction, the url to access this service must be: http://[host]:[port]/[context]/services/[service-name]. In web.xml, /services/* is mapping to AxisServlet. Since the service class has been loaded into web container, can I make the mapping directly to service class instead of mapping to AxisServlet? I tried, but it gives me error when I call the service. The error is: [500]Internal server error. On the Tomcat console, the message is "Marking servlet <servlet-name> as unavailable."
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A web service request is an HTTP request, so it must be addressed to a servlet that can handle it. The Axis servlet does all kinds of stuff that you'd need to do as well in any servlet you put in place. What exactly is the rationale for not wanting to use the AxisServlet?
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ulf Dittmer:
What exactly is the rationale for not wanting to use the AxisServlet?


I don't think that is the issue. I think this is about total control of the request URL. In a "Servlet-per-Web Service" implementation you should have control the entire url-pattern through the <servlet-mapping> in the descriptor. If I am correct, all axis web services have to go through the AxisServlet, so during deployment the web service servlet path of [context]/services is mapped to the the AxisServlet while the [service-name] path info is used by the servlet to route the request to the proper service class.

So ultimately it becomes an issue of setting the a <servlet-mapping><url-pattern> of [context] directly to the AxisServlet if you have a request URL of [context]/[service-name] (rather than mapping the URL directly to the service class which obviously cannot work).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!