uCosminexus Application Server, Web Service Development Guide

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

10.5 Interface transparency

The Web Service and Web Service client have a sparse relationship and their only mutual interface is the defined contents of WSDL. In the Web Service, the interface information (Meta data) of the Web Service is published through WSDL and that Meta data is used in the Web Service client to generate and send and receive SOAP Messages.

When both, the Web Service and Web Service client are running using the Cosminexus JAX-WS engine, only the interface information of the WSDL is exchanged.

Since the Java interface is not permeable, when you develop a Web Service starting from SEI, the method signature in the Web Service and the Web Service client might differ.

This section describes the differences in the method signature on the basis of examples of Java methods before generation and Java methods after generation.

Organization of this section
(1) When the Java method has an array parameter
(2) When the Java method has only one OUT parameter
(3) non-wrapper style arrays

(1) When the Java method has an array parameter

The example assumes that a Web Service is to be developed starting from SEI with the following Java method. This Java method has an array (int type) parameter.

@WebMethod
public void test1( int[] param1 );

The following is a part of the WSDL that is mapped in this case:

...
<types>
 <xsd:schema targetNamespace="http://cosminexus.com/jaxws">
 
 <xs:element name="test1" type="tns:test1"/>
 
 <xs:element name="test1Response" type="tns:test1Response"/>
 
 <xs:complexType name="test1">
 <xs:element name="arg0" type="xs:int" nillable="true"
 minOccurs="0" maxOccurs="unbounded" />
 </xs:complexType>
 
 <xs:complexType name="test1Response">
 <xs:sequence/>
 </xs:complexType>
 </xs:element>
</types>
<message name="test1">
 <part name="parameters" element="tns:test1"/>
</message>
 
<message name="test1Response">
 <part name="parameters" element="tns:test1Response"/>
</message>
 
<portType ...>
 <operation name="test1">
 <input message="tns:test1"/>
 <output message="tns:test1Response"/>
 </operation>
 ...
</portType>
...

The parameter is mapped to the wrapper child element of maxOccurs="unbounded".

If you execute the cjwsimport command by specifying this WSDL, the Java method of the generated service class is as follows:

@WebMethod
public String test1( java.util.List<Integer> arg0 );

The wrapper child element of maxOccurs="unbounded" is mapped to the java.util.List class. Also, in this case, the xsd:int type is mapped to the java.lang.Integer class.

(2) When the Java method has only one OUT parameter

The example assumes that a Web Service is to be developed starting from SEI with the following Java method. This Java method has only one OUT parameter and does not have a return value.

@WebMethod
public void test1( @WebParam(mode=WebParam.Mode.OUT) Holder<String> param1 );

The following is a part of the WSDL that is mapped in this case:

...
<types>
 <xsd:schema targetNamespace="http://cosminexus.com/jaxws">
 
 <xs:element name="test1" type="tns:test1"/>
 
 <xs:element name="test1Response" type="tns:test1Response"/>
 
 <xs:complexType name="test1">
 <xs:sequence/>
 </xs:complexType>
 
 <xs:complexType name="test1Response">
 <xs:sequence>
 <xs:element name="arg0" type="xs:string" minOccurs="0"/>
 </xs:sequence>
 </xs:complexType>
 </xs:element>
</types>
<message name="test1">
 <part name="parameters" element="tns:test1"/>
</message>
 
<message name="test1Response">
 <part name="parameters" element="tns:test1Response"/>
</message>
 
<portType ...>
 <operation name="test1">
 <input message="tns:test1"/>
 <output message="tns:test1Response"/>
 </operation>
 ...
</portType>
...

The OUT parameter is mapped to the wrapper child element referenced from the wsdl:output element.

If you execute the cjwsimport command by specifying this WSDL, the Java method of the generated service class is as follows:

@WebMethod
public String test1();

Since only one wrapper child element is referenced from the wsdl:output element, that wrapper child element is mapped to the return value.

(3) non-wrapper style arrays

This example assumes the development of a Web Service starting from SEI using the following Java method. This Java method has the non-wrapper style and array parameters of the java.lang.String class.

@WebMethod
@javax.jws.soap.SOAPBinding(
  parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.BARE)
public String test1( String[] param1 );

The following is a part of the WSDL that is mapped in this case:

...
<types>
  <xsd:schema targetNamespace="http://jaxb.dev.java.net/array">
    <xsd:complexType name="stringArray" final="#all">
      <xsd:sequence>
        <xsd:element name="item" type="xsd:string" minOccurs="0"
          maxOccurs="unbounded" nillable="true" />
      </xsd:sequence>
    </xsd:complexType>
  </xsd:schema>
 
  <xsd:schema targetNamespace="http://cosminexus.com/jaxws"
    xmlns:ns1="http://jaxb.dev.java.net/array">
    <xsd:element name="test1" nillable="true" type="ns1:stringArray"/>
    <xsd:element name="test1Response" nillable="true" type="xsd:string"/>
  </xsd:schema>
</types>
 
<message name="test1">
  <part name="test1" element="tns:test1" /> 
</message>
 
<message name="test1Response">
  <part name="test1Response" element="tns:test1Response" /> 
</message>
 
<portType ...>
  <operation name="test1">
    <input message="tns:test1" /> 
    <output message="tns:test1Response" /> 
  </operation>
  ...
</portType>
...

The parameter is mapped to the wrapper child element of the {http://jaxb.dev.java.net/array}stringArray type.

When you execute the cjwsimport command by specifying the WSDL, the Java method of the generated service class will change as follows:

@WebMethod
@javax.jws.soap.SOAPBinding(
  parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.BARE)
public String test1(net.java.dev.jaxb.array.StringArray test1);

The wrapper child element of the {http://jaxb.dev.java.net/array}stringArray type is mapped to the net.java.dev.jaxb.array.StringArray class.