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
- 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.
- Each published webservice will have two sections:
- A left list test.
- A transaction creation/modification test.
- 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
- 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
- Open the test program (ZZWSSOH) and create the test.
- 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
- 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
- Compile (F7) the test program.
- Return to the wrapper program and execute.
- If successful the standard audit screen will be displayed with any warnings or non-fatal errors.