uCosminexus Application Server, Web Service Development Guide

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

10.3.2 Format of cosminexus-jaxws.xml

The following is the format and encoding of cosminexus-jaxws.xml. The operations might not function properly if a format and encoding other than the following are coded:

The following table lists the elements that can be specified in cosminexus-jaxws.xml:

Table 10-3 List of elements in cosminexus-jaxws.xml

Element name Specified number Description
jaxwsdd:endpoints element 1 This is the root element.
 
jaxwsdd:endpoint element 1 or more Specifies the mapping of the URL to the Web Service Implementation Class or the Provider Implementation Class.

The following is a description on each element and attribute:

Organization of this subsection
(1) jaxwsdd:endpoints element (cosminexus-jaxws.xml)
(2) jaxwsdd:endpoint element (cosminexus-jaxws.xml)
(3) Example of settings when cosminexus-jaxws.xml is used

(1) jaxwsdd:endpoints element (cosminexus-jaxws.xml)

The jaxwsdd:endpoints element is the root element of the cosminexus-jaxws.xml. This element does not have attributes.

(2) jaxwsdd:endpoint element (cosminexus-jaxws.xml)

The jaxwsdd:endpoint element codes the mapping between the URL and the Web Service Implementation Class or the Provider Implementation Class. One mapping is coded for one jaxwsdd:endpoint element. If the Web Service has multiple ports (when one Web Service is provided in multiple URLs) and if multiple Web Services exist in the same WAR file, you need to code the number of jaxwsdd:endpoint elements corresponding to the port and Web Service.

The following table lists and describes the attributes for the jaxwsdd:endpoint element:

Table 10-4 List of attributes for the jaxwsdd:endpoint element

No. Attribute name Required Description
1 name Y Specify the name for distinguishing the jaxwsdd:endpoint element.
2 implementation Y Specify the Web Service Implementation Class or the Provider Implementation Class.
3 port N Specify the port associated with the Web Service Implementation Class or the Provider Implementation Class. The settings for this attribute have a higher priority than the settings for the javax.jws.WebService annotation or the javax.xml.ws.WebServiceProvider annotation. Specify this attribute to map one Web Service Implementation Class or a Provider Implementation Class to multiple URLs.
4 url-pattern Y Specify the URL associated with the Web Service Implementation Class or the Provider Implementation Class. Corresponds to the url-pattern element of web.xml.

Legend:
Y: Indicates that the specification is required.
N: Indicates that the specification is not required.

(a) name attribute (cosminexus-jaxws.xml)

Specify the name for distinguishing the jaxwsdd:endpoint element with a string (string that can be handled in Java) that is not a null character string.

If you specify a null character string, the KDJW20031-E message is displayed during deployment. The value must be unique in the same cosminexus-jaxws.xml. If there are multiple jaxwsdd:endpoint elements with the same name attribute value, the KDJW40007-W message is displayed.

(b) implementation attribute (cosminexus-jaxws.xml)

Specify the class name of the class that has the javax.jws.WebService annotation.

If you specify a null character string, the KDJW20031-E message is displayed during deployment. Also, if you specify a non-existent class, the KDJW20014-E message is displayed during deployment.

When you want to map the same Web Service Implementation Class or the Provider Implementation Class for multiple URLs, specify the coding such that the port attribute is unique. Particularly for the Web Service Implementation Class, if the port attribute is not coded or if the port attribute value is not unique, an invalid WSDL is issued as the Meta data.

(c) port attribute (cosminexus-jaxws.xml)

Specify Qname of the port name (the name attribute value of the wsdl:port element) for WSDL issued as Meta data. For issuing the Meta data, see the section 10.6 Issuing the Meta data.

This attribute can be omitted. If the attribute is omitted or if a null character string is specified, the value of the portName attribute of the javax.jws.WebService annotation or the javax.xml.ws.WebServiceProvider annotation for the class specified in the implementation attribute is used. If the portName attribute is omitted, a string with Port added as the suffix to the simple name of the Web Service Implementation Class or the Provider Implementation Class is used according to JSR-181 specifications.

When you want to map the same Web Service Implementation Class for multiple URLs, if the port attribute is not specified, the Meta data is not issued normally.

(d) url-pattern attribute (cosminexus-jaxws.xml)

Specify the path information associated with the Web Service Implementation Class or the Provider Implementation Class specified in the implementation attribute. The discovery is performed on the basis of the value specified in the url-pattern attribute. For the discovery, see the subsection 10.2.2(1) Discovery.

The path information must be a clearly specified value (wild cards such as asterisk cannot be used). Also, the path information must form a one-to-one correspondence with the value of the url-pattern element of web.xml.

For example, if "/path1" is specified in the url-pattern attribute, the class specified in the implementation attribute is mapped for the request to "/path1".

The value must be unique in the same cosminexus-jaxws.xml. If there are multiple jaxwsdd:endpoint elements with the same url-pattern attribute value, the KDJW40009-W message is displayed. In this case, among the jaxwsdd:endpoint elements with the same url-pattern attribute value, only the mapping coded in the first jaxwsdd:endpoint element is enabled.

(3) Example of settings when cosminexus-jaxws.xml is used

The following table describes the coding examples for DD corresponding to the below Web Services:

Table 10-5 Examples of URLs corresponding to the Web Service Implementation Classes

No. Web Service Implementation Classes URL
1 com.sample.AddNumbersImplA /test1
2 com.sample.AddNumbersImplB /test2, /test3

The following is an example of web.xml:

<?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;fromwsdl&quot;</description>
 <display-name>Sample_web_service_fromwsdl</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>/test1</url-pattern>
 <url-pattern>/test2</url-pattern>
 <url-pattern>/test3</url-pattern>
 </servlet-mapping>
</web-app>

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

The following is an example of cosminexus-jaxws.xml:

<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime'>
 <endpoint
 name="test1"
 implementation="com.sample.AddNumbersImplA"
 url-pattern="/test1"
 />
 <endpoint
 name="test2"
 implementation="com.sample.AddNumbersImplB"
 url-pattern="/test2"
 port="{http://sample.com}port1"
 />
 <endpoint
 name="test3"
 implementation="com.sample.AddNumbersImplB"
 url-pattern="/test3"
 port="{http://sample.com}port2"
 />
</endpoints>

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