In this second installment of the three part deep-linking series, we will show the steps necessary to create a simple url access (“deep link”) into any Plex function by WebClient. If you missed the first installment, the introduction to WebClient deep linking, you can access it by clicking here. Although this simple example shows a function with just one input parameter, Plex functions with complex parameter structures can be called using this technique, including functions with MOV variables. There will be more detailed information on the XML call structure used in the final installment of the series.

Please follow these steps

  1. Create a new custom servlet in your web project.

    Right-click on wxpcourse60web à select New à select Other… à expand web folder à select Servlet à type deeplink for Java package and Class name à click Finish.

  1. Edit deeplink.java

    Copy and paste the code provided (DeepLinkJavaZip) to the newly created servlet.

    Change the package name to deeplink.

    Change the class name to deeplink.

Modify input variable name and field name in the new servlet.

    final String plexXML =
"<PlexFunction xmlns="http://adcaustin.com/ws-plex/1.0">
<InputVariables
Name="Input"><Field Name="ItemID">" +
encodeToXML(myVariable) +
"</Field></InputVariables></PlexFunction>";

Modify webclient URL from

final String webclientURL = “/webclient/test”;

to

final String webclientURL = “/webclient/deeplink”;

Note: String webclientURL = the link to webclient servlet without context path

Save changes.

  1. Update wxpcourse60web libraries.

    Right-click on wxpcourse60web à select Properties à select Java Build Path à open Libraries tab à click on Add External JARs… à browse to your <WebsydianWebClient installed directory>jetty6.1.7lib folder à select servlet-api-2.5-6.1.7.jar

  2. Turn off Websydian Web Client Project Builder.

    Right-click on wxpcourse60web à select Properties à select builder à uncheck Websydian Web Client Project Builder (if checked)

  3. Add new parameter in J2eeProxy.prop file.

    Expand wxpcourse60web project à expand WebContent à expand WEB-INF à open J2eeProxy.prop file with text editor à add the following parameter

    webclient.entry.url.deeplink = WXPCOURSE60.WXwF

    Save changes.

  4. Change deeplink servlet mapping.

    Expand wxpcourse60web project à expand WebContent à expand WEB-INF à open web.xml with text editor

    Change webclient servlet mapping to

    <url-pattern>/webclient/*</url-pattern>

    Change deeplink servlet mapping to

<url-pattern>/deeplink/*</url-pattern>

Save changes.

  1. Build the project and publish to the web server.
  2. To call the function, open a web browser and enter the following URL.

http://localhost:XXXX/wxpcourse60web/deeplink/001