Debugging Mediation¶ Debugging with External WSO2 Integrator: MI¶ Download and install the WSO2 Integrator: MI server and on your computer. Launch Visual Studio Code with the WSO2 Integrator: MI Extension installed. Select the artifact that requires debugging from the Project Overview page. Then select the relevant resource from the Service Designer page in order to open the Diagram View of the resource. To add a breakpoint to a mediator, in the Diagram View click on the Options icon on the right side of the mediator name and select Add Breakpoint. Note To remove a breakpoint from a mediator, click on the Options icon on the right side of the mediator name and select Remove Breakpoint. Configure a new MI server without any previously deployed integrations to avoid conflicts by following the steps below. Open the command palette in VS Code by entering Command+Shift+P on macOS and Ctrl+Shift+P on Windows. Select MI: Add MI server from the list of available commands. Select the folder where <MI_HOME> is located. Note Mediation debugging with the MI for VSCode extension is supported on Windows starting from MI server version 4.3.0. Select the Run and Debug extension from the left side panel and then click on the Run and Debug button. Select MI: Run and Debug as the debugger. Then the server will start up in debug mode and the server logs can be viewed in the Output alongside with the Debug Console. Remote Server DebuggingFollow the steps below to connect to and debug a remote WSO2 Integrator: MI server. Click Create a launch.json file. Select MI: Run and Debug as the debugger. Below content will be generated and added to the launch.json file with the default values. Update the configurations in the MI: Remote Server Run and Debug section accordingly to connect to the remote server. { "version": "0.2.0", "configurations": [ { "type": "mi", "name": "MI: Local Server Run and Debug", "request": "launch", "internalConsoleOptions": "openOnSessionStart", "vmArgs": [], "properties": { "type": "local" } }, { "type": "mi", "name": "MI: Remote Server Run and Debug", "request": "launch", "internalConsoleOptions": "openOnSessionStart", "vmArgs": [], "properties": { "type": "remote", "commandPort": 9005, "eventPort": 9006, "serverHost": "localhost", "serverPort": 8290, "serverReadinessPort": 9201, "managementPort": 9164, "managementUsername": "admin", "managementPassword": "admin", "connectionTimeoutInSecs": 10 } } ] } Property Description type Debug type - local or remote commandPort Debug command port eventPort Debug event port serverHost Host of the remote server serverPort Remote server port for HTTP Passthrough transport. serverReadinessPort HTTP port of the Management API of the remote server managementPort HTTPS port of the Management API of the remote server managementUsername Username to access Management APIs managementPassword Password to access Management APIs connectionTimeoutInSecs Remote server connection timeout Start the remote server in debug mode. On macOS/Linux sh micro-integrator.sh -Desb.debug=true On Windows micro-integrator.bat -Desb.debug=true Select the remote server debugger option to connect with the remote server and debug the flow. Once the server is up, send a request to the WSO2 Integrator: MI and start debugging the flow. You can use the below controlling panel to debug the flow by performing operations like step over, restart, pause, and stop. Information provided by the Debugger Tool¶ When your target artifact gets a request message and when the mediation flow reaches a mediator marked as a breakpoint, the message mediation process suspends at that point. There are two segments in the Variables section, namely Server Internals and Message Envelope. You can view the message payload in the Message Envelope section and you can view the message mediation properties in the Server Internals section. The Server Internals section contains properties of the following property scopes. Axis2-Client Scope properties Axis2 Scope properties Operation Scope properties Synapse Scope properties Transport Scope properties These properties can be further expanded in order to view information on the property keys and values of them as shown below.