Documentation

Trace:

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
jvx:communication:calling_server_action [2018/01/31 21:25]
admin
jvx:communication:calling_server_action [2020/07/08 17:46] (current)
cduncan articles
Line 1: Line 1:
 ~~Title: Calling a Server Action~~ ~~Title: Calling a Server Action~~
  
-A server action is a method/​function that is defined in a lifecycle ​object at the server. Execution is initiated either by the client or directly at the server.+A server action is a method/​function that is defined in a life cycle object at the server. Execution is initiated either by the client or directly at the server.
  
 In short, it is any method at the business level of the application. In short, it is any method at the business level of the application.
  
-Server ​Actions ​are used for functions that are not/should not be executed at the client, including business logic such as mail transmission,​ interface requests, calculations,​ etc.+Server ​actions ​are used for functions that are not/should not be executed at the client, including business logic such as mail transmission,​ interface requests, calculations,​ etc.
  
 ==Example== ==Example==
Line 11: Line 11:
 We want to develop an application that manages purchase orders. These orders are provided by SAP via a web services interface and shown in a separate form in our application. In addition, cancellation of individual orders via SAP web services should be possible. We want to develop an application that manages purchase orders. These orders are provided by SAP via a web services interface and shown in a separate form in our application. In addition, cancellation of individual orders via SAP web services should be possible.
  
-Cancellations are initiated by the Client ​via a button. The order number, as well as a PIN/​confirmation code, are required for execution.+Cancellations are initiated by the client ​via a button. The order number, as well as a PIN/​confirmation code, are required for execution.
  
-We'll show snippets of client and server-side implementation.+We'll show snippets of clientand server-side implementation.
  
 <file java> <file java>
Line 41: Line 41:
     rdbOrder.open();​     rdbOrder.open();​
  
-    UIButton butStorno = new UIButton("​Storno"); +    UIButton butStorno = new UIButton("​Cancel"); 
-    ​butStorno.eventAction().addListener(this,​ "doStorno");+    ​butCancel.eventAction().addListener(this,​ "doCancel");
 } }
  
 /** /**
- * Performs the storno ​of an order.+ * Performs the cancellation ​of an order.
  *  *
- * @throws Throwable if the storno ​is not possible or the remote system has errors+ * @throws Throwable if the cancellation ​is not possible or the remote system has errors
  */  */
-public void doStorno() throws Throwable+public void doCancel() throws Throwable
 { {
-    connection.callAction("​storno", rdbOrder.getValue("​ID"​),​ editPin.getText());​+    connection.callAction("​cancel", rdbOrder.getValue("​ID"​),​ editPin.getText());​
 } }
 </​file>​ </​file>​
  
-The action call is done with following line:+The action call is done with the following line:
  
 <file java> <file java>
-connection.callAction("​storno", rdbOrder.getValue("​ID"​),​ editPin.getText());​+connection.callAction("​cancel", rdbOrder.getValue("​ID"​),​ editPin.getText());​
 </​file>​ </​file>​
  
-The action ​storno ​is called via the server connection connection. The parameter ID and PIN are first entered by the user and passed on to the call.+The action ​"​cancel" ​is called via the server connection connection. The parameter ID and PIN are first entered by the user and passed on to the call.
  
 == Server == == Server ==
Line 73: Line 73:
  
 /** /**
- * The LCO for the Orders ​WorkScreen.+ * The LCO for the Orders ​Workscreen.
  * <p/>  * <p/>
  * @author René Jahn  * @author René Jahn
  */  */
-public class Orders ​extends ​Session+Public Class Orders ​Extends ​Session
 { {
    //​~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~    //​~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Line 95: Line 95:
        
    /**    /**
-    * Performs the storno ​of an order via SAP webservice.+    * Performs the cancellation ​of an order via SAP webservice.
     *      * 
     * @param pOrderId the order ID     * @param pOrderId the order ID
     * @param pPin the storno PIN     * @param pPin the storno PIN
     */     */
-   ​public void storno(BigDecimal pOrderId, String pPin)+   ​public void cancel(BigDecimal pOrderId, String pPin)
    {    {
       //call SAP webservice with ID and PIN       //call SAP webservice with ID and PIN
Line 108: Line 108:
 </​file>​ </​file>​
  
-If exceptions occur during execution they can easily be passed on using the throws clause, ​since the application independently handles errors.+If exceptions occur during executionthey can easily be passed on using the throws clause, ​as the application independently handles errors.
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information