Tuesday, 27 September 2016

Command Line Adapter 2 to execute Java Code in Sterling Integrator

Using Command Line Adapter we can run a java program in a business process. We run programs, perl scripts, OS commands.
To work out this we must have JVM in the machine where Sterling integrator is installed.

To execute java program in Sterling Integrator first check the java program working or not through command with this line.

java -jar C:\Users\PDFToXML\dist\PDFToXML.jar C:\53_Map_Editor.pdf D:\data.xml
I am passing two parameters. One is input file and other one is output file.

Then write the bat file like this.
 pdftoxml.bat
java -jar C:\Users\miracle\Desktop\test\PDFToXML\dist\PDFToXML.jar %1 %2

Note: % for windows, $ for Linux

%1 is Input file %2 is Output file.

Configuring Command Line Adapter
In cmdLine option write like this
C:\Users\pdftoxml.bat $Input $Output



 Give input Name:(i.e input file path)
Give outputName(i.e Output file path)
 Make useInput and useOutput true saying that we are sending input and ouput file path.
The other requirement is we need to send primary document to this Command Line adapter. If we didn't give path for inputName (inputpath). Then Primary Document is the input for this service. Otherwise inputName(inputpath) is replaced with Primary Document.

BPML:



<process name="CommandLineAdapterSample">
  <operation name="Command Line 2 Adapter">
    <participant name="CommandLineAdapter2"/>
    <output message="CmdLine2InputMessage">
      <assign to="." from="*"></assign>
      <assign to="cmdLine">C:\Users\pdftoxml.bat $Input $Output</assign>
      <assign to="inputName">C:\53_Map_Editor.pdf</assign>
      <assign to="outputName">C:\data.xml</assign>
      <assign to="successValue">0</assign>
      <assign to="useInput">true</assign>
      <assign to="useOutput">true</assign>
    </output>
    <input message="inmsg">
      <assign to="." from="*"></assign>
    </input>
  </operation>

</process>

 It shows Success value 0 if this bp is success.


 If find any issues regarding please leave comment.



No comments:

Post a Comment