Start a conversation

How to initialize IPM data elements that are not passed as method parameters

Sometimes it is desirable to initialize IPM data elements without making them Web service method parameters. SOAPam Server provides "initializers" that can be used to set the value of IPM data elements that are not passed as method parameters. The initializers are setup on a per method basis in the Service Definition File. Initializers may be used to initialize any element data type.

The following SDF fragments illustrate the use of initializers. In this example, an initializer is used to set the value of the request_code element of the ipm_get_balance_request IPM, while the account_number element is mapped from the accountNumber parameter.

...

<types>

<type size="14" name="ipm_get_balance_request">
<element size="2" offset="0" type="short" name="request_code">
<element size="12" offset="2" type="unsignedNumeric" name="account_number">
</type>
<type size="10" name="ipm_get_balance_reply">
<element size="2" offset="0" type="short" name="reply_code">
<element scale="4" size="8" offset="2" type="long" name="account_balance">
</type>

</types>

...

<method server="getAccountBalanceServer" name="getAccountBalance2">

<parameters>
<parameter direction="out" type="integer" name="result">
<parameter direction="in" type="unsignedNumeric" name="accountNumber">
<parameter direction="out" type="decimal" name="balance">
</parameter>
<request type="ipm_get_balance_request">
<!-- Initialize the request code value -->
<initializers>
<initializer value="1" element="request_code"/>
</initializers>
<mappings>
<mapping element="account_number" name="accountNumber"/>
</mappings>
</request>
<replies>
<reply replycode="*" type="ipm_get_balance_reply">
<mappings>
<mapping element="reply_code" name="result"/>
<mapping element="account_balance" name="balance"/>
</mappings>
</reply>
</replies>

</method>

 

Choose files or drag and drop files
Was this article helpful?
Yes
No