Here is an example of Web services mapper definition which
is used by a Web services access operation to invoke Web services.
The Web services function to be invoked asks for one ''String' parameter
and one ''int' parameter. The execution result type is a JavaBean
named com.ibm.btt.wsc.op.test.service.UserAccount.
This section provides three Web services mapper definitions, two input
mappers and one output mapper, to help with the data conversion.
<fmtDef id="inputFmt0">
<wsMapperConverter isPrimitive="false" javaClass="java.lang.String">
<map from="arg0" to="*" byReference="true"/>
</wsMapperConverter>
</fmtDef>
<fmtDef id="inputFmt1">
<wsMapperConverter isPrimitive="true" javaClass="int">
<map from="arg1" to="*" byReference="true"/>
</wsMapperConverter>
</fmtDef>
<fmtDef id="outputFmt">
<wsMapperConverter isPrimitive="false"
javaClass="com.ibm.btt.wsc.op.test.service.UserAccount">
<map from="*" to="return" byReference="true"/>
</wsMapperConverter>
</fmtDef>
Take the code above as an example. There
are several tags and attributes in the Web services mapper definition.
Attributes of the <wsMapperConverter> tag
The
<wsMapperCOnverter> tag is connected with the
com.ibm.btt.base.ws.WSMapperConverter implementation
class, which is the main contributor during the data conversion.
- isPrimitive
- The attribute is mandatory and the value of it must be one of
the followings:
- true: the Java Object in the data conversion is a Java primitive
type (e.g. 'int', 'short', 'double').
- false: the Java Object in the data conversion is not a Java primitive
type (e.g. 'java.lang.String', 'int[]' and JavaBean).
- javaClass
- This is a mandatory attribute. Its value is used to indicate the
actual type of the Java Object in Java Web services during the data
conversion.
Attributes of <map> tag
The <map>
tag is the externalizer definition for the
DataMapperFormat class,
which is used to indicate the source and destination in the data mapping.
Similarly, you can configure the attributes of the <map> tag to
control the data conversion. There is one important rule here: the
structure of the source data should be the same as the one of destination
data. And the topic will be clarified with example in the section
of 'Externalizing WS Mapper'.
- from
- The attribute is mandatory. The value of this attribute indicates
the source data in the mapping process.
- to
- The attribute is mandatory. The value of this attribute indicates
the destination data in the mapping process.
- byReference
- This is an optional attribute. It indicates the Web services mapper
runtime whether to make a copy or just reference the source data to
construct the source data. The value of it must be one of the followings:
- True: the Web services mapper runtime will reference data.
- False: the Web services mapper runtime will make a data copy.