Servlet and Web Services

Source: Internet
Author: User

Servlet plays a major role in web services. It is responsible for parsing soap files (message and attachment encapsulation) and verifying soap messages using wsdl. As a basic programming method, servlet can be used to parse soap messages, especially for soap messages with attachments. This is transparent, but servlet cannot be used as a Web service, of course, JAXM can be expanded. Currently, all the projects that support web services implement servlet functions at the underlying layer to complete HTTP + SOAP communication, there is no need for programmers to consider the communication process of HTTP-based SOAP messages (do not misunderstand that the Service Program for HTTP Communication on the java platform is servlet/jsp, but now you don't need servlet to communicate with jsp, isn't it a conflict? There is no conflict with the facts. Remember that the underlying layer has implemented the servlet function, and the specific communication has been managed by itself.) Service programming is directly promoted to the business logic. Of course, sometimes you can write a servlet to parse SOAP messages, which is just SOAP communication (servlet cannot be described as a service ).
The following describes the relationship between the underlying layer and web services Based on the configuration file:
Review the servlet ing mode. As we know, servlets are inherited from javax. servlet. http. HttpServlet, loaded to the JVM on the server side for execution, and then output the html stream to the client.
Servlet's web. xml file (located in the webapps/foo/WEB-INF directory ):
<? Xml version = "1.0" encoding = "UTF-8"?>
<! DOCTYPE web-app PUBLIC "-// Sun Microsystems, Inc. // DTD Web Application 2.2 // EN"
Http://java.sun.com/j2ee/dtds/web-app_2.2.dtd>
<Web-app>
<Servlet-mapping>
<Servlet-name> invoker </servlet-name>
<Url-pattern>/servlet/* </url-pattern>
</Servlet-mapping>
</Web-app>
Invoker servlet is actually: org. apache. catalina. servlets. InvokerServlet
Provides small service programs by class name. For example, if you call foo/servlet/HelloServlet,
Invoker servlet will load the HelloServlet (if it is in its class path) and execute it.
Looking at the web. xml above, it seems that only one servlet ing is provided, and no invoker servlet is defined.
In fact, invoker servlet is defined in web. xml in the conf directory of tomcat ::

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.