Planon Extension - Web Service Request Worker

Introduction

The application initializes a HTTP client and a HTTP request, build and execute the request. Finally, it writes the response body in to a file.

The settings for the headers, the url, the method along with the file paths for the request and response files are specified by the user.

Prerequisites

Environment

This solution will be designed to work with Planon Live L121 and above.

Constraints

N/A

Required (free)fields

N/A

Assumptions

N/A

Features

This chapter describes the features that this app contains.

Call HTTP based Web Services

Get Request header and body:

  • The request headers are specified in the app setting, in the form of <key>:<value>, separated by lines.

  • For example if you want to perform a SOAP request:

Content-Type:text/xml; charset=utf-8

SOAPAction:“urn:Afas.Profit.Services/GetData”

  • The request body is of XML format, which is read from a file with a specified path in the setting.

Initialize HTTP Client and Request Builder:

  • Depends on whether the proxy host is empty, it will initialize a connection with the proxy host and port, adding authentication with proxy user name and password is needed. The authentication is also specified in the setting.

  • The request has a timeout of 30 seconds.

  • Support proxy host

Send the request and get the response:

  • The default encoding is UTF-8

  • The response returned is parsed as a DTO, consists of status code, body and the headers.

Write the body response to file:

  • The application writes the response body to a file path specified in the setting, as “responseFile”, the encoding is UTF-8

How does it work

This chapter contains the functional and technical description (if applicable) of the features as described in chapter 3.

The app is used in combination with enterprise talk. The app comes with an enterprise talk worker with settings and has to be configured with enterprise talk definition.

When the enterprise talk definition is run, the worker calls the endpoint based on the configuration on the worker and receives the response.

The response is then stored in the configured response file which can be used in the further steps of the enterprise talk definition.

The settings of the app are described in futher sections.

Installation

This chapter describes the steps required to install this app on your Planon environment.

Installation Process

There are two ways to install the app:

  1. Using the Marketplace
  2. Manual installation

Install the app by using the marketplace

In case your environment is configured to use the Planon app store the only thing required to install the app is to add the app license in the AppCenter TSI. Planon will automatically download and install the app.

AppCenter Marketplace Installation

Manual installation

In case you want to perform a manual installation follow the steps below.

  1. Open AppCenter TSI from Planon webclient and click on install from action menu

AppCenter Installation

  1. Browse to the .ppk file

Browse ppk file

  1. Click OK to install the app and follow the installation process
  2. When the app is successfully installed, the app will appear in the AppCenter

Installed App

  1. Add the app license in Apps TSI

Add App License

Activation

Once the app has been configured, you can activate the app by pressing the Active status transition from the action panel. Always make sure that the required User groups are linked correctly and the Configure action is executed before activating the App.

AppCenter App Activation

Planon Configuration

Now that the app is installed and activated we can add a worker instance in an import-export document. This is done in the TSI ‘Enterprise Talk’:

  1. Select or create a definition, make sure ‘use platform workers’ is set to yes

  2. Drilldown to ‘Documents’ and select or create a document

  3. Drilldown to ‘Business Object Definitions’, ‘Import-export worker’

  4. Click add in the action panel

  5. You can now add a new worker instance of ‘planonsoftware.apps.webserviceworkers.HTTPRequestWorker’.

  6. Configure the settings as described below which can be found in the ‘Setting tab’

Description of settings

SettingExplanation
encodingEncoding of the response data.
httpMethodThe method used to send the request (POST or GET).
requestURLEndpoint to be called.
skipOnEmptyRequestWhether to skip worker execution when request body is empty.
stopProcessOnErrorWhether to stop worker execution on error.
proxyHostHostname of the proxy server, not mandatory.
proxyPortPort number the proxy server is listening to. Only required when proxyHost is provided.
proxyUsernameUsername to authenticate to proxy server (optional).
proxyPasswordPassword to authenticate to proxy server (optional).
responseFileFile path for the response file. This should be a XML file.
requestBodyFileFile path for the request file. This should be a XML file, the content of this file is used as the request body.
requestHeadersHeaders used for the request. The format is key:value. Use new lines to provide multiple headers.
userNameUsername to authenticate on the service when you want to use basic authentication. This is not mandatory if for example xyz is used.
passwordPassword to authenticate on the service when you want to use basic authentication.
sslTrustStoreFilePath to the SSL truststore file when you want to use communication based on SSL/TLS.
sslTrustStorePasswordPassword to open the SSL truststore file.
sslKeyStoreFilePath to the SSL keystore file when you want to use communication based on SSL/TLS.
sslKeyStorePasswordPassword to open the SSL keystore file.
addRequestBodyToResponseFileWhen this is set to ‘Yes’ the request body will be added to the exported response file.
convertResponseToXMLWhen this is set to ‘Yes’ the received response is converted to XML. This is only applicable when you are calling a webservice that returns JSON.

Troubleshooting

Error handling

  • Errors are recorded in the server logs:
    • Tomcat log for web components
      • Webpages
      • PSS modules
      • Stepview
      • TSI Action
      • JAX-RS webservices
    • Wildfly log for server-side components
      • Business rules
      • Scheduled tasks
      • Workers
      • Event Connector
  • UI components (TSI Actions) also display errors in the interface