WSRP JSP Consumer Example Code
From OpenQuote
This page details an example JSP (Java Server Page) demonstrating how to include an OpenQuote product into a website.
Contents |
[edit] index.jsp JSP Code
<%-- Document : index - a jsp example of an OpenQuote portlet consumer This JSP is a working example of how to integrate OpenQuote products into a website. It is not necesarily demonstrating the most efficient code, or the best way to implement a JSP, but instead is designed to demonstrate as simply as possible the OpenQuote portlet integration in a way that both developers with both Java and non-Java backgrounds can understand and follow. This JSP will allow: 1. registration with an OpenQuote portal server 2. requests for the html for quotation question pages 3. submitition of answers back to the server 4. deregistration form the server For each of the above 4 process a method held in this JSP is called. Each method follows a similar set of steps: 1. get portal server registration handle 2. load an XML template for the specific service call required 3. populate the XML with the registration handle and any other required data 4. create a HTTP connection to the specific portal server service 5. pass the XML to the service 6. read the response XML from the service 7. extract required information from the response The template XML documents (located in the same location as this JSP) used by each of the 4 processes are: 1. RegisterWSRPConsumer.xml 2. RequestWSRPForm.xml 3. SubmitWSRPForm.xml 4. DeregisterWSRPConsumer.xml HTML at the bottom of this JSP allows the user to: 1. specify the OpenQuote server to connect to 2. specify which OpenQuote product they want to quote for 3. restart the quote process for a product (this simply clears a session id) 4. quote for an OpenQuote product (ie displays the portal) 5. deregister the web application from the OpenQuote server (normally automated as part of a web applications clean up code, but for simplicity is a manual button press process in this example JSP) Created on : Nov 11, 2009, 1:53:12 PM Author : matthew tomlinson --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- The various Java classes used by this JSP --> <%@ page language="java" import="javax.servlet.http.HttpSession" %> <%@ page language="java" import="javax.servlet.http.HttpServletRequest" %> <%@ page language="java" import="java.net.HttpURLConnection" %> <%@ page language="java" import="java.util.Enumeration" %> <%@ page language="java" import="java.util.Map" %> <%@ page language="java" import="java.util.List" %> <%@ page language="java" import="java.util.Hashtable" %> <%@ page language="java" import="java.util.Properties" %> <%@ page language="java" import="java.io.File" %> <%@ page language="java" import="java.io.BufferedWriter" %> <%@ page language="java" import="java.io.FileWriter" %> <%@ page language="java" import="java.io.BufferedReader" %> <%@ page language="java" import="java.io.FileReader" %> <%@ page language="java" import="java.io.IOException" %> <%@ page language="java" import="java.io.InputStream" %> <%@ page language="java" import="java.io.DataOutputStream" %> <%@ page language="java" import="javax.xml.xpath.XPathFactory" %> <%@ page language="java" import="javax.xml.xpath.XPathExpressionException" %> <%@ page language="java" import="javax.xml.xpath.XPathConstants" %> <%@ page language="java" import="javax.xml.parsers.DocumentBuilderFactory" %> <%@ page language="java" import="javax.xml.parsers.ParserConfigurationException" %> <%@ page language="java" import="org.xml.sax.InputSource" %> <%@ page language="java" import="org.xml.sax.SAXException" %> <%@ page language="java" import="org.w3c.dom.Document" %> <%@ page language="java" import="org.w3c.dom.Element" %> <%@ page language="java" import="org.w3c.dom.Node" %> <%@ page language="java" import="org.w3c.dom.ls.DOMImplementationLS" %> <%! // OpenQuote server urls used by code in this JSP, to access a different OpenQuote server edit openQuoteServer String private String openQuoteServer = "http://ec2-174-129-148-98.compute-1.amazonaws.com:8080"; private String registrationServiceUrl = openQuoteServer + "/portal-wsrp/RegistrationService"; private String markupServiceUrl = openQuoteServer + "/portal-wsrp/MarkupService"; // This is the consumer name used to register with the server (to obtain a registration handle), this name should be unique to this server private String consumerName = "TestJSPConsumer"; // This file is used to hold the Consumer Handle, this is cross session variable, and so needs to be held in a file that can be accessed by multiple user sessions private String registrationHandleFile = "registrationhandle.txt"; // This string is displayed at the top of the page and will hold (if any) soap service error details when a failure occurs private String consumerErrorMessage = ""; /** * Register the WSRP Consumer and return the consumer handle * This method first checks the application variables (ie cross user session) for a registration handle, * If one is not found, it means this web app has not yet registered itself with the portal server and so * contacts the server to register. The server will return a registration handle which this * method then stores in an application variable. * @return consumer handle * @throws IOException * @throws ParserConfigurationException * @throws SAXException * @throws XPathExpressionException */ private String getRegistrationHandle() throws IOException, ParserConfigurationException, SAXException, XPathExpressionException { // check for existing registration handle obtained by this jsp by looking in the application variables String registrationHandle = getPersistedRegistrationHandle(); // if no handle exists, register consumer to get one if (registrationHandle == null || registrationHandle.equals("")) { // load consumer registration xml template (on same url as this jsp) Document xmlDocument = loadXMLFile("/RegisterWSRPConsumer.xml"); // apply the consumer name to the registration xml template setElementInXML(xmlDocument, "//register/consumerName", consumerName); // register consumer by posting xml to OpenQuotes portal server registration service Hashtable result = postMessage(registrationServiceUrl, xmlDocument, null); Document soapReturnXML = (Document) result.get("xml"); // extract and return consumer handle from the registration service response (XML) registrationHandle = getElementFromXML(soapReturnXML, "//registerResponse/registrationHandle/text()"); // set an application variable to hold the registration handle for later reuse persistRegistrationHandle(registrationHandle); } // return the registration handle to the caller return registrationHandle; } /** * Deregister the WSRP Consumer * This method deregisters this web application from the OpenQuote portal server if currently registered * @throws IOException * @throws ParserConfigurationException * @throws SAXException * @throws XPathExpressionException */ private void deregisterConsumer() throws IOException, ParserConfigurationException, SAXException, XPathExpressionException { // get the registration handle for the web app from the application variables (set up by getRegistrationHandle) String registrationHandle = getPersistedRegistrationHandle(); // if a registration handle exists, deregister this web application with the OpenQuote portlet server if (registrationHandle != null && !registrationHandle.equals("")) { // load consumer deregistration xml template (on same url as this jsp) Document xmlDocument = loadXMLFile("/DeregisterWSRPConsumer.xml"); // apply the registration handle to the consumer deregistration xml template setElementInXML(xmlDocument, "//deregister/registrationHandle", registrationHandle); // deregister consumer by posting xml to OpenQuotes portal server registration service Hashtable result = postMessage(registrationServiceUrl, xmlDocument, null); // finally, for neatness, remove the now redundent application variable holding the old registration handle persistRegistrationHandle(""); } } /** * Request a WSRP form from the producer * This service returns the HTML genterated for the OpenQuote quotation pages * @param session JSP user session object * @return quotation portlet HTML * @throws IOException * @throws ParserConfigurationException * @throws SAXException * @throws XPathExpressionException */ private String requestWSRPForm(HttpSession session) throws IOException, ParserConfigurationException, SAXException, XPathExpressionException { // get product to request form for from jsp session variables, make certain it is not null String productToRequest = (String) session.getAttribute("OpenQuoteProduct"); if (productToRequest == null) { productToRequest = ""; } // get sessionID for product from jsp session variable String sessionID = (String) session.getAttribute(productToRequest + ".ProductSessionID"); // load request markup xml template (on same url as this jsp) Document xmlDocument = loadXMLFile("/RequestWSRPForm.xml"); // apply the registration handle to the request markup xml template setElementInXML(xmlDocument, "//registrationContext/registrationHandle", getRegistrationHandle()); // set name/value pairs for service request header parameters Properties headers = new Properties(); // set openquote product request property up so correct product HTML is returned headers.setProperty("openquote.product", productToRequest); // set user session id request property up (if one exists) so correct stage in the quotation process is returned // if one doesn't exist, the quotation process will start from the start, and a new session id will be generated and returned in the response if (sessionID != null && !sessionID.equals("")) { headers.setProperty("Cookie", sessionID); } // get the quotation HTML by posting xml to OpenQuotes portal server markup service Hashtable result = postMessage(markupServiceUrl, xmlDocument, headers); Document soapReturnXML = (Document) result.get("xml"); // get sessionID from response header if required (ie was not previously set) if (sessionID == null || sessionID.equals("")) { Map soapReturnHeader = (Map) result.get("header"); if(soapReturnHeader!=null){ // get the response header field containing the session id List list = (List) soapReturnHeader.get("Set-Cookie"); if(list!=null && !list.isEmpty()){ sessionID = (String) list.get(0); // extract the session id part (the Set-Cookie value looks like this 'JSESSIONID=AF9AA35D62ADBDC7E71DB0A03C04E710; Path=/') int start = sessionID.indexOf("JSESSIONID"); int end = sessionID.indexOf(";", start); sessionID = sessionID.substring(start, end); // set a session variable to hold the new session id for later reuse session.setAttribute(productToRequest + ".ProductSessionID", sessionID); } } } // extract the portlet quotation page HTML from the xml returned by the markup service String markupHTML = getElementFromXML(soapReturnXML, "//markupContext/markupString/text()"); if (markupHTML == null || markupHTML.equals("")) { markupHTML = ""; } // make certain that the form action in the HTML is pointing to this jsp by overwriting the default portal action // with this jsp's details this will ensure all submitted question pages will get sent back to this JSP markupHTML = markupHTML.replaceAll("action='wsrp_rewrite", "action='index.jsp"); // update all src urls (images, javascript files etc) in the HTML so they point to the full openquote server url markupHTML = markupHTML.replaceAll("src='/quotation/", "src='" + openQuoteServer + "/quotation/"); // return the quotation portal HTML to the caller return markupHTML; } /** * Submit a WSRP form to the producer * This service submits all form fields entered in the quotation portal part of the web page to OpenQuote server for validation * @param session JSP session object * @param request JSP request object * @throws IOException * @throws ParserConfigurationException * @throws SAXException * @throws XPathExpressionException */ private void submitWSRPForm(HttpSession session, HttpServletRequest request) throws IOException, ParserConfigurationException, SAXException, XPathExpressionException { // get product to request form for from jsp session variables, make certain it is not null String productToRequest = (String) session.getAttribute("OpenQuoteProduct"); if (productToRequest == null) { productToRequest = ""; } // get sessionID for product from jsp session variable String sessionID = (String) session.getAttribute(productToRequest + ".ProductSessionID"); // load submit form xml template (on same url as this jsp) Document xmlDocument = loadXMLFile("/SubmitWSRPForm.xml"); // apply the registration handle to the submit form xml template setElementInXML(xmlDocument, "//registrationContext/registrationHandle", getRegistrationHandle()); // add the submitted fields from the openquote portal form to the submit form xml template // each field should be added to the interactionParams element in the following structure: // <ns1:interactionParams> // <ns1:formParameters name='fieldName1'><ns1:value>enteredValue1</ns1:value></ns1:formParameters> // <ns1:formParameters name='fieldName1'><ns1:value>enteredValue1</ns1:value></ns1:formParameters> // </ns1:interactionParams> // firstly get all the names of submitted fields Enumeration fieldNames = request.getParameterNames(); // next, for each submitted field while (fieldNames.hasMoreElements()) { // get name of the field and its value as entered on the web page String fieldName = (String) fieldNames.nextElement(); String fieldValue = (String) request.getParameter(fieldName); // if the submitted field value is not null, add it to the submit form xml if (fieldValue != null) { // add a formParameter element to the interactionParams element on submit form xml Element formParametersElement = addElementToXML(xmlDocument, "//interactionParams[1]", "ns1:formParameters"); // add a name attribute equal to the field name to the new formParameter element formParametersElement.setAttribute("name", fieldName); // add a value element formParameter element Element valueElement = addElementToXML(xmlDocument, "//interactionParams/formParameters[@name='" + fieldName + "']", "ns1:value"); // set the value element with a text content equal to the submitted field value setElementInXML(xmlDocument, "//interactionParams/formParameters[@name='" + fieldName + "']/value", fieldValue); } } // set name/value pairs for service request header parameters Properties headers = new Properties(); // set openquote product request property up so correct product HTML is returned headers.setProperty("openquote.product", productToRequest); // set user session id request property up (if one exists) so correct stage in the quotation process is returned // if one doesn't exist, the quotation process will start from the start, and a new session id will be generated and returned in the response if (sessionID != null && !sessionID.equals("")) { headers.setProperty("Cookie", sessionID); } // post submitted form xml to OpenQuotes portal server markup service Hashtable result = postMessage(markupServiceUrl, xmlDocument, headers); } /** * Load an xml file into a parsed document object (used for various requests made to portlet server) * the file is assumed to be located on the same path as this jsp * @param fileName Name of file to load * @return xml document * @throws IOException * @throws ParserConfigurationException * @throws SAXException */ private Document loadXMLFile(String fileName) throws IOException, ParserConfigurationException, SAXException { // open file from same url as this jsp & read into XML parser InputStream is = getServletContext().getResourceAsStream(fileName); Document xmlDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(is); return xmlDocument; } /** * Convert a parsed xml deocument into a string * @param xmlDocument the xml document to convert into a string * @return xml string * @throws IOException * @throws ParserConfigurationException * @throws SAXException */ private String convertXMLDocumentToString(Document xmlDocument) throws IOException, ParserConfigurationException, SAXException { // convert an XML document to a string DOMImplementationLS lsImp = (DOMImplementationLS) xmlDocument.getImplementation(); String xml = lsImp.createLSSerializer().writeToString(xmlDocument); return xml; } /** * Extract an element from an xml document using and xpath expression * @param xmlDocument xml document to navigate * @param xpath element xpath location * @return element value * @throws XPathExpressionException */ private String getElementFromXML(Document xmlDocument, String xpath) throws XPathExpressionException { // run an xpath expression over an xml document to get an elements content String elementValue = ""; if (xmlDocument != null) { elementValue = XPathFactory.newInstance().newXPath().evaluate(xpath, xmlDocument); } return elementValue; } /** * Set an element value in an xml document using and xpath expression * @param xmlDocument xml document to navigate * @param xpath element xpath location * @param elementValue element value to set in XML * @throws XPathExpressionException */ private void setElementInXML(Document xmlDocument, String xpath, String elementValue) throws XPathExpressionException { // run an xpath expression over an xml document to get an element Node node = (Node) XPathFactory.newInstance().newXPath().evaluate(xpath, xmlDocument, XPathConstants.NODE); // set the extractged elements content node.setTextContent(elementValue); } /** * Add an element to an xml document using and xpath expression * @param xmlDocument xml document to navigate * @param xpath element xpath location * @param elementTag element tag to add to XML * @return Element added * @throws XPathExpressionException */ private Element addElementToXML(Document xmlDocument, String xpath, String elementTag) throws XPathExpressionException { // run an xpath expression over an xml document to get an element Node node = (Node) XPathFactory.newInstance().newXPath().evaluate(xpath, xmlDocument, XPathConstants.NODE); // create the required new element for the xml document Element childElement = xmlDocument.createElement(elementTag); // add the new element to the selected node node.appendChild(childElement); // return the created element to the caller return childElement; } /** * Post an xml message to a specified HTTP connection and read the response (ie contact a portal sevice) * @param urlString Portal service HTTP url * @param xmlToSend xml message document to post to connection * @param headerVariables key value pairs for header variables * @return response respose header variables and xml document * @throws IOException * @throws ParserConfigurationException * @throws SAXException */ private Hashtable postMessage(String urlString, Document xmlToSend, Properties headerVariables) throws IOException, ParserConfigurationException, SAXException { // Create the HTTP Connection to a URL java.net.URL programUrl = new java.net.URL(urlString); java.net.HttpURLConnection connection = (java.net.HttpURLConnection) programUrl.openConnection(); // set up the connection for portal service calls (for Soap use POST and text/xml content) connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setDoInput(true); connection.setUseCaches(false); connection.setRequestProperty("Content-Type", "text/xml"); // add additional header properties to connection request properties if (headerVariables != null) { Enumeration propertyNames = headerVariables.propertyNames(); while (propertyNames.hasMoreElements()) { String propertyName = (String) propertyNames.nextElement(); connection.setRequestProperty(propertyName, headerVariables.getProperty(propertyName)); } } // convert the xml document to a string and write it to the HTTP connection. String xmlString = convertXMLDocumentToString(xmlToSend); DataOutputStream output = new DataOutputStream(connection.getOutputStream()); output.writeChars(xmlString); output.flush(); // close output stream to connection when xml has been sent to url output.close(); // get the input stream from the http connection to read the response xml InputStream istr; // normally a responce code of 500 is not expected, but due to a bug in Java, non localhost connections // can generate this code incorrectly and return the response in the connection error stream if (connection.getResponseCode() != 500) { istr = connection.getInputStream(); } else { // error from server & java bug for external urls means error 500 // can be thrown incorrectly, so the valid input stream is here instead istr = connection.getErrorStream(); } // hashtable to hold results Hashtable results = new Hashtable(); // read the xml response from the connection Document resultXML = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(istr); results.put("xml", resultXML); // read response header variables results.put("header", connection.getHeaderFields()); // check result xml for a soap fault (error) checkForSoapFault(resultXML); // return the response header variables and xml document return results; } /** * Report error details of a soap fault response * @param soapResponseXML **/ private void checkForSoapFault(Document soapResponseXML) { // check for soap fault // if soap fault found // extract the faultcode, faultstring and faultactor from the service response (XML) String faultCode; try { faultCode = getElementFromXML(soapResponseXML, "//faultcode/text()"); } catch (XPathExpressionException noFaultCode) { faultCode = ""; } String faultString; try { faultString = getElementFromXML(soapResponseXML, "//faultstring/text()"); } catch (XPathExpressionException noFaultString) { faultString = ""; } String faultActor; try { faultActor = getElementFromXML(soapResponseXML, "//faultactor/text()"); } catch (XPathExpressionException noFaultActor) { faultActor = ""; } if (!faultCode.equals("") || !faultString.equals("") || !faultActor.equals("")) { // output error details to console consumerErrorMessage = consumerErrorMessage + "SOAP ERROR REPORTED" + "<BR>\n"; consumerErrorMessage = consumerErrorMessage + "faultCode: " + faultCode + "<BR>\n"; consumerErrorMessage = consumerErrorMessage + "faultString: " + faultString + "<BR>\n"; consumerErrorMessage = consumerErrorMessage + "faultActor: " + faultActor + "<BR>\n"; } } /** * Save the registration handle for use outside of a single user session * @param registrationHandle Registration handle value * @throws IOException failed file read **/ private void persistRegistrationHandle(String registrationHandle) throws IOException { // set an application variable to hold the registration handle for later reuse getServletContext().setAttribute("RegistrationHandle", registrationHandle); // write the handle to a file to persist permanently File file = new File(registrationHandleFile); // Create file if it does not exist boolean fileExists = file.exists(); if (!fileExists) { // File did not exist and was created fileExists = file.createNewFile(); } // update the file with the registration handle if (fileExists) { BufferedWriter output = new BufferedWriter(new FileWriter(file)); output.write(registrationHandle); output.close(); } } /** * Get the persisted registration handle * @return String registration handle * @throws IOException failed file read **/ private String getPersistedRegistrationHandle() throws IOException { String registrationHandle = (String) getServletContext().getAttribute("RegistrationHandle"); // id not available in servlet context, load from value persisted in file if(registrationHandle==null || registrationHandle.equals("")){ File file = new File(registrationHandleFile); // if file exists read content boolean fileExists = file.exists(); if (fileExists) { BufferedReader in = new BufferedReader(new FileReader(file)); registrationHandle = in.readLine(); in.close(); } if(registrationHandle==null){ registrationHandle=""; } } return registrationHandle; } %> <% // process page request.setCharacterEncoding("UTF-8"); consumerErrorMessage = ""; // get the current registrationHandle being used for connection to the OpenQuote portal server (for display on the page) String registrationHandle = ""; try { registrationHandle = getPersistedRegistrationHandle(); } catch (Exception error) { // if error occurs output details to console System.out.println("get persisted registration handle error"); error.printStackTrace(); } // get OpenQuote product being currenly accessed if (session.getAttribute("OpenQuoteProduct") == null) { session.setAttribute("OpenQuoteProduct", ""); } String openQuoteProduct = (String) session.getAttribute("OpenQuoteProduct"); // get session id being used for current product if (session.getAttribute(openQuoteProduct + ".ProductSessionID") == null) { session.setAttribute(openQuoteProduct + ".ProductSessionID", ""); } String productSessionId = (String) session.getAttribute(openQuoteProduct + ".ProductSessionID"); // initialise variable to hold OpenQuote portal HTML for inclusion on web page String openQuotePageHTML = ""; // check to see if product has been changed by user (and changeProduct submit button pressed) if (request.getParameter("changeProduct") != null && !openQuoteProduct.equals(request.getParameter("openquote.product"))) { // if so set new product as the product to be quoted for openQuoteProduct = request.getParameter("openquote.product"); session.setAttribute("OpenQuoteProduct", openQuoteProduct); // different products require different session ids, // so look to see if a sessionID has previosly been used for the newly selected product // if one hasn't, then it will be cleared and setup during the next Markup Requester service call productSessionId = (String) session.getAttribute(openQuoteProduct + ".ProductSessionID"); } // check to see if restart quote process has been selected by user if (request.getParameter("resetProduct") != null) { // to restart a quote process, simply clear the session id for the product // so the next Markup Request service call is forced to generate a new one session.setAttribute(openQuoteProduct + ".ProductSessionID", ""); productSessionId = ""; } // deregister consumer test button // normally the deregister process would be completed autmatically by code when the // web application is stopped, but for simplicity a manual button press controls the process here. if (request.getParameter("deregister") != null) { // deregister the consumer try { deregisterConsumer(); } catch (Exception error) { // if error occurs output details to console System.out.println("deregister error"); error.printStackTrace(); // force clear the application variable registration handle persistRegistrationHandle(""); } // finally, for neatness, clear the old registration handle variable registrationHandle = ""; session.setAttribute("OpenQuoteProduct", ""); openQuoteProduct = ""; } // if the submit was none of the above (ie not new product or restart quote process, or deregistration) // then assume it was a portal submit and pass the form parameters to OpenQuote if (!request.getParameterMap().isEmpty() && request.getParameter("changeProduct") == null && request.getParameter("resetProduct") == null && request.getParameter("deregister") == null) { // open submit if a product is selected if (openQuoteProduct != null && !openQuoteProduct.equals("")) { // submit the openquote portlet form to the portal markup request service try { submitWSRPForm(session, request); } catch (IOException error) { // if error occurs output details to console System.out.println("submit portal form error"); error.printStackTrace(); } } } // Request the next page from the OpenQuote portal if a product has been previously specifed if (openQuoteProduct != null && !openQuoteProduct.equals("")) { // get the openquote product form HTML from the portal markup request service try { openQuotePageHTML = requestWSRPForm(session); } catch (IOException error) { // if error occurs output details to console System.out.println("request portal form error"); error.printStackTrace(); } // if this is the first time (or a restart) of the quote process, // then get the new session id returned fron the portal markup request service (for display on page) if (productSessionId == null || productSessionId.equals("")) { productSessionId = (String) session.getAttribute(openQuoteProduct + ".ProductSessionID"); } // if this is the first time the cosumer has accessed the portal // then get the new registrationHandle (for display on page) if (registrationHandle == null || registrationHandle.equals("")) { registrationHandle = getRegistrationHandle(); } } %> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> <script type="text/javascript"></script> <title>OpenQuote Portlet Consumer Example using JSP</title> </head> <body> <%=consumerErrorMessage%> <h1>OpenQuote Portlet Consumer Example using JSP</h1> <p> This JSP is using the generic portlet provided by OpenQuote. </p> <p> The consumer registration handle is <%=registrationHandle%>. </p> <p> The users session id is <%=productSessionId%> </p> <form NAME='setup' METHOD="POST" ACTION="index.jsp"> <%if (registrationHandle != null && !registrationHandle.equals("")) {%> <br/> <input TYPE="submit" name="deregister" value="Deregister Consumer <%=registrationHandle%>" /> Normally this sould be done by the web application as part of its clean up code when it is stopped, however for the purposes of this simple demonstration it is a manual process <br/> <%}%> <br/> Please enter product to quote for (i.e. AIL.Demo.MotorPlus): <br/> Product: <input NAME="openquote.product" value="<%=openQuoteProduct%>" /> <input TYPE="submit" name="changeProduct" value="Change product" /> <%if (openQuoteProduct != null && !openQuoteProduct.equals("")) {%> <input TYPE="submit" name="resetProduct" value="Restart quote process for <%=openQuoteProduct%>" /> <%}%> </form> <%if (openQuoteProduct != null && !openQuoteProduct.equals("")) {%> <h1>Quote for <%=openQuoteProduct%></h1> <%}%> <%=openQuotePageHTML%> </body> </html>
[edit] RegisterWSRPConsumer.xml XML Document
<?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> <env:Header /> <env:Body> <ns1:register xmlns:ns1="urn:oasis:names:tc:wsrp:v1:types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ns1:consumerName>TestJSPConsumer</ns1:consumerName> <ns1:consumerAgent>TestJSP.1.0</ns1:consumerAgent> <ns1:methodGetSupported>false</ns1:methodGetSupported> </ns1:register> </env:Body> </env:Envelope>
[edit] DeregisterWSRPConsumer.xml XML Document
<?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:oasis:names:tc:wsrp:v1:types"> <env:Header/> <env:Body> <ns1:deregister> <ns1:registrationHandle></ns1:registrationHandle> </ns1:deregister> </env:Body> </env:Envelope>
[edit] RequestWSRPForm.xml XML Document
<?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> <env:Header /> <env:Body> <ns1:getMarkup xmlns:ns1="urn:oasis:names:tc:wsrp:v1:types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ns1:registrationContext> <ns1:registrationHandle></ns1:registrationHandle> </ns1:registrationContext> <ns1:portletContext> <ns1:portletHandle>quotation.WSRPQuotationPortlet</ns1:portletHandle> </ns1:portletContext> <ns1:runtimeContext> <ns1:userAuthentication>wsrp:none</ns1:userAuthentication> <ns1:portletInstanceKey>portletinstance</ns1:portletInstanceKey> <ns1:namespacePrefix>portlet_space</ns1:namespacePrefix> </ns1:runtimeContext> <ns1:userContext xsi:nil="1" /> <ns1:markupParams> <ns1:secureClientCommunication>false</ns1:secureClientCommunication> <ns1:locales>en-GB</ns1:locales> <ns1:mimeTypes>text/html</ns1:mimeTypes> <ns1:mode>wsrp:view</ns1:mode> <ns1:windowState>wsrp:normal</ns1:windowState> <ns1:clientData> <ns1:userAgent>Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-GB;rv:1.9.0.3) Gecko/2008092414 Firefox/3.0.3</ns1:userAgent> </ns1:clientData> </ns1:markupParams> </ns1:getMarkup> </env:Body> </env:Envelope>
[edit] SubmitWSRPForm.xml XML Document
<?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> <env:Header/> <env:Body> <ns1:performBlockingInteraction xmlns:ns1="urn:oasis:names:tc:wsrp:v1:types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ns1:registrationContext> <ns1:registrationHandle></ns1:registrationHandle> </ns1:registrationContext> <ns1:portletContext> <ns1:portletHandle>quotation.WSRPQuotationPortlet</ns1:portletHandle> </ns1:portletContext> <ns1:runtimeContext> <ns1:userAuthentication>wsrp:none</ns1:userAuthentication> <ns1:portletInstanceKey>portletinstance</ns1:portletInstanceKey> <ns1:namespacePrefix>portlet_space</ns1:namespacePrefix> </ns1:runtimeContext> <ns1:userContext xsi:nil="1"/> <ns1:markupParams> <ns1:secureClientCommunication>false</ns1:secureClientCommunication> <ns1:locales>en-GB</ns1:locales> <ns1:mimeTypes>text/html</ns1:mimeTypes> <ns1:mode>wsrp:view</ns1:mode> <ns1:windowState>wsrp:normal</ns1:windowState> <ns1:clientData> <ns1:userAgent>Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-GB; rv:1.9.0.3) Gecko/2008092414 Firefox/3.0.3</ns1:userAgent> </ns1:clientData> </ns1:markupParams> <ns1:interactionParams> <ns1:portletStateChange>cloneBeforeWrite</ns1:portletStateChange> </ns1:interactionParams> </ns1:performBlockingInteraction> </env:Body> </env:Envelope>

