Adding a Result Checker

Add a result checker to implement operation result processing logic in custom code. The deployed result checker logically validates operation results and produces log records for device clients or the server package log.

See the Mobile Data Models: Using Mobile Business Objects for information about writing a custom result checker.

Add a result checker when you edit Attribute or Operation properties for a mobile business object derived from a data source. Add a result checker after you have either written a custom one or use a predefined one in SAP Mobile WorkSpace (the latter of which can be configured when you create an object).

  1. In the New Attributes or New Operation wizard, in the Result checker section, select from these options:
    Option Description
    Default The result checker depends on the data source type:
    • SAP – com.sybase.sup.sap3.SAPOperationHandler. If a RETURN parameter is found in the selected operation, this option is automatically selected.
    • Web service (SOAP) – com.sybase.sup.ws.soap.SoapOperationHandler. The default checker always returns the status as successful.
    • Web service (RESTful) – com.sybase.sup.ws.rest.RestOperationHandler. The default checker always returns the status as successful.
    None Return the status as successful with no message. The result checker used depends on the data source type:
    • SAP:
      package com.sybase.sap3;
      
      import com.sybase.sup.sap3.SAPOperationHandler;
      
      /*
       * Abstract SAPOperationHandler already defines the no-op methods
       */
      public class NoopSAPOperationHandler extends SAPOperationHandler {
      
      }
    • Web service (SOAP):
      package com.sybase.sup.ws;
      
      import com.sybase.sup.ws.soap.SoapOperationHandler;
      
      public class NoOpSoapOperationHandler extends SoapOperationHandler {
      
      }
      
      For SOAP, use the Default result checker instead of None to parse the SOAP fault and return it to the client as a log record.
    • Web service (RESTful):
      package com.sybase.sup.ws;
      
      import com.sybase.sup.ws.rest.RestOperationHandler;
      
      public class NoOpRestOperationHandler extends RestOperationHandler {
      
      }
      
    Custom Specify a custom result checker.

    See the topic Writing a Custom Result Checker in Mobile Data Models: Using Mobile Business Objects for information about writing a custom result checker.

  2. (Optional) If you have not yet created the result checker classes, select Custom in the Result checker area of the New Attributes or New Operation dialog, and click Create to run the New Java Class wizard.
  3. If prompted, add a Java nature.
    1. (Recommended) Click Yes to add a Java nature. In Eclipse, a Java nature adds Java-specific behavior to projects.
      In the New Java Class wizard, enter:
      Option Description
      Source folder By default, this is the Filters folder from your project. Click Browse to locate the source folder for the Java class.
      Package Click Browse to locate the package for the new Java class.
      Note: SAP recommends that you do not leave this field blank. Otherwise, the JDK<version> Java class in the default package cannot be resolved in other packages.
      Enclosing type Choose a type in which to enclose the new class. You can select either this option or the Package option, above. Enter a valid name or click Browse.
      Name Enter a name for the result checker class.
      Modifiers Select the Java class modifiers. The default modifier is public.
      Superclass
      1. Click Browse.
      2. In the Superclass Selection dialog, enter:
        • Choose a Type
        • Matching Items
      3. Click OK.
      Interfaces By default, this is populated with the corresponding interface for the selected data source type. Click Add to select interfaces implemented by the new class.
      Which Method Stubs Would You Like to Create
      • Public Static Void Main
      • Constructors From Superclass
      • (Default) Inherited Abstract Methods
      Do You Want to Add Comments Select Generate Comments to add comments. From here, you can modify the preferences of the code templates by clicking Configure templates and default values.
    2. Click No if you do not want to add the Java nature to the selected mobile application project.
    3. Click Finish to compile the Java skeleton source file and add the skeleton Java checker class to the MBO.
      The result checker appears next to the Custom option.
  4. In the Result checker section, next to the Custom option, click Browse to find an existing result checker class.
    1. In the Select Result Checker Class dialog, select the result checker class and click OK.
      The result checker class appears next to the Custom option.
  5. Validate the result checker:
    1. To reuse input values you have already saved for previous previews, select Existing Configuration. Otherwise, load defaults, or create a new set of input values expressly for this preview instance.
    2. Click Preview.

    If the data runs successfully, Execution Succeeded appears at the top of the Preview dialog and data appears in the Preview Result window.