Invoking Output Service (transformPDF) via SOAP

This tutorial provides a simple example of how to call a LiveCycle service from ColdFusion using SOAP. The article specifically calls the transFormPDF method of the OutputService, however provides the basics for calling any service.

Normally the preferred method of invoking LiveCycle services from ColdFusion is probably using the EJB, sometimes this can be difficult and SOAP provides a simple solution, although not the most robust.

Using the SOAP enoint requires knowledge of the specific WSDL file for the desired service. A list of WSDL file locations can be found here.

<!— Change OutputServiceURL to match your environment —>
< cfset OutputServiceURL = "">

<!— Change SourceFileName to point to a PDF Form —>
<cfset SourceFileName = "C:\Temp\Test.pdf">

<!— Convert the PDF Form to Binary, BASE64 —>
<cffile action="READBINARY" file="#SourceFileName#" variable="sourcePDF">
<cfset binaryData = ToBase64(sourcePDF, "iso-8859-1")>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:SOAP-ENC="" xmlns:xsi="" xmlns:xsd="">
<m:transformPDF xmlns:m="">

<!— Invoke the Web Service —>
<cfhttp url="#OutputServiceURL#" method="POST" username="administrator" password="password">
<cfhttpparam type="CGI" name="SOAPAction" value="transformPDF">
<cfhttpparam type="XML" name="transformPDFRequest" value="#SoapRequestXML#">

<!— Parse the Result —>
<cfset SoapResponseXML = #cfhttp.filecontent#>
<cfset SoapResponseXML = xmlParse(SoapResponseXML)>
<cfset theRoot = SoapResponseXML.XmlRoot>
<cfset readerEnabledPDF = ‘#theRoot.XmlChildren[1].XmlChildren[1].XmlChildren[1]["remoteURL"].XmlText#’>

<a href="#readerEnabledPDF#" target="_blank">Transformed PDF</a>

You can also download the source here Download Source