For developers
This section provides details specifically addressed to developers who have an advanced knowledge of coding and web services. The YOSOH web service is still used as an example.
This section describes how to initiate calls without using an external application but using the X3 test tool. You can also see the PHP or C# codes used to call the same web services.
This web service is defined as an object web service with optimized WS transaction.
List the orders
In the PHP code:
Config::$WS_ORDER > YSOH
In /sagex3/page_soh_list.php:
<?php require_once ('WebService/models/Order.php'); try { $order = new Order (); echo ($order->showListe ()); } catch ( SoapFault $e ) { ToolsWS::printError ( "Web service not available" ); } ?> In /sagex3/WebService/models/Order.php function showListe() { $WS = "*"; $this->CAdxResultXml = $this->query ( Config::$WS_ORDER, $WS,100); … }
In the application tool:
Open: Administration > Administration > Web Services and select Classic SOAP Web Services
From the List of SOAP Generic Web Services, select this web service.
On the next screen, click the drop-down arrow to see the list of Operations.
From the list of Operations, click query.
The request configuration
adxwss.optreturn=JSON&adxwss.beautify=true
means that
adxwss.optreturn=JSON
the output data format is JSON or XML, where
adxwss.beautify=true
this action improves the presentation as shown below.
The web service is working without error when the status is 1.
There are only two possible statuses:
-
1 = OK
-
0= ERROR
Read an order
In the PHP code:
In /sagex3/page_soh_read.php:
<?php … echo ($order->showOne ( $sohnum )); … ?>
In /sagex3/WebService/models/Order.php:
function showOne($crit) { … $cle = new CAdxParamKeyValue (); $cle->key = "SOHNUM"; $cle->value = $crit; $this->CAdxResultXml = $this->read (Config::$WS_ORDER,Array($cle)); … }
In the application tool:
You must call the Read operation with the order key.
After selecting Invoke
Create an order while logged in
Using the application tool:
Start by copying the result of the JSON data from the Read operation:
{ "SOH0_1": { "SALFCY": "FR011", "ZSALFCY": "Comptech SA", "SOHTYP": "WEB", "ZSOHTYP": "WEB", "SOHNUM": " SOWFR0110009 ", "REVNUM": "0", "CUSORDREF": "", "ORDDAT": "20160406", "CUR": "EUR", …
Replace the line: "SOHNUM": " SOWFR0110009 ", with "SOHNUM": " ",.
In the tool, enter this data into the Object XML field.
Invoke.
The code for the order that was created is in the JSON result:
The status has the value 1.
In the PHP code:
In /sagex3/page_soh_create_action.php:
{ "SOH0_1": { "SALFCY": "FR011", "ZSALFCY": "Comptech SA", "SOHTYP": "WEB", "ZSOHTYP": "WEB", "SOHNUM": " SOWFR0110009 ", "REVNUM": "0", "CUSORDREF": "", "ORDDAT": "20160406", "CUR": "EUR", …
In /sagex3/WebService/models/Order.php:
function create($WS) { $this->CAdxResultXml = $this->save ( Config::$WS_ORDER, $WS ); … }