Edit

"Calculator" in in HTML

At this point we have a business process that activates a SOA module that can be used as a webservice and to generate input to a HTML page. But data has only been running one way - out to the front-end. Now we want to send data from the fromt-end to the SOA module. In this example we use a browser.
!Note this could have been from a webservice as easily.

We want 2 simple fields you can input a number into and we will add them together, the simplest calculator ever... but it will show you how easy it is.

So we create a simple HTML page on the webserver to use for this. Here you can see the simple HTML page we will use in this example 3.


HTML sourcecode
<html> 

<head>
</head>
<body>
<form method="POST" action="i2w.aspx" name="form0">
Value A = [[valuea]]
Value B = [[valueb]]
Result(a+b) = [[result]]
[[update]]
</form>
</body>
</html>

Only difference from the previous example, is:
  1. That now we have 3 fields valuea, valueb, result
  2. A form tag incapsulating the fields. This is the way we tell the browser to send the fields to the server. (standard html) the server page that recives the information is called i2w.aspx (all communication goes through this page, it's the main iSeries2web page)
  3. A "update" button (it looks like a field tag in the HTML)

To see the html page click here (remember that you only see the "fields" as the other html tags is interped by the browser)



The program

 *************** Beginning of data *************************************  

0001.00 h/COPY QI2W,LATEST_H
0002.00 d/COPY QI2W,LATEST_D
0003.00 *****************************************************************
0004.00 d wk_value_a s 5p 0
0005.00 d wk_value_b s 5p 0
0006.00 d wk_result s 11p 0
0007.00 *****************************************************************
0008.00 /free
0009.00 wk_value_a = rtvvarN('valuea');
0010.00 wk_value_b = rtvvarN('valueb');
0011.00 wk_result = wk_value_a + wk_value_b;
0012.00 // Generate the XML with the result.
0013.00 PutXmlRcd('dsoData':''
0014.00 +xmlSN('valuea':wk_value_a)
0015.00 +xmlSN('valueb':wk_value_b)
0016.00 +xmlSN('result':wk_result)
0017.00 +xmlB('update':'submit')
0018.00 );
0019.00 Return;
****************** End of data ****************************************

Now the only thing we need to do (this has been done for you) is to let the "service bus" know the name of the HTML page, and that we want to execute the program and then the htmlpage, in that order (this is called a business process)

To test the business process, and show the outcome in the "result frame" click here. It will show our little calculator. Have a go at it, putting in numbers in the fields and press the update button.

When you press the button the system sends the 2 input fields to the program. It is recived, added and sendt back in a xml document. The front-end merges the HTML with the XML data at creates the page you will see.





Edit

This Next class

Now lets try to create som SOA modules and use them in different combinations, using BPM programs.
Go to Class 4 - Hello BPM