The URL to the Create Correspondence UI accepts a request
parameter named
cmDataUrl
, which is a URL that
returns an XML data in response. The Create Correspondence UI uses
this data as the Initial XML Data (IXD) to render the Letter.
To integrate the Create Correspondence UI to fetch and render
the letter using data from an external data source:
-
Write a custom HTTP servlet that retrieves the XML data
from the external data source. Return the retrieved XML data in
the servlet's "response".
-
When invoking the Create Correspondence URL, set the value
of the
cmDataUrl
as the URL to your servlet created
in step 1.
You can define the servlet in the correspondence management application
itself, or expose it on another web server.
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 UI would be
http://
<server>
:
<port>
/cmsa/dc?
<usual request parameters>
&cmDataUrl=http://
<server>
:
<port>
/cmsa/CustomDataUrl
Since the URL given as the
cmDataUrl
is just
another HTTP URL, it can have its own set of request parameters
that may be necessary to fetch data from the external data source.
For example, to fetch the data for a customer with the SSN "1234",
the URL to the Create Correspondence UI would be
http://
<server>
:
<port>
/cmsa/dc?
<usual request parameters>
&cmDataUrl=http://
<server>
:
<port>
/cmsa/CustomDataUrl?ssn=1234
.This
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 ReturnXml 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();
}
}