Calling WebClient from an External Application

Calling WebClient from an External Application

This section demonstrates how to pass a parameter to WebClient function. The following example is based on wxpcourse60 model calling the function WXwF, which prompts the user to insert an item record.

The first step is to create a URL which calls the insert item function, without parameters. To accomplish this, open file and add the following property.

Now, the servlet will respond to the URL /WebClientServlet/InsertItem by calling the function WXPCOURSE60.WXwF as the WebClient entry point. However, it does not yet allow parameters to be passed.

To pass parameters in, a custom servlet needs to be created. Open J2EE perspective. Right-click on web project → Select New → Select Servlet.
Enter deeplink as the Java package and Class name. For the servlet mapping, specify InsertItem. Click Finish.

In the WebClient documentation folder, there exists a sample custom servlet, called, which will help you create a servlet that sends parameters to a Plex function. Copy and paste the code from to the newly created servlet. Change the package name to deeplink.

Change the class name to deeplink.

The parameters are passed to WebClient using an XML format. Locate the variable plexXML in the source code; this contains the XML data that is sent. Modify the input variable name and field name to match those expected by the WXwF function.

final String plexXML = " <FieldName=\"ItemID\">"+ encodeToXML(myVariable) + final String plexXML = "<PlexFunction
<InputVariables Name=\"Input\"><FieldName=\"ItemID\">"+
encodeToXML(myVariable) +

Modify webClient URL from final String webclientURL =
"/webclient/test"; to final String webclientURL =

Now the InsertItem servlet will forward its requests to the WebClient servlet. Save changes.
The last change that needs to be made is the servlet mapping. It needs to have the characters /* at the end to match against any parameter that is passed in the URL. Open web.xml and change deeplink servlet mapping to


And WebClientServletservlet mapping to


The web.xml file should look like below.

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="
xsi:schemaLocation=" id="WebApp_ID"
Calling WebClient from an External Application
C M W e b C l i e n t U s e r M a n u a l P a g e 49 | 93

Save changes.
Build the web project and publish to the server.
To call the function, open a web browser and enter the following URL. http://localhost:8080/wxpcourse60web/InsertItem/001
URL format:

    • Related Articles

    • WebClient Manual

      Here you can find the articles of the CM WebClient user manual, just click on the name and it will take you directly to the article. Introduction Installation Requirements Plex Model Configuration Overview of Workspace Setup Calling WebClient from an ...
    • Deploying a WebClient application as a WAR file

      You can deploy your WebClient application by exporting it to a WAR file and then publish it to a Tomcat server, to do this follow these steps: Installing the Tomcat server service a. Download the Tomcat service installer from the Tomcat official page ...
    • CM WebClient for CM M3

      Pre-requisites CA Plex dispatcher – The System i TCP/IP Dispatcher is required when the transformed applications call external iSeries objects (RPG, CL programs) Properties Configuration This is the file were the AS400 ...
    • Application Deployment with Android Devices

      The following steps assume you have already created a WebClient Mobile application. The process describes the steps to perform the installation of Cordova/PhoneGap, adding the necessary plugins, configure the application launch, create and setup the ...
    • Download WebClient Trial Software

      The WebClient Trial Software is a Live Installer application currently in development, which provides one with a self-contained WebClient solution with a trial license.  If you want to find out more about what WebClient can do for you or your ...