Illustrated guide to tracing Web Services

5 minute read time.

NOTE: This article is no longer relevant from 2021 R3 (Version 12 Patch 27) as the Engine Tracing functionality changed significantly in this version. See the PDFs attached to KB article "How to run an Engine trace in Sage X3?" for more details on both the pre-V12P27 and V12P27+ methods of setting up Engine Tracing.

You are running a Web Service, but it is not behaving as you expect.  How can you turn on Engine Tracing and/or Timing trace to investigate further?

The first thing to say is that you may be able to gain valuable information by enabling the Syracuse level logging via Administration> Administration> Settings> Global Settings.  You can then change the logging levels of the X3 components to give more information, for example in the "x3Comm" section you can enable "Debug" level logging for the "soap" component which may give you the additional information you need.  
 

What I am going to describe in this blog is how to enable Engine and/or Timing tracing specifically, which gives a different perspective than the Syracuse layer logging just mentioned.   This method is relatively easy, although it does involve using some custom code.   Luckily, I will be providing a custom code example which we will use for this discussion.

NOTE: This document has been created and tested with Sage X3 Version 12 Patch 24, although should work OK for Version 11 and other patch levels of Version 12

In summary you need to:
1.    Create and compile your custom code
2.    Setup or check Web services
3.    Run Web Service to generate the trace files
4.    Disable the tracing

Steps in detail

1.    Create and compile your custom code

I am going to run through a simple but complete example to demonstrate the steps needed, using the SEED folder.  You will need to adjust the custom code for your own situation.  

I have attached a file "SPEWS.src" to this article, which you can use as an example of the custom code needed.

a.    Review and modify as necessary the provided example code "SPEWS_1.0.src" in a text editor.

The sample code sets up both Engine Trace AND Timing trace, although you may not need or want both.

  • If you do NOT want Engine Trace, comment out lines 64, 69, 71 and 72
  • If you do NOT want Timing Trace, comment out lines 63, 64, 70 and 73

b.    Copy the modified code to your Sage X3 Application server as filename "SPEWS.src" and locate in the "..\Folders\<FOLDERNAME>\TRT" directory where <FOLDERNAME> is the folder you wish to execute the tracing against.  In my example I am using SEED folder, so will copy the source code file to my "E:\Sage\X3ERPV12\Folders\SEED\TRT" directory.

ALERT: check you do not already have this file on your system before copying over.  If so, you will need to merge the example code into your existing code.

c.    Login to X3 and connect to the relevant endpoint.  Then navigate to Development> Script dictionary> Scripts> Script Editor

d.    Query back the "SPEWS" file name and once you are ready to compile the source code, click the "Compile" button.

2.    Setup or check Web services

a.    Login and connect to the SEED endpoint

b.    Navigate to Administration> Administration> Web Services> Classic SOAP Pools configuration and setup or check your Web Pool for the SEED folder


 
c.    Setup suitable Entry Transaction for use with Web Services
Navigate to Parameters> Sales> Entry Transactions> Orders
Query back then duplicate ECM transaction code to code "WS"


 
d.    Navigate to Navigate to Development>  Script Dictionary> Scripts> Web Services

Create new entry "SOHWS" for the "WS" transaction entry


Save, then click "Publication to publish

At this point, I can also check in the "E:\Sage\X3ERPV12\Folders\SEED\TRT" directory to confirm WJSOHWS.adx has been created (amongst others).

3.    Run Web Service to generate the trace files

In this example, I will use the "SOH" object and do a "read" of an existing Sales Order.
a.    Navigate to Sales> Orders> Orders.  Use the "WS" transaction entry code and query back an existing order.  I am using Order Number SONGB0230010 for my test.
b.    Navigate to Administration> Administration> Web Services> Classic SOAP web services
c.    Select "CAdxWebServiceXmlCC"
d.    Open up the drop down and select "read"

 

e.    Enter the required information and then "Invoke" the request, as shown below:
 

This will return the Sales Order data in the response, as below:
 

When I check the "E:\Sage\X3ERPV12\Folders\SEED\tmp" directory, I can see the engine trace files from my request (two files as I asked for mode 15 engine trace)
 

In the "E:\Sage\X3ERPV12\Folders\SEED\TRA" directory I will find the raw and processed timing trace files



NOTES
•    The SPEWS code applies to all SOAP pools for the folder in which you enable it.
•    If you are doing multiple test requests, you need to bear in mind that a web service process could process multiple requests, so you may find some of the requests output are consolidated into one log file.

4.    Disable the tracing

Once you have completed your tracing activity, you should disable the tracing.   The simplest option is to:
a.    Stop the SOAP pools
b.    Delete the SPEWS.adx from the TRT directory
c.    Restart SOAP pools

Conclusion

Setting up both Timing Trace and/or Engine Tracing for Web Services can only be done using custom code, so hope this article has helped you to understand the required steps if you need to configure this.

Related Articles

Illustrated guide to tracing Imports and Exports (https://www.sagecity.com/gb/sage-x3-uk/b/sage-x3-uk-support-insights/posts/tracing-imports-and-exports )

If you review "Index page: Sage X3 Technical Support Tips and Tricks (March 2021)" you will see an article "Introduction to tracing classic functions" you may find the article itself interesting, but in particular it has a large section "Appendix2: Further Reading" which you may find useful

Attachment

SPEWS_v1.0.src.zip