Tuesday 15 October 2019

Writing Output in XML file - EAI XML Write to File

Hello All,

I was working on a requirement where after performing a update action i needed to capture the records in a file for EOD verification.
There are multiple ways to achieve this, i used WritePropSet method of EAI XML Write to File Business service.

Approach 1: 
Use Property Set to store Output and call PropSetToXML method of EAI XML Converter Business Service , then call EAI XML Write to File Business service's WriteXMLHier method to get the final XML.

Approach 2: 
Use Property Sets to store data , in Hierarchical Format (i.e. create Property sets in a way to maintain Hierarchical structure), then call EAI XML Write to File Business service's WritePropSet method to get the final XML.

Final Code :



Storing Data in Outputs:

var outPropset1 = TheApplication().NewPropertySet() ;//for output logging
outPropset1.SetType("Processed Invoices") ;
outPropset1.SetValue("Invoice Number :"+sInvoiceNum) ;
Outputs.AddChild(outPropset1);                                                                                                 




Passing Output in EAI Write to File:

var timestamp = new Date();
var month = timestamp.getMonth() + 1;
timestamp=timestamp.getDate()+"-"+month+"-"+timestamp.getFullYear()+" "+timestamp.getHours()+":"+timestamp.getMinutes()+":"+timestamp.getSeconds();

var XMLConvertorBS = TheApplication().GetService("EAI XML Write to File");
var xInputs = TheApplication().NewPropertySet();
var xOutputs = TheApplication().NewPropertySet();
Outputs.SetProperty("FileName","/siebel_as/ses/siebsrvr/temp/ProcessReceipt"+timestamp+".xml");

XMLConvertorBS.InvokeMethod("WritePropSet",Outputs,xOutputs);                                                                                                



Final XML:

  <?xml version="1.0" encoding="UTF-8" ?>
  <?Siebel-Property-Set EscapeNames="true"?>
  <PropertySet>
  <Processed Invoices>Invoice Number :81KHH66464</Processed Invoices>
  <Processed Invoices>Invoice Number :81KHH66465</Processed Invoices>
  <Processed Invoices>Invoice Number :81KHH66466</Processed Invoices>
  <Processed Invoices>Invoice Number :81KHH66467</Processed Invoices>
  </PropertySet>


 more detailed ways of manipulating Property sets :

 http://www.siebelfoundations.com/2016/08/working-with-property-sets-in-siebel.html

No comments:

Post a Comment

Siebel GoTo View - Handling Realtime cases

 Hello All,  We all must have used GoTo view functionality of siebel to navigate to a particular view from current view. What if the require...