Testing Web Services
This is part 3 of a 5 part series on creating and consuming web services for Sage X3. This part will focus on testing web services.
To browse other posts in the series, click any of the links below:
Day 1 – Setting up X3 Web Services
Day 2 – Creating X3 Web Services
Day 4 – Calling a Sage X3 Object from ASP.Net
Day 5 - Calling a Sage X3 Program from ASP.NET
Now on to our current topic Testing Web Services ...
Web Service Tester
Sage ERP X3 Web Services can be tested in an interactive mode to view the call parameters and make test calls and view results. This blog post relates to Sage X3 Update 8 and earlier. For instructions on testing Sage X3 Web Services in Update 9, refer to my blog post Testing X3 SOAP Web Services in Update 9.
-
The test url for the web services will be:
http://[ServerName]:28880/root, where [ServerName] is the name of the server where the X3 web services are hosted.
-
Navigate to the above url
-
When prompted, enter a user of "sage" and a password of "sage"
-
The web services tester will appear
Set the Context
-
Click "WebService tester" at the top
-
On the "Context" tab, enter the following:
- Pool entry Group – This is the pool id assigned in the web services setup, which is often the folder name, but doesn't have to be.
- User id – enter the X3 User ID to connect with
- Password – enter the X3 User Password to connect with
- Language Code – select the Language Code
- Click "Save context"
-
A message that the "Web service context has been modified" should appear. If the Logon information is not correct, it will fail.
Returning a List Using the Object Web Service
-
Select "List" from the top tabs
-
Enter the Public Identifier as defined on the Web Service Creation, then click "WebService Description". This will display the WSDL for the Web Service.
-
Searching using the "Criteria".
-
Search the xml above for "LEFTLIST". This will return the data elements that correspond to the 5 criteria at the top.
-
To return a list of orders for a Sold To Customer, enter the Customer ID in the 2 nd Criteria and click "List"
Returning Details the Object Web Service
-
Select "Object" from the top tabs
-
Enter the Public Identifier as defined on the Web Service Creation, then click "WebService Description". This will display the WSDL for the Web Service.
-
Searching using the "Criteria".
-
To return a order details for and Order, enter the Order Number in the 1st Criteria and click "Read".
-
The order details XML will appear
-
When calling the object from code, the parameter string will be build and passed to the call, as shown below.
<PARAM>
<FLD NAM="SOHNUM">SO000240</FLD>
</PARAM>
Create Sales Order using the Object Web Service
-
Select "Object" from the top tabs
-
Enter the Public Identifier as defined on the Web Service Creation, then click "WebService Description". This will display the WSDL for the Web Service.
-
Enter the parameter string and click "Create"
<?xml version="1.0" encoding="UTF-8"?>
<PARAM>
<FLD NAME="BPCORD" >C3301</FLD>
<FLD NAME="CUSORDREF" >PO112613B</FLD>
<FLD NAME="STOFCY" >P21</FLD>
<TAB ID="SOH4_1" SIZE="2" >
<LIN NUM="1" >
<FLD NAME="ITMREF" >21304</FLD>
<FLD NAME="QTY" >2</FLD>
<FLD NAME="DSTOFCY" >P21</FLD>
</LIN>
<LIN NUM="2" >
<FLD NAME="ITMREF" >22301</FLD>
<FLD NAME="QTY" >4</FLD>
<FLD NAME="DSTOFCY" >D22</FLD>
</LIN>
</TAB>
</PARAM>
-
If successful, the order will be displayed.
Calling a Subprogram
-
Navigate to the Sub program tab
-
Enter the public identifier
-
Click WebService Description to get the web service details, including the input parameters
-
In the parameters section at the bottom, enter the parameters for the web service call, as shown below.
-
In the example above, the list will include any customers added or updated in the past 30 days.
-
Below is an example of return data.
Need Help with Web Services?
Contact us if you want to learn more about Sage ERP X3 Web Services features or to request help with your system.
The Ultimate Web Services Guide For Sage X3
Want all 5 days in one comprehensive guide that you can download and take with you?
Leave your name below and we'll send you a copy of our Ultimate Guide to Sage X3 Web Services. This 38-page how-to manual provides everything you need to know about using X3 web services with screenshots, step-by-step instructions, and insider tips from our expert consultants.