Don't get lost: IMan Guides » Sage X3 User Guide » Sage X3 Webservices » Testing Webservices

Testing Webservices

It is possible to test the webservice from within X3 prior to it being used by IMan. You may wish to do this to ensure a particular object or import scenario can be safely called.

Testing is easily performed from the Webservices wrapper program.

The following steps are actually a great way to create unit tests if any you are performing modifications to the standard object code or creating your own.

Setting up the test program

  1. Open the Process Editor from the Development, Processes, Processes, Process Editor menu and open the wrapper program. The wrapper program can be found from on the Definition Tab of the webservice publication.
  2. Each published webservice will have two sections:
    • A left list test.
    • A transaction creation/modification test.
  1. Uncomment TEST and comment the TEST_LISTE at the top of the program.
  • #####################################################

    ## Publication d'un objet sous forme de web service

    ## Objet : SOH

    ## Transaction : STD

    ## Champs Invisibles : No

    ## Fenêtre : WOSOHSTD

    ## Nom de Publication : ORDER

    ## Timestamp de génération : 20131204112057

    ## Version de génération : 6.30

    Call TEST

    #Call TEST_LISTE(10)

    End

  1. Whilst it is possible to embed the tests in the wrapper program it is recommended to store any tests in a separate program file since the wrapper program is re-created each time an object is published, thus any embedded tests will be lost.
  • Subprog TEST

    Local Char TEXTE(20)

    Local Integer I , J , K

    Call OUVRE_TRACE("") From LECFIC

    Gosub DEFVAR

    WW_ACTION = "READ" : # READ, CREATE, MODIFY, DELETE, SUPLIG, INSLIG

    WW_IDENT = "" : # Clé de l Objet Val1~Val2

    Onerrgo ERREURWS

    Gosub INITMAJ From ZZWSSOH

  1. Open the test program (ZZWSSOH) and create the test.
  2. Sample code for creating a single line Sales Order:
  • $INITMAJ

    WW_ACTION = "CREATE"

    SOHTYP_A = "SON"

    SALFCY_A = "D11"

    BPCORD_A = "C1101"

    ORDDAT_A = "20131204"

    NBLIG_3 = 1

    NUMLIG_3(0) = 1 : ITMREF_3(0) = "11102" : QTY_3(0) = 1

    Return

  1. Sample code for modifying an Order:
  • $INITMAJ

    WW_ACTION = "MODIFY"

    WW_IDENT = "SO000054"

    NBLIG_3 = 2

    NUMLIG_3(0) = 1 : ITMREF_3(0) = "11101" : QTY_3(0) = 2

    Return

  1. Compile (F7) the test program.
  2. Return to the wrapper program and execute.
  3. If successful the standard audit screen will be displayed with any warnings or non-fatal errors.