Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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).
    Image Modified
  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:

...


  1. SERVICE_LOAD

...

  1. SERVICE(JSONBindFileService)

...


  1. BIND

...

  1. SERVICE(RESPONSETUTORDJSON)

...

  1. TYPE(*OUTBOUND)

...


  1. BINDTRACE(*YES)

...


  1. SET

...

  1. FRAGMENT(TUTORDHRESPONSE)

...


  1. SET

...

  1. FRAGMENT(TUTORDLRESPONSE)

...


  1. WRITE

...

  1. FILE(&MY_JSON_RESPONSE)

...


  1. CLOSE

...


  1. SERVICE_UNLOAD


  2. 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:
    Image Modified
  3. 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
    Image Modified
  4. 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:
    Image Modified
  5. 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.
    Image Modified
  6. 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.
    Image Modified
  7. Select each of the two SET FRAGMENT(…) commands in turn, and in the Details area at the bottom, click (check) the Exchange fields checkbox.
    Image Modified
  8. 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:
    Image Modified

...


  1. Note

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

...

  1. Note

    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.



  2. 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