Expand my Community achievements bar.

Calling Form Server from WorkFlow Server

Avatar

Former Community Member
I am calling Agent.createPDF(sData, sTemplate, bIsDynamic) to generate a PDF from WorkFlow in an OnComplete script. But I am getting the error below...



Failed to execute the OnComplete script of Task, "Return to Pupil".



There was an error while calling the Adobe Form Server.



WorkFlow and Form Server are on the same physical server. FSSamples and other Form Server functions appear to be working correctly.



Before I work with technical support... does anyone have any things I (and the systems administrator) should look at before tech support?



ALSO... if anyone is familiar with generating a PDF... do you know if I can set security and encryption with this or another call. I couldn't find anything in the on-line manuals.



Thanks,

jra
2 Replies

Avatar

Former Community Member
function GeneratePDF(){

//Get the XML data

var XMLData = getXMLfromXFA();



//Call Form Server to generate the static PDF

var outputData = callFS(XMLData, "IT_RO", "PDFForms");



//Write the PDF out to the file system

var pdfFile = writePDF(outputData);

}



//*************************************************************************

// Function : callFS()

// Description : SOAP call to Form Server

// Parameters : MergeData,formName, pref (PDF, PDFForms)

// Returns : Returns the outputContext.

//*************************************************************************

function callFS(MergeData, formName, pref)

{

var fs = new ActiveXObject("FormServer.SoapClient");

fs.SoapEndPoint = "http://"+ ADOBE_WORKFLOW_SERVER_NAME + ":8080/soaprequest"

fs.GetFormEx("FormQuery=" + formName + "&FormPreference=" + pref + "&LockPDF=1","", ADOBE_URL_REPOSITORY_DIR, ADOBE_URL_REPOSITORY_DIR, MergeData, "",ADOBE_PHYSICAL_REPOSITORY_DIR );



//var oFileSys = new ActiveXObject("COMFILE.COMFILE");

//oFileSys = null;

var ThePDF = fs.OutputContext.OutputContent;

fs = null;

return(ThePDF);

}



function writePDF(OUT)

{



var f, oFileSys;

var oFileSys = new ActiveXObject("Scripting.FileSystemObject");

var strExt = ".pdf";

var strFileName = WorkItem.formName + strExt;



//Identify Parent path

var f = oFileSys.FolderExists(ADOBE_TEMP_DIR);



if (f != true)

{

f.add(ADOBE_TEMP_DIR);

}



f = oFileSys.GetFolder(ADOBE_TEMP_DIR);



var Wout = new ActiveXObject("COMFILE.COMFILE"); //iocom.dll



Wout.WriteFile(f + "\\" + strFileName,0,OUT);

Wout = null;



//Release resource

oFileSys = null;

return(f + "\\" + strFileName);

}



//*************************************************************************

// Function : getXMLfromXFA()

// Description : Get the XML data

// Parameters : null

// Returns : XML data from XFA DOM

//*************************************************************************

function getXMLfromXFA()

{

//This format for AWS 6.1**var oNode1 = WorkItem.data.nodes.item(1);

var oNode1 = WorkItem.data.nodes.item(0);

var sXtractedXML;



// Extract the XML from Integrate's XFA data stream

if(oNode1 != null)

{

//This format for AWS 6.1**var oNode2 = oNode1.nodes.item(1);

var oNode2 = oNode1.nodes.item(0);

if(oNode2 != null)

{

sXtractedXML = oNode2.saveXML(); //returns a string representation of xml data from XFA DOM



objXMLFile = Agent.createObject("Microsoft.XMLDOM");



objXMLFile.loadXML(sXtractedXML); //loads the xml into the microsoft DOM

if (objXMLFile.parseError.errorCode != 0){

Agent.log("Code: " + objXMLFile.parseError.errorCode + "Description: " + objXMLFile.parseError.reason);

}



var xmlOut = objXMLFile.documentElement.xml;

//Release resource

objXMLFile = null;

}

}



return xmlOut;

}

Avatar

Former Community Member
JRA3,



Have not installed the two products together to test this functionality but you may want to revisit the order in which the installation was performed. Since they often share DLL versions installing them in the wrong order could prove to be an issue.



I would verify with Adobe Support in Ottawa.