uCosminexus Application Server, Web Service Development Guide

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

16.1.5 Mapping the parameter and return value to the message part (For wrapper style)

This subsection describes the mapping of parameters of method of SEI to WSDL (name attribute of the wsdl:part element).

This subsection describes the mapping for the wrapper style.

Organization of this subsection
(1) Mapping
(2) Java types that can be specified in the parameters
(3) Conditions for Java method parameters
(4) Combinations of parameters and return values
(5) Operations during name conflict
(6) Using the java.util.Map class

(1) Mapping

For the wrapper style, the name of the method of SEI and a request bean with the same name as the name of the method of SEI will be generated. A response bean with the suffix 'Response' added to it will also be generated. The request and response beans can either be generated automatically by using the apt command or cjwsgen command, or you can dynamically generate them when starting Web Services. When dynamically generating the request and response beans, for a preliminary error check, you can execute the cjwsgen command for the compiled Web Services Implementation Class to avoid the occurrence of an error while starting Web Services. For details, see 10.23(1) Using the cjwsgen command for checking errors.

The following figure shows an example of mapping the method parameters to the message parts.

Figure 16-4 Example of mapping the method parameters to the message parts (Wrapper style)

[Figure]

The following figure shows an example of mapping the method return values to the message parts:

Figure 16-5 Example of mapping the method return values to the message parts (Wrapper style)

[Figure]

The following are the rules for mapping the method parameters and return values to the message parts:

#
N in argN indicates 0 or a higher integer that depends on the order of the parameters.

For details on the javax.xml.bind.annotation.XmlElement annotation, see 16.2.10 javax.xml.bind.annotation.XmlElement annotation.

(2) Java types that can be specified in the parameters

This point describes the conditions and precautions for specifying a Java type other than the Holder(javax.xml.ws.Holder) type and Holder type.

(a) Java type other than Holder type
(b) javax.xml.ws.Holder type

The precautions for specifying the javax.xml.ws.Holder type are as follows:

(c) Java type mapping

The precautions for mapping the Java types are as follows:

(3) Conditions for Java method parameters

The parameter names of the Java methods are not mapped to WSDL; therefore, code the Java method parameters in accordance with the Java identifier naming rules provided in the Java language specifications.

(4) Combinations of parameters and return values

You can combine and code the in parameter, inout parameter, out parameter, and the return value that you want.

(5) Operations during name conflict

This point describes the rules about the wrapper bean class name and global element name and the operations for a name conflict.

(6) Using the java.util.Map class

When you use the java.util.Map class in the SEI argument or return value, the following operations must be performed for the argument or return value of the java.util.Map type of SEI:

  1. Create a value type.
    Create the value type (a JavaBean class that can be marshaled or un-marshalled) for java.util.Map(bound type) in accordance with the JAXB 2.2 specifications.
  2. Create an adapter.
    Create an adapter that interconverts the java.util.Map(bound type) that inherits javax.xml.bind.annotation.adapters.XmlAdapter and the value type, and implement the unmarshal method and marshal method.
  3. Annotate with the javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter annotation.
    Annotate the argument or return value of the java.util.Map type with the XmlJavaTypeAdapter annotation that has the adapter created in 2 as the value.
  4. Execute the apt command.
    Interpret the annotated SEI with the apt command.
    The following is an example of the relationship and implementation of the request bean class and response bean class in which the xmlJavaTypeAdapter annotation is applied through the value type, adapter, and the apt command:

    Figure 16-6 Example of using java.util.Map

    [Figure]