In this tutorial you will create the JSM Binding Script Configuration that uses the LANSA Integrator JSON binding solution that you created in the previous tutorial.  Later we will use the new JSM Binding Script Configuration to prepare the JSON response.

  1. Open LANSA Composer and complete the connection to your LANSA Composer server.  Select JSM binding scripts in the Navigator at the left.  Then click the New toolbutton to create a new JSM Binding Script Configuration.  Complete the new configurations details as shown and then click the Save button (or press Ctrl+S).
  2.  Switch to the Script tab and click the Insert button (or use the context menu) and select JSM command from the menu.  Repeat the insertion six further times, so that you have seven empty JSM command directives.
  3. Select each of the JSM command directives in turn, and in the Details area at the bottom, type (or copy and paste) the next JSM command from the list below:

    SERVICE_LOAD SERVICE(JSONBindFileService)
    BIND SERVICE(RESPONSETUTORDJSON) TYPE(*OUTBOUND)
    BINDTRACE(*YES)
    SET FRAGMENT(TUTORDHRESPONSE)
    SET FRAGMENT(TUTORDLRESPONSE)
    WRITE FILE(&MY_JSON_RESPONSE)
    CLOSE
    SERVICE_UNLOAD


  4. Select the second JSM command (the line containing the BIND SERVICE(…) command).  Then click the Insert button (or use the context menu) and select Receive binding field values from processing sequence variables from the menu.  In the Details area at the bottom, click the Edit Bindings button, and then complete the bindings as shown and click OK:
  5. Select the next JSM command (the line containing the SET FRAGMENT(TUTORDHRESPONSE) command).  Then click the Insert button (or use the context menu) and select Perform iteration from the menu.  In the Details area at the bottom, enter LINES in the LINE LABEL box and WRITE in the ON NIL box
  6. Select the Perform iteration line.  Then click the Insert button (or use the context menu) and select Receive binding field values from processing sequence variables from the menu.  In the Details area at the bottom, click the Edit Bindings button, and then complete the bindings as shown and click OK:
  7. Select the fourth JSM command (the line containing the line containing the SET FRAGMENT(TUTORDLRESPONSE) command).  Then click the Insert button (or use the context menu) and select Branch to label from the menu.  In the Details area at the bottom, enter LINES in the BRANCH TO LABEL box.
  8. Select the WRITE FILE(…) command.  In the Details area at the bottom, (a) type the label WRITE in the Line label edit box, and (b) click (check) the Perform variable substitution? checkbox.
  9. Select each of the two SET FRAGMENT(…) commands in turn, and in the Details area at the bottom, click (check) the Exchange fields checkbox.
  10. If you wish, you can use the Insert button or the context menu to insert some comment lines describing what the script is doing.  When complete, your script should look similar to this:


    Note: Make sure you position the two Receive binding field values from processing sequence variables directives before their respective SET FRAGMENT directives.

    Note: When you look at your JSM binding script (as shown above) you should see asterisks on the lines containing each of the two SET FRAGMENT(…) commands.  The asterisk indicates that the Exchange fields checkbox is checked for that line.  If you do not see that, then go back and check that you have completed step 9 above.



  11. Click the Save button (or press Ctrl+S) to save your changes.

Now continue with the following step:

JSM027 – Test the JSM Binding Script Configuration that prepares the JSON Response

  • No labels