RKL eSolutions Blog

5 days of Sage X3 Web Services v12 Day 3

Written by RKL Team | Nov 19, 2019 11:47:00 AM

Day 3 Testing Web Services

This is Part 3 of a 5 part series on creating and consuming web services for Sage X3 Version 12. This part will focus on creating web services. In Part 1 we discussed setup of a Sage X3 Web Services Pool, and in Part 2 we discussed creating and publishing web services based on X3 objects and subprograms.

Web Services Tester

Sage X3 Web Services can be tested in an interactive mode, to view the call parameters, make test calls and view the results.  The web service tester in Version 12 resides within the X3 menu.

1. Log on to the Sage X3 web client.

2. Navigate to Administration > Administration > Administration > Web Services > Classic SOAP Web services.

3. Below is the initial screen for the web services tester. Click the highlighted link to display the STUB.

4. At the top right section of the screen is a field called “Url”. This is the URL that will be used to consume the SOAP web services.  Right-click on the Url and select Copy to get the full URL link for the X3 instance.

5. Click the down arrow to expand the operations list.

6. Below is the list of operations.

7. The most commonly used operations are:

    • Subprogram web services:
      • Run – run a subprogram based web service.
    • Object web services:
      • Save – create a new record associated with an X3 object (i.e. Sales Order, Customer, etc.)
      • Delete – delete an existing record associated with an X3 object.
      • Query – query an object left list.
      • Modify - modify/update an existing record associated with an X3 object (i.e. Sales Order, Customer, etc.)
    • Other:
      • getDescription – this is useful to evaluate the web service XML during the development process.

Web Service Description

  1. From the web service operations, click the get Description link.
    1. This will open the window to get the web service description. Enter the fields as shown below.
    • Language code – the language code for the web service.
    • Pool alias – the web service pool
    • Public name – the web service name

3. From the Actions menu, click Invoke.

4. The web services XML description will be displayed. This can provide useful information for consuming the web service.

Calling an object based web service from the tester

There are several different operations that can be called when using an object based web service.  The most commonly used operations are displayed below.

Query

The Query operation allows you to query and return the left list of an object.  The left list is the selection list on the left portion of an object window.

1. From the web service operations, click the query link.

2. This will open the window to run the web service. Enter the fields as shown below.
  • Language code – the language code for the web service.
  • Pool alias – the web service pool
  • Public name – the web service name
  • Object keys – this can be used to filter the results based on the left list values
    • BPCORD = ‘FR004’ – returns all orders for customer FR004
  • List size – this should be used to specify the number of items to be returned in the list

3. From the Actions menu, click Invoke.

4.The web services XML result will be displayed.   Below is a subset of the results.

read

The Read operation allows you to read and object by record key.  It returns all of the fields you would normally see on the object window in an XML format.

1. From the web service operations, click the read link.

\


2. This will open the window to run the web service. Enter the fields as shown below.

  • Language code – the language code for the web service.
  • Pool alias – the web service pool
  • Public name – the web service name
  • Object keys – this must be used to specify the key value for the object that is being read. For this example, the Key is SOHNUM and the value is SOWFR0110005.

3. From the Actions menu, click Invoke.

4. The web services XML result will be displayed. Below is a subset of the results.  The GRP IDs in the XML represent the Screen IDs in X3.

save

The save operation allows you to create a new record based on an object.  From the web service operations, click the save link.

1. This will open the window to run the web service. Enter the fields as shown below.

  • Language code – the language code for the web service.
  • Pool alias – the web service pool
  • Public name – the web service name
  • Object xml – this is the XML payload to create the record. Below is the full XML sent in this example.

2. From the Actions menu, click Invoke.

3. The web services XML result will be displayed.   When creating a new record, the new SOHNUM will be included in the result XML.  Below is a subset of the results.  

modify

The modify operation allows you to modify an existing record based on an object. 

From the web service operations, click the save link.

1. This will open the window to run the web service. Enter the fields as shown below.

  • Language code – the language code for the web service.
  • Pool alias – the web service pool
  • Public name – the web service name
  • Object keys – when modifying an existing record, the primary object key(s) must be provided. In this example, the key was:
    • SOHNUM = SOWFR0110007
  • Object xml – this is the XML payload to update the record. Below is the full XML sent in this example.

2. From the Actions menu, click Invoke.

3. The web services XML result will be displayed.

Calling a subprogram based web service from the tester

1. From the web service operations, click the run link.

2. This will open the window to run the web service. Enter the fields as shown below.
    • Language code – the language code for the web service.
    • Pool alias – the web service pool
    • Public name – the web service name
    • Input XML/Json – this is the formatted XML payload for the specific web service call. Notice that the NAM value corresponds to the input parameter in the subprogram.  1825 represents 5 years, so the past 5 years of customer additions and changes will be returned in the list.

3. From the Actions menu, click Invoke.

4. The web services XML result will be displayed. Below is a subset of the results. 

Conclusion

You have now learned how to use the web services tester to test both object-based and subprogram-based web services.  This information is useful to ensure that the web services are working, and also to test the XML payload and results of the web services, which his helpful when calling the web services from code, such as .Net, Java and PHP.

More in this series

Day 1 - Creating a Classic SOAP Pool

Day 2 - Creating and Publishing Web Services

Day 3 - Testing Web Services

Day 4- Consuming Web Services in .NET

Day 5 - Consuming X3 Subprogram Web Services from .Net

GOT QUESTIONS ABOUT WEB SERVICES FOR SAGE X3?

Contact us if you want to learn more about Sage ERP X3 Web Services features or to request help with your system.

Contact RKL eSolutions