RKL eSolutions Blog Trends and Insights

5 days of Sage X3 Web Services v12 Day 3

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.

Sage X3 web client

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

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.

URL field

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

6. Below is the list of operations.Operations list

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.web 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
      Web description fields

3. From the Actions menu, click Invoke.

invoke button

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

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. web 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

web query window

3. From the Actions menu, click Invoke.

invoke button

4.The web services XML result will be displayed.   Below is a subset of the results. XLM subset 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.

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.

object keys

3. From the Actions menu, click Invoke.

invoke button

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.

GRP in XML screen

save

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

new record base

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.XML payload example

Save request

2. From the Actions menu, click Invoke.

invoke button

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.  

XML save result

modify

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

From the web service operations, click the save link.modify 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.XML object example
    modify example

2. From the Actions menu, click Invoke.

invoke button

3. The web services XML result will be displayed.web services XML

Calling a subprogram based web service from the tester

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

run link in web services

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.

PARAM

web services PARAM

3. From the Actions menu, click Invoke.

Invoke button

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

No data display

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

Tags: Sage X3
RKL Team

Written by RKL Team

Since 2001, RKL eSolutions has helped growing companies maximize their technology resources and investment. Over the years, we have helped hundreds of small and medium sized businesses as their strategic business partner. We specialize in the needs of Entertainment, Software & SaaS, Professional Services, Manufacturing, and Non Profit organizations. Our experienced consultants have a passion for making every facet of your business successful and are intent on building a long-term relationship with every client.