Jump to: navigation, search

Scout/Tutorial/3.8/webservices/Create WsLogForm

< Scout‎ | Tutorial‎ | 3.8
Revision as of 02:56, 17 October 2012 by Jeremie.bresson.bsi-software.com (Talk | contribs) (add ScoutPage)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Wiki Home

Create Ws Log Form

On the client node, go to 'Forms'. Right click on the node to create the WsLogForm [1]. As the name of the form, enter Ws Log and choose to create the Form ID which is the primary key of the log entry[2]. Click next to choose from the artifacts which also should be created by Scout SDK [3]. Uncheck all permissions as Authorization is not part of this tutorial. As the WS log is read-only, also uncheck NewHandler.

Because the form does only display read-only data, change the ModifyHandler as follows:

public class ModifyHandler extends AbstractFormHandler {

  public void execLoad() throws ProcessingException {
    IWsLogProcessService service = SERVICES.getService(IWsLogProcessService.class);
    WsLogFormData formData = new WsLogFormData();
    formData = service.load(formData);

    // disable whole form 

Create Form Fields

On the WsLogForm node, go to the 'MainBox'. Right click on the MainBox to create the following 4 Form Field's:

Type: Date Field
Name: Date
Class name: DateField
Type: String Field
Name: Service
Class name: ServiceField
Type: String Field
Name: Port
Class name: PortField
Type: String Field
Name: Operation
Class name: OperationField

To display the SOAP message for request and response, we create a TabBox that contains the two tabs 'Request' and 'Response', respectively.

Type: Tab Box
Name: <leave empty as no label>
Class name: SoapMessageBox

Because the tab box SoapMessageBox should not have a label, go to that node and uncheck the Label Visible property in the 'Advanced Properties' section of the Scout Property View. Next, we will create the two tabs. Therefore, right click on SoapMessageBox[4] and create the following two boxes:

Name: Request
Class name: RequestBox
Name: Response
Class name: ResponseBox

Finally, add two String fields to hold request and response to the boxes.

Right click on RequestBox to create the 'Request' String field [5]:

Type: String Field
Name: <leave empty as no label>
Class name: RequestField

Right click on ResponseBox to create the 'Response' String field [6]:

Type: String Field
Name: <leave empty as no label>
Class name: ResponseField

In both fields, adjust their properties in Scout Property View as following [7]:

  • Set Grid H to 5
  • Set Grid W to 0 (FULL_WIDTH)
  • Set Label Visible to false
  • Set Max Length to inf (Integer.MAX_VALUE)
  • Set Multiline Text to true
  • Set Wrap Text to true

Associate WsLogForm with WsLogTablePage

To view a log record, you have to add a 'VIEW' menu to the WsLogTablePage. On client node, go to the node 'Desktop' | 'Outlines' | 'StandardOutline' | 'Child Pages' | 'WsLogTablePage' | 'Table' | 'Menus'. Right-click on the menu node to create the following menu:

VIEW menu [8]
Name: View WS Log...
Class Name: ViewWsLogMenu
Super Type: AbstractMenu
Form to start: WsLogForm
Form handler: ModifyHandler

We also have to provide the WsLogNr primary key as argument to the WsLogForm. For that reason, double click the ViewWsLogMenu to modify the code in execAction() as follows:

protected void execAction() throws ProcessingException {
  WsLogForm form = new WsLogForm();
  // Add the following line to set the primary key of the selected log record to the form
  if (form.isFormStored()) {

Load WS Log data

Scout SDK already created WsLogProcessService in order to load WS log data. Because we are only reading but not updating log entries, you can remove all operations except load.

Please implement the load-method stub as following:

public class WsLogProcessService extends AbstractService implements IWsLogProcessService {

  public WsLogFormData load(WsLogFormData formData) throws ProcessingException {
    SQL.selectInto("" +
        "SELECT EVT_DATE, " +
        "       SERVICE, " +
        "       PORT, " +
        "       OPERATION, " +
        "       REQUEST, " +
        "       RESPONSE " +
        "FROM   WS_LOG " +
        "WHERE  WS_LOG_NR = :wSLogNr " +
        "INTO   :date, " +
        "       :service, " +
        "       :port, " +
        "       :operation, " +
        "       :request, " +
        "       :response"
        , formData);
    return formData;

Create WsLogForm
Create WsLogForm
Create WsLogForm artefacts
Create Tab Box
Create Request tab
Create Response tab
Update properties of Request / Response fields
Create view menu on WsLogTablePage