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.



<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 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">



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

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



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