WSRP Configuration

From OpenQuote

Jump to: navigation, search

Contents

Accessing Products

Currently to access a product, there are three choices:

  1. Using the sandpit.
  2. Using the generic WSRP portlet WSRPQuotationPortlet (OpenQuote v2.0 and above).
  3. Configure a new standalone product portlet specifically for the product.

The sandpit is only configured to serve HTML output (so no XFORMS), and is only really intended for testing purposes.

For WSRPQuotationPortlet passing in a request parameter "openquote.product" populated with the required product name will server both HTML and XFORMS output for the product.

The leaves the configuring a standalone portlet for WSRP access, instructions for which are detailed here, along with how to enable HTML and/or XFORMS output. Some prior understanding of XML and JAR files will help.

Configuring a standalone portlet involves editing xml configuration files deep within the OpenQuote file system, so why would you want to go to this trouble if WSRPQuotationPortlet is already available? Well there could be a number of reasons, but security may be an influencing factor, perhaps you want to disable WSRPQuotationPortlet and simple configure new standalone portlets to server only certain products, or only one content type. Or perhaps you want to change WSRPQuotationPortlet so it is not remotely accessible (localhost only - for testing) and then make only specific products available remotely. What ever the reasoning, this guide details how to enable standalone portlets.

Configuring a WSRP Portlet

There are 2 configuration files that will need amending, the changes will register a new WSRP portlet for a specific product. These can be either amended in the application server (by default JBoss) directory structure, or in the source tree (which will require a build to be performed). This guide will assume the changes are being made straight into application server directory structure. The files are:

  • jboss-portlet.xml
  • portlet.xml

They can be located in the following directory (where 'openquote-community-2.0' is the installation directory for OpenQuote):

openquote-community-2.0/jboss/server/default/deploy/openquote.ear/openquote.war/WEB-INF

Depending upon your installation, openquote.ear and openquote.war may either be directories or archive files. If they are archive files, you will need to follow the UNJAR, and JAR instructions at the end of this document, going through the UNJAR steps prior to making the configuration changes, and then the JAR steps after making the changes for each archived file.

Info
  • A jar file is really just a zip file, and most zip utilities and pack and unpack jar files happily. However, the settings that the zip utility uses to pack/create a jar file may not be compatible with Java and so it is usually best to use the default Java command line tool JAR to perform jar related unpacking and packing activities. JAR instructions detailed below.

jboss-portlet.xml Configuration

Add the following xml to the file:

 <portlet-app>
  ...
  <portlet>
     <portlet-name>YourProductWSRPQuotationPortlet</portlet-name>
     <remotable>true</remotable>
  </portlet>
  ...
 </portlet-app>

Where <portlet-name> YourProductWSRPQuotationPortlet is the name of the WSRP portlet you want to create for your product, it can be any name you want, but should match the <portlet-name> in the portlet.xml.

portlet.xml Configuration

Add the following xml to the file:

 <?xml version="1.0"encoding="UTF-8"?>
 <portlet-app version="1.0"
  xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd&quot;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd
  http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd&quot;>
    ...
    <portlet>
       <description>Your Product WSRP Portlet</description>
       <portlet-name>YourProductWSRPQuotationPortlet</portlet-name>
       <display-name>Your Product WSRP Quotation</display-name>
       <portlet-class>com.ail.openquote.portlet.QuotationPortlet</portlet-class>
       <supports>
          <mime-type>text/xml</mime-type>
          <portlet-mode>VIEW</portlet-mode>
       </supports>
       <portlet-info>
          <title>Your Product Quotation Portlet</title>
          <short-title>Your Product Quotation</short-title>
          <keywords>Quotation, Portlet</keywords>
       </portlet-info>
       <portlet-preferences>
          <preference>
             <name>product</name>
             <value>Space.YourInsuranceProduct</value>
          </preference>
       </portlet-preferences>
    </portlet>
    ...
 </portlet-app>

Where <portlet-name> YourProductWSRPQuotationPortlet is the name of the WSRP portlet you want to create for your product, it can be any name you want, but should match the portlet-name in the jboss-portlet.xml.

<mime-type> should be set to 'text/xml' for XFORMS compatibility and to 'text/html' for HTML compatibility. To support more than one mime type include multiple <supports> tags as shown in this example. OpenQuote currently supports HTML and XFORMS only.

The preference value Space.YourInsuranceProduct should be set to the location for the required product as specified in the product catalogue (found in the product manager). If this value is not set, then the portlet will be able to accept a request parameter "openquote.product" populated with the required product name when requested by a consumer (in the same way that WSRPQuotationPortlet funtions).

All other highlighted values are names which can be set according to your own preferences.

UNJAR – Unpack an archive instructions

Here you have a jar file (in this case .ear or .war extension) that you need to unpack ready to make changes to.

  1. Copy the archive file from the OpenQuote server directory to a temporary location (i.e. create an empty temporary directory for the purpose).
  2. Open up the command line window on your computer.
  3. Navigate to the new temporary directory containing the archive file.
  4. Type: jar xfv <archive_filename>.
  5. The archive file will now be unpacked, with its contents being placed into the current directory (x=extract, f=filename specified, v=output progress to command line window).
  6. Close the command line window.
  7. Open the temporary directory containing the archive file – you will now see the archive file plus its unpacked contents.
  8. Make a note of the original archive file name then delete it from the temporary directory.
  9. You are now ready to continue.

JAR – Pack an archive instructions

Here you have a directory contents that you need to pack into a jar file (in this case .ear or .war extension).

  1. Open up the command line window on your computer.
  2. Navigate to the directory containing the files to be archived.
  3. Type: jar cfv <archive_filename>.
  4. The directory contents will now be archived into a file with the archive_filename specified in the jar command, this file will be save in the current directory (c=pack, f=filename specified, v=output progress to command line window).
  5. Close the command line window.
  6. Open the directory containing the new archive file – you will now see the archive file plus its unpacked contents.
  7. Copy the new archieved file, overwriting the orginal copy in the OpenQuote server directory.
  8. You are now ready to continue.
Personal tools