Web Services

In a connected world, a ticket system needs to be able to react to requests from other systems and also to send requests or information to other systems:

  • CRM systems
  • Project management systems
  • Documentation management systems
  • and many more

The ticket system must be reachable by other services without manual intervention by an agent.

OTRS supports this requirement by the Generic Interface. It empowers the administrator to create a web service for a specific task without scripting language knowledge. OTRS reacts on incoming REST or SOAP requests and create objects or provides object data to other systems transparently.

A web service is a communication method between two systems, in our case OTRS and a remote system. In its configuration, the operation or invoker determine the direction of communication, and the mapping and transport take care of how the data is received and interpreted.

In its configuration it can be defined what actions the web service can perform internally (operation), what actions the OTRS request can perform remote system (invokers), how data is converted from one system to the other (mapping), and over which protocol the communication will take place (transport).

The generic interface is the framework that makes it possible to create web services for OTRS in a predefined way, using already made building blocks that are independent from each other and interchangeable.

Generic Interface

The generic interface consists of a multiple layer framework that lets OTRS communicate with other systems via a web service. This communication could be bi-directional:

  • OTRS as provider: OTRS acts as a server listening to requests from the external system, processing the information, performing the requested action, and answering the request.
  • OTRS as requester: OTRS acts as a client collecting information, sending the request to the remote system, and waiting for the response.

Generic Interface Layers

The generic interface is build based on a layer model, to be flexible and easy to customize.

A layer is a set of files, which control how the generic interface performs different parts of a web service. Using the right configuration, one can build different web services for different external systems without creating new modules.

Note

If the remote system does not support the current bundled modules of the generic interface, special modules need to be developed for that specific web service.

Generic Interface Layers

Generic Interface Layers

Network Transport

This layer is responsible for the correct communication with the remote system. It receives requests and generates responses when acting as provider, and generates requests and receives responses when acting as requester.

Requester communication could be initiated during an event triggered by a generic interface module or any other OTRS module. This event is caught by the event handler and depending on the configuration the event will be processed directly by the requester object or delegated to the scheduler (a separated daemon designed to process tasks asynchronously).

Data Mapping

This layer is responsible for translating data structures between OTRS and the remote system (data internal and data external layers). Usually remote systems have different data structures than OTRS (including different values and names for those values), and here resides the importance of the layer to change the received information into something that OTRS can understand and on the opposite way send the information to each remote system using their data dictionaries.

Example: Priority (OTRS) might be called Prio in a remote system and it could be that value 1 very low (OTRS) should be mapped to Information in the remote system.

Controller

Controllers are collections of similar operations or invokers. For example, a ticket controller might contain several standard ticket operations. Custom controllers can be implemented, for example a TicketExternalCompany controller which may contain similar functions as the standard ticket controller, but with a different data interface, or function names (to adapt to the remote system function names) or complete different code.

One application for generic interface could be to synchronize information with one remote system that only can talk with another remote system of the same kind. In this case new controllers needs to be developed and the operations and invokers has to emulate the remote system behavior in such way that the interface that OTRS exposes is similar to the interface of the remote system.

Operation (OTRS as a provider)

An operation is a single action that can be performed within OTRS. All operations have the same programming interface, they receive the data into one specific parameter, and return a data structure with a success status, potential error message and returning data.

Normally operations uses the already mapped data (internal) to call core modules and perform actions in OTRS like: create a ticket, update a user, invalidate a queue, send a notification, etc. An operation has full access to the OTRS API to perform the action.

Invoker (OTRS as a requester)
An invoker is an action that OTRS performs against a remote system. Invokers use the OTRS core modules to process and collect the needed information to create the request. When the information is ready it has to be mapped to the remote system format in order to be sent to the remote system, that will process the information, execute the action and send the response back, to either process the success or handle errors.

Generic Interface Communication Flow

The generic interface has a defined flow to perform actions as a provider and as a requester. These flows are described below:

OTRS as Provider

Remote Request:

  1. HTTP request
    • OTRS receives HTTP request and passes it through the layers.
    • The provider module is in charge to execute and control these actions.
  2. Network transport
    • The network transport module decodes the data payload and separates the operation name from the rest of the data.
    • The operation name and the operation data are returned to the provider.
  3. Data external
    • Data as sent from the remote system (this is not a module based layer).
  4. Mapping
    • The data is transformed from the external system format to the OTRS internal format as specified in the mapping configuration for this operation (mapping for incoming request data).
    • The already transformed data is returned to the provider.
  5. Data internal
    • Data as transformed and prepared to be passed to the operation (This is not a module based layer).
  6. Operation
    • Receives and validates data.
    • Performs user access control.
    • Executes the action.

OTRS Response:

  1. Operation
    • Returns result data to the provider.
  2. Data internal
    • Data as returned from operation.
  3. Mapping
    • The data is transformed back to the remote system format as specified in the mapping configuration (mapping for outgoing response data).
    • The already transformed data is returned to the provider.
  4. Data external
    • Data as transformed and prepared to be passed to network transport as response.
  5. Network transport
    • Receives the data already in the remote system format.
    • Constructs a valid response for this network transport type.
  6. HTTP response
    • The response is sent back to the web service client.
    • In the case of an error, an error response is sent to the remote system (e.g. SOAP fault, HTTP error, etc).

OTRS as Requester

OTRS Request:

  1. Event trigger handler

    • Based on the web service configuration determines if the request will be synchronous or asynchronous.

      • Synchronous

        • A direct call to the requester is made in order to create a new request and to pass it through the layers.
      • Asynchronous

        • Create a new generic interface (requester) task for the OTRS daemon (by delegating the request execution to the scheduler daemon, the user experience could be highly improved, otherwise all the time needed to prepare the request and the remote execution will be added to the OTRS events that trigger those requests).
        • In its next cycle the OTRS daemon process reads the new task and creates a call to the requester that will create a new request and then passes it through the layers.
  2. Invoker

    • Receives data from the event.
    • Validates received data (if needed).
    • Call core modules to complement the data (if needed).
    • Return the request data structure or send a stop communication signal to the requester, to gracefully cancel the request.
  3. Data internal

    • Data as passed from the invoker (this is not a module based layer).
  4. Mapping

    • The data is transformed to the remote system format as specified in the mapping configuration (mapping for outgoing response data).
    • The already transformed data is returned to the requester.
  5. Data external

    • Data as transformed and prepared for sending to the remote system.
  6. Network transport

    • Receives the remote operation name and the data already transformed to the remote system format from the requester.
    • Constructs a valid request for the network transport.
    • Sends the request to the remote system and waits for the response.

Remote Response:

  1. Network transport
    • Receives the response and decodes the data payload.
    • Returns the data to the requester.
  2. Data external
    • Data as received from the remote system.
  3. Mapping
    • The data is transformed from the external system format to the OTRS internal format as specified in the mapping configuration for this operation (mapping for incoming response data).
    • The already transformed data is returned to the requester.
  4. Data internal
    • Data as transformed and ready to be passed back to the requester.
  5. Invoker
    • Receives return data.
    • Handles the data as needed specifically by each invoker (included error handling if any).
    • Return the Invoker result and data to the Requester.
  6. Event handler or OTRS daemon
    • Receives the data from the requester. In the case of the OTRS daemon this data might contain information to create a task in the future.

Manage Web Services

A web service is a communication method between two systems, in our case OTRS and a remote system.

The heart of the web service is its configuration, where it is defined what actions the web service can perform internally (operation), what actions the OTRS request can perform remote system (invokers), how data is converted from one system to the other (mapping), and over which protocol the communication will take place (transport).

The generic interface is the framework that makes it possible to create web services for OTRS in a predefined way, using already made building blocks that are independent from each other and interchangeable.

Use this screen to manage web services in the system. A fresh OTRS installation contains no web service by default. The web service management screen is available in the Web Services module of the Processes & Automation group.

Web Service Management Screen

Web Service Management Screen

To create a web service:

  1. Click on the Add Web Service button in the left sidebar.
  2. Fill in the required fields.
  3. Click on the Save button.
Create New Web Service Screen

Create New Web Service Screen

To edit a web service:

  1. Click on a web service in the list of web services.
  2. Modify the fields.
  3. Click on the Save or Save and finish button.
Edit Web Service Screen

Edit Web Service Screen

To delete a web service:

  1. Click on a web service in the list of web services.
  2. Click on the Delete Web Service button in the left sidebar.
  3. Click on the Delete button in the confirmation dialog.
Delete Web Service Screen

Delete Web Service Screen

To clone a web service:

  1. Click on a web service in the list of web services.
  2. Click on the Clone Web Service button in the left sidebar.
  3. Enter a new name for the web service.
Clone Web Service Screen

Clone Web Service Screen

To export a web service:

  1. Click on a web service in the list of web services.
  2. Click on the Export Web Service button in the left sidebar.
  3. Choose a location in your computer to save the Export_ACL.yml file.

Warning

All stored passwords in the web service configuration will be exported in plain text format.

To see the configuration history of a web service:

  1. Click on a web service in the list of web services.
  2. Click on the Configuration History button in the left sidebar.
Web Service Configuration History Screen

Web Service Configuration History Screen

To use the debugger for a web service:

  1. Click on a web service in the list of web services.
  2. Click on the Debugger button in the left sidebar.
Web Service Debugger Screen

Web Service Debugger Screen

To import a web service:

  1. Click on the Add Web Service button in the left sidebar.
  2. Click on the Import Web Service button in the left sidebar.
  3. Click on the Browse… button in the dialog.
  4. Select a previously exported .yml file.
  5. Add a name for the imported web service (optional). Otherwise the name will be taken from the configuration file name.
  6. Click on the Import button.

Web Service Settings

The web service configuration needs to be saved on each level. This means that if a setting is changed, links to other, deeper parts of the configuration will be disabled forcing you to save the current configuration level. After saving the disabled links will be re-enabled again allowing you to continue with the configuration.

The following settings are available when adding or editing this resource. The fields marked with an asterisk are mandatory.

General Web Service Settings

Web Service Settings - General

Web Service Settings - General

The following settings are available when adding or editing this resource. The fields marked with an asterisk are mandatory.

Name *
The name of this resource. Any type of characters can be entered to this field including uppercase letters and spaces. The name will be displayed in the overview table.
Description
Like comment, but longer text can be added here.
Remote system
This field can be used to add a description for the remote system.
Debug threshold

The default value is Debug. When configured in this manner all communication logs are registered in the database. Each subsequent debug threshold value is more restrictive and discards communication logs of lower order than the one set in the system.

Debug threshold levels (from lower to upper):

  • Debug
  • Info
  • Notice
  • Error
Validity
Set the validity of this resource. Each resource can be used in OTRS only, if this field is set to valid. Setting this field to invalid or invalid-temporarily will disable the use of the resource.

Provider Web Service Settings

Web Service Settings - OTRS as Provider

Web Service Settings - OTRS as Provider

The following settings are available when adding or editing this resource. The fields marked with an asterisk are mandatory.

Network transport

Select which network transport would you like to use with the web service. Possible values are HTTP::REST and HTTP::SOAP.

Note

After selecting the transport method, you have to save the configuration with clicking on the Save button. A Configuration button will be displayed next to this field.

Configuration
The Configuration button is visible only, after a network transport was selected and saved. See the configuration for OTRS as Provider - HTTP::REST and OTRS as Provider - HTTP::SOAP below.
Add Operation

This option is visible only, after a network transport was selected and saved. Selecting an operation will open a new screen for its configuration.

Web Service Settings - OTRS as Provider - Operation

Web Service Settings - OTRS as Provider - Operation

OTRS as Provider - HTTP::REST

The configuration might be a bit more complicated, as it grows dynamically for each configured operation by adding route mapping for each operation and valid request methods for each operation to the default transport settings.

Web Service Settings - OTRS as Provider - HTTP\:\:REST

Web Service Settings - OTRS as Provider - HTTP::REST

The following settings are available when adding or editing this resource. The fields marked with an asterisk are mandatory.

Route mapping for Operation ‘<OperationName>’ *

Define the route that should get mapped to this operation. Variables marked by a : will get mapped to the entered name and passed along with the others to the mapping (e.g. /Ticket/:TicketID).

In this setting a resource path is set. This path must be defined according to the needs of the web service considering that the path in conjunction with the HTTP request method determines the generic interface operation to be executed.

Path can contain variables in the form of :<VariableName>. Each path string that fits on the position of the variable name will be added to the request payload using the variable name defined in this setting. Examples:

Valid requests for /Resource route mapping:

https://localhost/otrs/nph-genericinterface.pl/Webservice/Test/Resource
https://localhost/otrs/nph-genericinterface.pl/Webservice/Test/Resource?Param1=One

Invalid requests for /Resource route mapping:

https://localhost/otrs/nph-genericinterface.pl/Webservice/Test/Resource/
https://localhost/otrs/nph-genericinterface.pl/Webservice/Test/Resource/OtherResource
https://localhost/otrs/nph-genericinterface.pl/Webservice/Test/Resource/OtherResource?Param1=One

Valid requests for /Resource/:ID route mapping:

https://localhost/otrs/nph-genericinterface.pl/Webservice/Test/Resource/1
https://localhost/otrs/nph-genericinterface.pl/Webservice/Test/Resource/1?Param1=One

In both cases ID = 1 will be sent to the operation as part of the payload. In the second case also Param1 = One will be added, depending on the HTTP request method other parameters will be added if they come as a JSON string in the request header.

Invalid requests for /Resource/:ID route mapping:

https://localhost/otrs/nph-genericinterface.pl/Webservice/Test/Resource
https://localhost/otrs/nph-genericinterface.pl/Webservice/Test/Resource?Param1=One

Valid requests for /Resource/OtherResource/:ID/:Color route mapping:

https://localhost/otrs/nph-genericinterface.pl/Webservice/Test/Resource/OtherResource/1/Red
https://localhost/otrs/nph-genericinterface.pl/Webservice/Test/Resource/OtherReosurce/123/Blue?Param1=One

In the first example ID = 1 and Color = Red, while in the second ID = 123 and Color = Blue.

Invalid requests for /Resource/OtherResource/:ID/:Color route mapping:

https://localhost/otrs/nph-genericinterface.pl/Webservice/Test/Resource/1
https://localhost/otrs/nph-genericinterface.pl/Webservice/Test/Resource/OtherResource/1
https://localhost/otrs/nph-genericinterface.pl/Webservice/Test/Resource/OtherResource/1?Param1=One

In the first example the part of the path /OtherResource is missing as well as the :Color variable. In the second example just the :Color variable is missing.

Valid request methods for Operation ‘<OperationName>’

Limit this operation to specific request methods. If no method is selected all requests will be accepted.

The HTTP request methods to determine the operation to use together with the route mapping, possible options: CONNECT, DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT and TRACE.

Totally different operations can share exactly the same mapping path, but the request method must be unique for each operation, in order to determine correctly the operation to use on each request.

Maximum message length *
Specifies the maximum size (in bytes) for REST messages that OTRS will process.
Send Keep-Alive *
This configuration defines if incoming connections should get closed or kept alive.

Optionally, you may want to define additional response headers. These may be used to add static header values to every response. Just click on the Add response header button and fill both key and value fields. There is no limit in number of additional header lines.

OTRS as Provider - HTTP::SOAP

It is quite simple to configure the HTTP::SOAP protocol as provider.

Web Service Settings - OTRS as Provider - HTTP\:\:SOAP

Web Service Settings - OTRS as Provider - HTTP::SOAP

The following settings are available when adding or editing this resource. The fields marked with an asterisk are mandatory.

Namespace *
URI to give SOAP methods a context, reducing ambiguities.
Maximum message length *
Specifies the maximum size (in bytes) for SOAP messages that OTRS will process.

Optionally, you may want to define additional response headers. These may be used to add static header values to every response. Just click on the Add response header button and fill both key and value fields. There is no limit in number of additional header lines.

Any other settings are self-explanatory and have default values.

Web Service Operation

The actions that can be performed when you are using OTRS as a provider are called operations. Each operation belongs to a controller. Controllers are collections of operations or invokers, normally operations from the same controller need similar settings and share the same configuration dialog. But each operation can have independent configuration dialogs if needed.

Add Web Service Operation Screen

Add Web Service Operation Screen

The following settings are available when adding or editing this resource. The fields marked with an asterisk are mandatory.

Name *
The name of this resource. Any type of characters can be entered to this field including uppercase letters and spaces. The name will be displayed in the overview table.
Description
Add additional information to this resource. It is recommended to always fill this field as a description of the resource with a full sentence for better clarity, because the description will be also displayed in the overview table.
Operation backend

This OTRS operation back end module will be called internally to process the request, generating data for the response.

The operation back end is pre-populated and cannot be edited. You will see this parameter when you choose the operation on the web service edit screen. The field is only informative.

Mapping for incoming request data
The request data will be processed by this mapping, to transform it to the kind of data OTRS expects.
Mapping for outgoing response data
The response data will be processed by this mapping, to transform it to the kind of data the remote system expects.
Include Ticket Data
Whether to include ticket data in response or not.

Mappings are fields that normally appear on every operation, but other special fields can appear in non default configuration dialogs to fulfill specific needs of the operation.

Normally there are two mapping configuration sections for each operation, one for the incoming data and another one for the outgoing data. You can choose different mapping types (back ends) for each mapping direction, since their configuration is independent from each other and also independent from the operation back end. The normal and most common practice is that the operation uses the same mapping type in both cases (with inverted configuration). The complete mapping configuration is done in a separate screen which depends on the mapping type.

In the left part of the screen on the action column you have the options to go back to web service (discarding all changes since the last save) and delete. If you click on the last one, a dialog will open and ask you if you like to remove the operation. Click on the Delete button to confirm the removal of the operation and its configuration or click on the Cancel button to close the delete dialog.

Requester Web Service Settings

The network transport configuration for the requester is similar to the configuration for the provider.

Web Service Settings - OTRS as Requester

Web Service Settings - OTRS as Requester

The following settings are available when adding or editing this resource. The fields marked with an asterisk are mandatory.

Network transport

Select which network transport would you like to use with the web service. Possible values are HTTP::REST and HTTP::SOAP.

Note

After selecting the transport method, you have to save the configuration with clicking on the Save button. A Configuration button will be displayed next to this field.

Configuration

The Configuration button is visible only, after a network transport was selected and saved. See the configuration for OTRS as Requester - HTTP::REST and OTRS as Requester - HTTP::SOAP below.

It is possible to use both object and array format as a JSON response of the remote system. However, in the case it is an array, system stores it as an object internally, where ArrayData is used as a key and a value is an array. Because of that, responded JSON array can be mapped efficiently, but has to be considered as an object described above (key is ArrayData, but * can also be used as wildcard).

Add error handling module

This option is visible only, after a network transport was selected and saved. Selecting an operation will open a new screen for its configuration.

Web Service Settings - OTRS as Provider - Error Handling Module

Web Service Settings - OTRS as Provider - Error Handling Module

OTRS as Requester - HTTP::REST

In the case of HTTP::REST, this configuration also grows dynamically depending on the configured invokers. Authentication and SSL options are similar to the ones in HTTP::SOAP.

Web Service Settings - OTRS as Requester - HTTP\:\:REST

Web Service Settings - OTRS as Requester - HTTP::REST

The following settings are available when adding or editing this resource. The fields marked with an asterisk are mandatory.

Endpoint *
URI of the remote system to indicate specific location for accessing a web service.
Authentication
An optional authentication mechanism to access the remote system. Select an authentication mechanism from the list and additional fields will appear.
Controller mapping for Invoker ‘<InvokerName>’ *

In this setting a resource path is set. This path must be defined according to the needs of the remote web service and following its definition.

Path can contain variables in the form of :<VariableName> for each variable name that matches the current data (to be sent), will be replaced by the corresponding data value. This matched variable names and values will be removed from the current data. Depending on the HTTP request command the remaining data could be sent as a JSON string in the request body or as query parameters within the URI.

Examples for data Var1 = One, Var2 = Two, Var3 = Three and Var4 = Four.

  • Controller mapping: /Resource, after replacements: /Resource, remaining data: Var1 = One, Var2 = Two, Var3 = Three and Var4 = Four
  • Controller mapping: /Resource/:Var1, after replacements: /Resource/One, remaining data: Var2 = Two, Var3 = Three and Var4 = Four
  • Controller mapping: /Resource/:Var1?Param1=:Var2&Var3=:Var3, after replacements: /Resource/One?Param1=Two&Var3=Three, remaining data: Var4 = Four
Valid request command for Invoker ‘<InvokerName>’
This determines the HTTP request method to use. Possible options: CONNECT, DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT and TRACE. If no command is selected, Default command is used.
Default command
Used as a fall-back for all invokers without a defined request command.

Any other settings are self-explanatory and have default values.

OTRS as Requester - HTTP::SOAP

For the requester HTTP::SOAP network transport there are more fields to be set.

Web Service Settings - OTRS as Requester - HTTP\:\:SOAP

Web Service Settings - OTRS as Requester - HTTP::SOAP

The following settings are available when adding or editing this resource. The fields marked with an asterisk are mandatory.

Endpoint *
URI of the remote system to indicate specific location for accessing a web service.
Namespace *
URI to give SOAP methods a context, reducing ambiguities.
Encoding
The character encoding for the SOAP message contents.
Authentication
An optional authentication mechanism to access the remote system. Select an authentication mechanism from the list and additional fields will appear.

Any other settings are self-explanatory and have default values.

Web Service Invoker

The actions that can be performed when you are using OTRS as a requester are called invokers. Each invoker belongs to a controller (controllers are collections of operations or invokers). Usually invokers from the same controller need similar settings and share the same configuration dialogs. Each invoker can have independent configuration dialogs if needed.

Add Web Service Invoker Screen

Add Web Service Invoker Screen

The following settings are available when adding or editing this resource. The fields marked with an asterisk are mandatory.

Name *
The name of this resource. Any type of characters can be entered to this field including uppercase letters and spaces. The name will be displayed in the overview table.
Description
Add additional information to this resource. It is recommended to always fill this field as a description of the resource with a full sentence for better clarity, because the description will be also displayed in the overview table.
Invoker backend

This OTRS invoker back end module will be called to prepare the data to be sent to the remote system, and to process its response data.

The invoker back end is pre-populated and cannot be edited. You will see this parameter when you choose the invoker on the web service edit screen. The field is only informative.

Mapping for outgoing request data
The data from the invoker of OTRS will be processed by this mapping, to transform it to the kind of data the remote system expects.
Mapping for incoming response data
The response data will be processed by this mapping, to transform it to the kind of data the invoker of OTRS expects.

Additionally the list of event triggers and other special fields can appear on non default configuration dialogs to fulfill special needs of the invoker.

Normally there are two mapping configuration sections for each invoker, one for the incoming data and another one for the outgoing data. You can choose different mapping types (back ends) for each mapping direction, since their configuration is independent from each other and also independent from the invoker back end. The normal and most common practice is that the invoker uses the same mapping type in both cases, with inverted configuration. The complete mapping configuration is done in a separate screen, which depends on the mapping type.

Event triggers are events within OTRS such as TicketCreate, ArticleSend, etc. These can act as triggers to execute the invoker. Each invoker needs to have at least one event trigger registered, or the invoker will be useless, because it will never be called. Additionally a set of rules (conditions) for each event can be defined to have more control over the triggering of the events. These rules depend on the data of the object associated with the event. The asynchronous property of the event triggers define if the OTRS process will handle the invoker or if it will be delegated to the OTRS daemon.

Note

The OTRS daemon is a separate set of process that executes tasks in the background. Using this the OTRS process itself will not be affected if the remote system takes a long time to respond, if it is not available or if there are network problems. If you do not use the OTRS daemon using web services can make OTRS slow or non-responsive. Therefore it is highly recommend to use asynchronous event triggers as often as possible.

To add an event trigger, first select the event family from the first list, then the event name from the second list, then set the asynchronous property (if unchecked means that the event trigger will not be asynchronous) and finally click on the plus button. A new event trigger will be created and it will be listed on the invoker event triggers list.

From the event triggers list each events shows if it contains conditions or not. The edit button next to the condition property allows to add or edit the current conditions of the event.

To delete an event trigger, simply locate the event trigger to be deleted in the event triggers list and click on the trash icon at the end of the row. This will open a dialog that asks you if you are sure to delete the event trigger. Click on the Delete button to remove the event trigger from the list, or click on the Cancel button to close the dialog.

In the left part of the screen on the action column you have the options to go back to web service (discarding all changes since the last save) and delete. If you click on the last one, a dialog will open and ask you if you like to remove the invoker. Click on the Delete button to confirm the removal of the invoker and its configuration or click on the Cancel button to close the delete dialog.

Web Service Invoker Event

Sometimes defining an event to trigger an invoker could result in many unnecessary or wrong request to a remote server. Event conditions could be set to restrict the triggering of the invoker in such cases.

Add Web Service Invoker Event Screen

Add Web Service Invoker Event Screen

To access the event settings screen where the conditions can be defined is necessary to be in the invoker screen and from there click on the edit icon next to the condition status on the event where this condition should take effect.

Within the event settings screen in the action bar there is a button to go back to the invoker screen as well as a button to remove all the event conditions. By default the screen is pre-populated with the first condition. Update the type of linking between conditions if more than one condition is planned, then change the type of linking from Condition 1 if more than one field is planned. Both linking fields accept and, or or xor as values.

Fill the field name, set the matching type (String for exact match, Regexp for regular expression or Validation Module) and set the value to match (in case of validation module the full class name like Kernel::GenericInterface::Event::Validation::ValidateDemo).

To add more fields to the condition, click on the plus button in the fields header. To remove a field, click on the minus button in the field row. It is necessary to keep at least one field per condition.

To add more conditions click on the button below the last condition box. To remove a condition, click on the minus button in the condition header. It is necessary to keep at least one condition in the set. To remove all conditions use the button in the sidebar.

Web Service Mapping

There are cases where you need to transform the data from one format to another (map or change data structure), because normally a web service is used to interact with a remote system, that is highly probable that is not another OTRS system and/or could not understand the OTRS data structures and values. In these cases some or all values have to be changed, and sometimes even the names of the values (keys) or even the complete structure, in order to match with the expected data on the other end. To accomplish this task the generic interface mapping layer exists.

Simple Web Service Mapping

Simple Web Service Mapping

Each remote system has it own data structures and it is possible to create new mapping modules for each case (e.g. there is a customized mapping module for SAP Solution Manager available as feature add-on), but it is not always necessary. The module Mapping::Simple should cover most of the mapping needs.

Note

When the Mapping::Simple does not cover all mapping needs for a web service, a new mapping module should be created.

This module gives you the opportunity to set default values to map for each key or value for the whole communication data.

At the beginning of the screen you will see a general section where you can set the default rules that will apply for all the unmapped keys and values. There are three options available, these options are listed below:

Keep (leave unchanged)
It does not touch the keys or values in any way.
Ignore (drop key/value pair)
When this is applied to the key it deletes the key and value, because when a key is deleted then in consequence its associated value is deleted too. When this is applied to the value, only the value is deleted, keeping the key, that now will be associated to an empty value.
Map to (use provided value as default)
All keys and/or values without a defined map rule will use this as default. When you select this option a new text field will appear to set this default.

Clicking on the plus button for new key map will display a new box for a single mapping configuration. You can add as many key mappings as needed. Just click on the plus button again and a new mapping box will appear below the existing one. From this mapping boxes you can define a map for a single key, with the next options:

Exact value(s)
The old key string will be changed to a new one if the old key matches exactly.
Regular expression
The key string will be replaced following a regular expression rule.

Pressing the new value map plus button will display a new row for a value map. Here it is also possible to define rules for each value to be mapped with the same options as for the key map (exact value and regular expression). You can add as many values to map as needed, and if you want to delete one of them, just click on the minus button for each mapping value row.

Deleting the complete key mapping section (box) is possible, just push on the minus button located on the up right corner of each box that you want to delete.

If you need to delete a complete mapping configuration, go back to the corresponding operation or invoker screen, look for the mapping direction that you select before and set its value to -, and save the configuration to apply the changes.

It is possible to define XSLT templates for mapping.

XSLT Web Service Mapping

XSLT Web Service Mapping