RKL eSolutions Blog Trends and Insights

5 days of Sage X3 Web Services v12 Day 3

5 days of Sage X3 Web Services v12 Day 3
10:53

In the first blog of our 5 Days of Web Services Series, we mentioned the importance of using web services, how they can provide real-time interfaces between your Sage X3 instance and external third-party or customer applications, and how to create a SOAP pool. The second blog focused on creating and publishing web services by exposing objects and creating subprograms. Today, we'll test the web services we created and published in the previous two blogs.

5 Days of Web Services Series:

Day 3 - Testing Your Published Web Services

Navigating to the Web Services Tester

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

Once logged in to your Sage X3 web client, navigate to Administration > Administration > Web Services > Classic SOAP Web services.

WSDay3-1

The picture below is the initial screen for the web services tester. Click on the highlighted link ("CAdxWebServiceXmlCC") to display the STUB.

WSDay3 - SOAP generic web services

There is a field called “Url”. This URL will be used to consume the SOAP web services. Right-click on the URL and select "Copy link address" to get the full URL link for the X3 instance.

WSDay3 - Copy STUB Link Address

Return to the "Classic SOAP Web services" page by clicking the "Back" icon in the browser. Then select the "Down Arrow" icon located on the left.

WSDay3 - Click drop down arrow to reveal operations list

Once again, select the "Down Arrow" icon located on the left to expand the list of operations.WSDay3 - Second Down Arrow to Expose List of Operations

As you can see in the picture below, there are twelve operations that you can choose from. The six most commonly used operations for subprograms web services and object-based web services are:

  • Sub-program web services:
    • Run: run a sub-program based web service.
  • Object-based 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.
    • Read: read an object by record key.
    • Query: query an object left list.
    • Modify: modify/update an existing record associated with an X3 object (i.e. Sales Order, Customer, etc.)
Another operation that can be useful is "getDescription" which is used to evaluate the web service XML during the development process.

WSDay3 - SOAP generic web services Operations

Using the Web Service getDescription Operation

While in the SOAP generic web services operations panel, click on the "getDescription" link. This will open the window to get the web service description.

WSDay3 - Link to the getDescription Operation

Although Public name is the only field required to call the web service test, we highly suggest filling in the language code, and pool alias fields as well. I'll define their purpose and the information I've entered in the example below:

  • Language code: the language code for the web service
    • Example: ENG
  • Pool alias: the web service pool
    • Example: DENISE
  • Public name: the web service name
    • Example: YWSCUSTLIS.
WSDay3- getDescription Operations FieldsOnce you've finished entering the information, navigate to the "Actions" button in the right-hand corner and select "Invoke" to display the web services XML description. 

WSDay3-Invoke

The web services XML description can provide useful information for consuming the web service.WSDay3 - Web Services XML Description

Calling an Object-Based Web Service from the tester

Several different operations can be called when using an object-based web service. The most commonly used operations are query, read, save, and modify.

Using the Web Service Query Operation

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

While in the SOAP generic web services operations panel, click on the "query" link. This will open the window to run a query from your objects list. WSDay3 - query operationAlthough Public name and List size are the only two fields required to run a query, we highly suggest filling in the Language code and Pool alias (and object keys if needed) fields as well. I'll define their purpose and the information I've entered in the example below:

  • Language code: the language code for the web service
    • Example: ENG
  • Pool alias: the web service pool
    • Example: DENISE
  • Public name: the web service name
    • Example: YWSSOH
  • 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
    • Example: 10

WSDay3 - query operation information

Once you've finished entering the information, navigate to the "Actions" button in the right-hand corner and select "Invoke" to display the web services XML query results. 

WSDay3-Invoke

The web services XML query operation can provide useful information for consuming the web service.   Below is a subset of the results. WSDay3 - query operation results

Using the Web Service Read Operation

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

While in the SOAP generic web services operations panel, click on the "read" link. This will open the window to run an object.

WSDay3 - read operationAlthough Publication name is the only field required to read an object, we highly suggest filling in the language code, pool alias and object keys fields as well. I'll define their purpose and the information I've entered in the example below:

  • Language code: the language code for the web service
    • Example: ENG
  • Pool alias: the web service pool
    • Example: DENISE
  • Public name: the web service name
    • Example: YWSSOH
  • Object keys: this must be used to specify the key value for the object that is being read.
    • Example: the Key is SOHNUM and the Value is SOWFR0110005.

WSDay3 - read operation information

Once you've finished entering the information, navigate to the "Actions" button in the right-hand corner and select "Invoke" to run the results. 

WSDay3-Invoke

This web services XML result can provide useful information for consuming the web service if you're looking to read an object by record key. (The GRP IDs in the XML represent the Screen IDs in Sage X3.)

WSDay3 - read operation results

Using the Web Service Save Operation

The save operation allows you to create a new record based on an object. 

While in the SOAP generic web services operations panel, click on the "save" link. This will open the window to create a new record.

WSDay3 - save operation

Although Public name and Object Xml are the only two fields required to create a new record, we highly suggest filling in the language code and pool alias fields as well. I'll define their purpose and the information I've entered in the example below:

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

WSDay3 - save operation information

Once you've finished entering the information, navigate to the "Actions" button in the right-hand corner and select "Invoke" to create the record. 

WSDay3-Invoke

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.  

WSDay3 - save operation results

Using the Web Service Modify Operation

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

While in the SOAP generic web services operations panel, click on the "modify" link. This will open the window to update a record.WSDay3 - modify operation

Although Public name and Object Xml are the only two fields required to modify an existing record, we highly suggest filling in the language code, pool alias, and object keys fields as well. I'll define their purpose and the information I've entered in the example below:

  • Language code: the language code for the web service
    • Example: ENG
  • Pool alias: the web service pool
    • Example: DENISE
  • Public name: the web service name
    • Example: YWSSOH
  • Object keys: when modifying an existing record, the primary object key(s) must be provided.
    • Example: the Key is SOHNUM and the Value is SOWFR0110007.
  • Object Xml: this is the XML payload to update the record. Below is the full XML sent in this example.XML object example
    WSDay3 - modify operation information

Once you've finished entering the information, navigate to the "Actions" button in the right-hand corner and select "Invoke" to modify the record. 

WSDay3-Invoke

The web services XML result can provide useful information for consuming the web service.
WSDay3 - modify operation results

Calling a Sub-program Web Service from the Tester

While in the SOAP generic web services operations panel, click on the "run" link. This will open the window to run a sub program.

WSDay3 - run operation

Although Public name and Input XML/JSON are the only two fields required to run a sub-program, we highly suggest filling in the language code and pool alias fields as well. I'll define their purpose and the information I've entered in the example below:

  • Language code: the language code for the web service
    • Example: ENG
  • Pool alias: the web service pool
    • Example: DENISE
  • Public name: the web service name
    • Example: YWSCUSTLIS
  • 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

WSDay3 - run operation information

Once you've finished entering the information, navigate to the "Actions" button in the right-hand corner and select "Invoke" to display the web services XML result. 

WSDay3-Invoke

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

WSDay3 - run operation results

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 is helpful when calling the web services from code such as .Net, Java and PHP.


Want More Sage X3 Features & Functions?

For some Sage X3 videos, head over to our YouTube page and subscribe to stay up-to-date with the latest insights and tutorials. Our channel is dedicated to providing valuable resources for businesses looking to optimize their financial management with Sage X3.

question-mark

5 Days of Web Services Series:

Day 1 - Creating a SOAP Pool

Day 2 - Creating and Publishing Web Services
Day 4- Consuming Web Services in .NET
Day 5 - Consuming X3 Subprogram Web Services from .Net

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.