The URL to the Create Correspondence user interface accepts
a parameter named cmDataUrl that corresponds to a URL that
returns an XML data in response. The Create Correspondence user
interface uses the returned XML data as the Initial XML Data (IXD)
to render the Letter.
You can launch the Create Correspondence user interface with
data from an external source using one of the following ways:
Direct URL to the data sourceIf the Create Correspondence application’s XML data is
accessible through a direct URL, then the cmDataUrl can directly
point to that hosted URL. Create Correspondence tries to retrieve
the XML data from this URL and render the correspondence.
Data from a CRX repositoryXML data can also be stored in the CRX repository. The
path to the repository is given to the Create Correspondence application
using the crx:// protocol. For example, if the necessary XML data
is stored at /content/correspondence/data/test.xml, then the URL
to launch the Create Correspondence application would be http://<server>:<port>/content/cm/createcorrespondence.html?<usual request
parameters>&cmDataUrl=crx://content/correspondence/data/test.xml.
Using a custom servletTo integrate with the custom data source, by implementing
a custom servlet, you must:
Write a custom HTTP servlet that retrieves the XML data
from the content provider. Return the retrieved XML data in the
servlet's "response".
When calling the Create Correspondence URL, set the value
of cmDataUrl as the URL to your servlet.
For example, if the servlet is created within the correspondence
management application and is mapped to the URL /CustomDataUrl,
then the URL to the Create Correspondence user interface would be http://<server>:<port>/content/cm/createcorrespondence.html?<usual request parameters>&cmDataUrl=http://<server>:<port>/apps/solutions/cm/CustomDataUrl.
Note: You can host the custom servlet from within the Correspondence
Management application itself, or on different web server.
Since the URL given as the cmDataUrl is just another HTTP
URL. It can have its own set of request parameters that retrieve
data from the content provider. For example, to retrieve the data
for a customer with the SSN "1234", the URL to the Create Correspondence
user interface would be http://<server>:<port>/content/cm/createcorrespondence.html?<usual request
parameters>&cmDataUrl=http://<server>:<port>/apps/solutions/cm/CustomDataUrl?ssn=1234.
The following is a sample servlet that returns a hard-coded XML: package sample;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import java.io.*;
public class CustomDataUrl extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
response.setContentType("text/xml");
PrintWriter out = response.getWriter();
// Replace the below line with an invocation to an external/legacy data source/API.
String xml = "<?xml version='1.0' encoding='UTF-8'?><F><P1><WCCFileNumber>9875</WCCFileNumber><SSN>3459837</SSN></P1></F>";
// Write to the response stream
out.println(xml);
out.close();
}
}
Using an orchestrationTo feed the Create Correspondence user interface with an
appropriate Initial XML Data to render the letter, you could also
use an orchestration-based approach: Write an orchestration
(process) that retrieves the XML data from the content provider
(if not already available in the process) and saves this XML data
in the CRX repository at a given location.
The process then returns the URL to the data file (the CRX
path of the saved file, which is similar to crx://<path to the
XML>).
Before calling the Create Correspondence user interface, your
correspondence management application calls the orchestration, and
captures the response/output of the process (which is the above
path to the data file).
Call the Create Correspondence user interface by setting the
value of the cmDataUrl as the returned path to the file. Note: An
inXDP document (which is a processed XDP document) can be passed
for post processing and used in conjunction with an inXMLDocument
to create printer-ready output. This workflow is completed using
the generatePrintedOutput operation of the OutputService and supports
use cases such as generating PCL output.
|
|
|