uCosminexus Application Server, Application Development Guide

[Contents][Glossary][Index][Back][Next]

8.3.5 Editing web.xml

When developing a POJO Web service, to deploy Web Services, add the settings for operating as a Web Service in web.xml. When developing an EJB Web service, you need not edit web.xml.

The following table describes the elements to be added and the values to be specified:

Table 8-2 Elements added and values specified in web.xml

Element names in web.xml Specified value
web-app --
 
listener --
 
listener-class com.cosminexus.xml.ws.transport.http.servlet.WSServletContextListener
servlet --
 
servlet-name WSServlet
servlet-class com.cosminexus.xml.ws.transport.http.servlet.WSServlet
load-on-startup 1
servlet-mapping --
 
servlet-name WSServlet
url-pattern Mapped URL#

Legend:
--: No value is specified.

#
The specified value differs depending on whether the serviceName attribute is coded in the WebService annotation of the Web Service implementation class.
  • When the serviceName attribute is coded
    Specify "/" + serviceName-attribute-value ("/" + serviceName-attribute-value indicates that a forward slash (/) is added at the beginning of the serviceName attribute value).
  • When the serviceName attribute is not coded
    Specify "/" + simple-name-of-Web-Service-implementation-class + Service ("/" + simple-name-of-Web-Service-implementation-class + Service indicates that a forward slash (/) is added at the beginning and Service is added at the end of the simple name of the Web Service implementation class).
 

An example of specification is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
   xmlns="http://java.sun.com/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
 
 <listener>
  <listener-class>com.cosminexus.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
 </listener>
 
 <servlet>
  <servlet-name>WSServlet</servlet-name>
  <servlet-class>com.cosminexus.xml.ws.transport.http.servlet.WSServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
 </servlet>
 
 <servlet-mapping>
  <servlet-name>WSServlet</servlet-name>
  <url-pattern>/TestJaxWsService</url-pattern>
 </servlet-mapping>
 
</web-app>

For details on editing web.xml, see 3.4 Creating web.xml in the manual uCosminexus Application Server Web Service Development Guide.