uCosminexus Application Server, Web Service Development Guide

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

31.3.2 Compiling Web Services Implementation Classes

Execute the javac command to compile Web Services Implementation Class. Include the Web Service implementation class during compilation. For details on the javac command, see the JDK documentation.

The following example describes the execution of the javac command:

> cd c:\temp\jaxws\works\mtom\server\
> mkdir WEB-INF\classes\
> javac -cp
"%COSMINEXUS_HOME%\jaxws\lib\cjjaxws.jar;%COSMINEXUS_HOME%\CC\client\lib\j2ee-javax.jar;%COSMINEXUS_HOME%\CC\client\lib\HiEJBClientStatic.jar;%COSMINEXUS_HOME%\jaxp\lib\csmjaxb.jar;%COSMINEXUS_HOME%\jaxp\lib\csmjaxp.jar;%COSMINEXUS_HOME%\jaxp\lib\csmstax.jar" -d WEB-INF\classes\ -s src src\com\sample\UserInfoImpl.java src\com\sample\UserData.java src\com\sample\UserInfoException.java

On successful execution of the javac command, the compiled classes are output to the following path: c:\temp\jaxws\works\mtom\server\WEB-INF\classes\com\sample\Directory

You can execute the cjwsgen command for the compiled Web Services Implementation Classes to check errors in advance. For details on the cjwsgen command, see 10.23(1) Using the cjwsgen command for checking errors. Creating web.xml

Create a web.xml file that is required as a WAR file component.

The following is an example for creating a web.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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_3.0.xsd">
  <description>Sample Web Service &quot;mtom_dynamic_generate &quot;</description>
  <display-name>Sample_web_service_mtom_dynamic_generate </display-name>
  <listener>
    <listener-class>
      com.cosminexus.xml.ws.transport.http.servlet.WSServletContextListener
    </listener-class>
  </listener>
  <servlet>
    <description>Endpoint servlet for Cosminexus JAX-WS</description>
    <display-name>Endpoint_servlet_for_Cosminexus_JAX_WS</display-name>
    <servlet-name>CosminexusJaxwsServlet</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>CosminexusJaxwsServlet</servlet-name>
    <url-pattern>/UserInfoService</url-pattern>
  </servlet-mapping>
  <session-config>
    <session-timeout>60</session-timeout>
  </session-config>
</web-app>

When creating web.xml of version 2.5, specify 2.5 in the version attribute of the web-app element and specify http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd as the second location information in the xsd:schemaLocation attribute.

The created web.xml is stored in the c:\temp\jaxws\works\mtom\server\WEB-INF\ directory in UTF-8 format. For the web.xml settings, see 3.4 Creating web.xml.