In this tutorial you will create a simple Processing Sequence that uses the JSM Binding Script Configuration you just created with the JSM_BINDSCRIPT activity to prepare the JSON response.

This simple Processing Sequence serves to simply test and validate what you have done so far.  You will run the Processing Sequence and verify the results.

  1.  Open LANSA Composer and complete the connection to your LANSA Composer server.  Select Processing Sequences in the Navigator at the left.  Then click the New tool button to create a new Processing Sequence.  The Processing Sequence Editor window will open.
  2. Click the Parameters tab and add one inbound Processing Sequence parameter as shown:
  3. Click the Details tab.  Using either the Palette tab in the left pane or the Insert menu or the context menu, add four ASSIGN directives to your processing sequence.  Select each in turn and complete the Expression (in the Details at the bottom) to assign fixed/test values to the four order header fields as shown (you can use whatever values you choose on the right-hand side of the ASSIGN expression).
  4. Click the Activities tab in the left pane and locate the JSM_BINDSCRIPT activity and drag and drop it to the end of your Processing Sequence.
  5. In the Configurations tab in the left pane, locate the RESPONSETUTORD JSM Binding Script configuration you created in the previous tutorial.
  6. Drag and drop the configuration into the JSMBINDCONFIG parameter of the JSM_BINDSCRIPT activity.
  7. Now add three ASSIGN directives to your processing sequence, immediately after the JSM_BINDSCRIPT activity.  They should be indented one level, indicating that these are directives that will be executed for each "iteration" of the JSMBINDSCRIPT activity.  Select each in turn and complete the Expression (in the Details at the bottom) to assign values to the "identifying" order line fields as shown.
  8. Add SWITCH, CASE, OTHERWISE and ASSIGN directives to the end of your processing sequence, as shown.

    Note the CASE directives are shown red because LANSA Composer expects there to be one or more further directives nested below them.  We will add those directives shortly.

    The assignment &ITERATIONPROCEED = 'NO' under the OTHERWISE directive will tell the JSM_BINDSCRIPT activity that we don't need to perform any further iterations – in other words, we are finished supplying order line details.
  9. Add four ASSIGN directives to your processing sequence, immediately after the first CASE directive.  They should be indented one level relative to the CASE directive, indicating that these directives will be executed when the CASE expression is satisfied.  Select each in turn and complete the Expression (in the Details at the bottom) to assign fixed/test values to the remaining order line fields as shown (you can use whatever values you choose on the right-hand side of the ASSIGN expression).
  10. Repeat step 9, but this time for the second CASE directive.  Use some different values in your ASSIGN expressions – these are the values that will be written for the second order line.
  11. Click the Save tool button.  Then complete saving your Processing Sequence as follows.  Be sure to select Active in the Status dropdown:
  12. Back in the Processing Sequence Editor window, click the Run toolbar button (or use the equivalent File menu command or the Ctrl+U shortcut).
  13. In the Run Processing Sequence window, click Run immediately.  Specify the path where you want your JSON response file to be created and then click the Run button to confirm your request.
  14. When the Processing Sequence run has been completed, you will see the Processing Sequence Log window.  You can now locate the JSON response file that was created and open it with a text editor such as notepad.exe to verify the contents.
  15. Close the Processing Sequence Log and the Processing Sequence Editor windows.

Now continue with the following tutorial:

JSM028 – Putting it all together: Receive the JSON Request and prepare the JSON Response