SI_Examples

Sterling Integrator examples like bpml, user exits, java code, extended rules codes, XSLT or any other type of code used in SI.
Mirjana's picture

Document Keyword Replace Service - example

 

  • How to add CRLF after tilde (~) in order to make a segments separated by new lines rather than a stream:
 
<process name="default">
          <sequence>
                   <operation name="Document Keyword Replace">
                             <participant name="EMEA_DocKeywordReplace"/>
                             <output message="DocKeywordReplaceInputMessage">
                                      <assign to="." from="*"/>
                                      <assign to="literal_mode">true</assign>
                                      <assign to="keyword1">7E</assign>
                                      <assign to="replace1">7E0D0A</assign>
                                      <assign to="keywordtype1">hex</assign>
                                      <assign to="replacetype1">hex</assign>
                             </output>
                             <input message="inmsg">
                                      <assign to="." from="*"/>
                             </input>
                   </operation>
          </sequence>
</process>
 
  • Remove CRLF from a document:
 
<process name="default">
          <sequence>
                   <operation name="Document Keyword Replace">
                             <participant name="EMEA_DocKeywordReplace"/>
                             <output message="DocKeywordReplaceInputMessage">
                                      <assign to="." from="*"/>
                                      <assign to="literal_mode">true</assign>
                                      <assign to="keyword1">0D0A</assign>
                                      <assign to="replace1"  to="string('')></assign>
                                      <assign to="keywordtype1">hex</assign>
                             </output>
                             <input message="inmsg">
                                      <assign to="." from="*"/>
                             </input>
                   </operation>
          </sequence>
</process>
 
 
Mirjana's picture

Google Translation - Java Task

Java Code for Google Translation
 
Code does not have to be defined as a class or a method in a class. It is a pure java code, similar to content of a method. Imports must be included to resolve all the types used in the code.
 
********************************************
 
import com.sterlingcommerce.woodstock.workflow.Document;
 
import java.io.InputStream;
import java.io.InputStreamReader;
 
import java.io.BufferedReader;
 
import com.google.api.GoogleAPI;
import com.google.api.translate.Language;
import com.google.api.translate.Translate;
 
 
                   Document document = new Document();
         
                   Document srcDoc = wfc.getPrimaryDocument();
                   InputStream is = srcDoc.getInputStream();
                  
                   BufferedReader br = new BufferedReader(new InputStreamReader(is));
                                               
                   String sourceLanguage = "ENGLISH";
                   String targetLanguage = "CROATIAN";
                  
                   String text = null;
                   String translatedText = null;       
                   StringBuffer contents = new StringBuffer();
 
                   GoogleAPI.setHttpReferrer("http://code.google.com/p/google-api-translate-java/");
 
                   // repeat until all lines is read
                         
                   while ((text = br.readLine()) != null) {
                            
                            translatedText = Translate.execute(text, Language.valueOf(sourceLanguage), Language.valueOf(targetLanguage) );
                            contents.append(translatedText + "\n");
                                 
                   }
                       
    br.close();
                   
    document = wfc.newDocument();
                   document.setBody(contents.toString().getBytes());
                                               
                   wfc.setAdvancedStatus("Translated!");
                   wfc.setBasicStatus(000);
                            
                   wfc.putPrimaryDocument(document);
                   return "000";
 
********************************************
 
Java Task Service configuration
 
Java code is added as Inline, it can also be referenced to a file!
 
 
Business Process
 
 
Input File
 
Welcome to the World of Integration.
Wish you a nice day!
 
Result after BP execution:
 
 
Note: Special characters are not shown properly, but an input is translated from English to Croatian!!
Mirjana's picture

Google Translator - Custom Service

Note: Prerequisite is to have MESA Developer Studio installed!!!
 
In MESA Developer Studio SDK, you have access to certain java classes for use in creating custom services and adapters. You can find detailed information about each class in the MESA Studio javadocs,
which are located in the install_dir/install/studiodocs folder of your application installation. The classes are grouped by functional area:
 
• ASI (Application Server Independence)
• IFC (Integration Framework Collection)
• AFC (Application Framework Collection)
 
The MESA Developer Studio SDK is designed as an Eclipse plugin and is installed locally on your computer. Use the SDK to create a service, build and export a service package within the Eclipse development environment, then install and test it with the application.
 
Start MESA Developer Studio SDK
 
Launch Eclipse >> Window menu >> Open Perspective >> Other >> MESA Developer Studio SDK
 
If this is the first time you have launched SDK, you are asked to enter licensing information.
• Hostname – the application server name
• Webdav Port - WebDAV port number for your application server
• Name - descriptive name for this instance
• Username - application username
Password - password for your username
 
>> Click Finish
 
Create a new SDK project
 
New >> Project … >> MESA Developer Studio >> MESA Developer Studio SDK Project
 
  
 
Write the name of the project:
 
 
 
 
 
 
 
 
Here is the package and structure created in eclipse:
 
 
Add a business logic (2 ways)
 
  1. Show Window menu >> Show View >> Other >> General >> Tasks
 
 
TODO will appear in the right side in Tasks and you can double click on it and start implementing your code
 
 
 
  1. In the Package Explorer, under src > com.mypackage, find the folder called yourservicenameImpl.java, and doubleclick it.
 
You can go to method processData
 
 
 
The code for the project will be displayed in the Eclipse editor. Find the line // TODO: Start here to implement the service logic.”
 
 
We will add a custom code here a little bit later.
 
First we will add google translator package (google-api-translate-java-0.92.jar) into the path.
 
Right click in the package >> Build Path >> Configure build path ... >> Libraries tab >> Add External JARs ... add google-api-translate-java-0.92.jar (or any newer version you can find at http://code.google.com/p/google-api-translate-java/ )
 
 
 
Available languages in google translator:
 
 
Define parameters:
 
Package Explorer >> project (e.g. googleTranslator) >> servicedefs >> [service name].xml >> right click … Open With … Service Definition Editor
 
 
Creating parameters:
 
Right click on any and/or every parameter group type and select New Group
 
Creating variable in any of parameters group:
 
Right click on a group title and select New Vardef
 
We chose select HTML type for every language and languauges options, and added 3 languages in Options as you can see below:
 
 
 
 
 
Change service label name
 
Package Explorer >> project (e.g. googleTranslator) >> ui >> properties >> lang >> en [project]_en.properties (e.g. googleTranslator_en.properties)
 
#
# googleTranslator Language File
#
# SERVICESDK_GUID=MIRJANA.F4bd107b8.12ebe36c477.F8000
 
googleTranslator.label.MIRJANA.F4bd107b8.12ebe36c477.F8000=googleTranslator
googleTranslator.description.MIRJANA.F4bd107b8.12ebe36c477.F8000=Theserviceimplements...
 
  
Import google translator packages into code:
 
package com.mypackage;
 
import java.text.MessageFormat;
 
import com.sterlingcommerce.woodstock.services.IService;
import com.sterlingcommerce.woodstock.services.XLogger;
import com.sterlingcommerce.woodstock.workflow.WorkFlowContext;
import com.sterlingcommerce.woodstock.workflow.WorkFlowException;
 
import com.google.api.GoogleAPI;
import com.google.api.translate.Language;
import com.google.api.translate.Translate;
 
  
Variable declaration:



private String srcDocString = null;
 
      private String sourceLanguage = null;
      private String targetLanguage = null;
      private String translatedText = null;
 
      private Document document;
      private InputStream inputStream;
      private OutputStream outputStream;
     
      private BufferedInputStream bis;
      private BufferedOutputStream bos;
           
      String chunk = null;
 
Service code:
 
// TODO: Start here to implement the service logic
                 
                  sourceLanguage = wfc.getParm("Source Language").toString();           
                  targetLanguage = wfc.getParm("Target Language").toString();
                 
                  if (sourceLanguage == null) {
                        wfc.setBasicStatus(1);
                        wfc.setAdvancedStatus("Source Language was not chosen. It is a required parameter!");
                        log.logError("Missing sourceLanguage parameter ...");
                        thrownew WorkFlowException("Missing parameter");
                  }
                 
                 
                  if (targetLanguage == null) {
                        wfc.setBasicStatus(2);
                        wfc.setAdvancedStatus("Target Language was not chosen. It is a required parameter!");
                        log.logError("Missing targetLanguage parameter ...");
                        thrownew WorkFlowException("Missing parameter");
                  }
                  Document srcDoc = wfc.getPrimaryDocument();
                 
                 
                  if (srcDoc == null) {
                        wfc.setBasicStatus(3);
                        wfc.setAdvancedStatus("Primary Document is missing. This service requires the primary Document!");
                        log.logError("Missing PrimaryDocument ...");
                        thrownew WorkFlowException("Missing PrimaryDocument");
                  }
                  inputStream = srcDoc.getInputStream();
                  bis = new BufferedInputStream(inputStream);
                  byte[] buffer = newbyte[1024];
                  int bytesRead = 0;
                
                 //Keep reading from the file while there is any content
                 //when the end of the stream has been reached, -1 is returned
                 while ((bytesRead = bis.read(buffer)) != -1) {
                    
                     //Process the chunk of bytes read
                     //in this case we just construct a String and print it out
                     chunk = new String(buffer, 0, bytesRead);
                 }
                
                 System.out.println("MIRJANA GOOGLE TRANSLATION ... chunk --> " + chunk);
           
           
                 
                 
                  GoogleAPI.setHttpReferrer("http://code.google.com/p/google-api-translate-java/");
                  try {
                        translatedText = Translate.execute(chunk, Language.valueOf(sourceLanguage), Language.valueOf(targetLanguage));
                        } catch (Exception ex) {
                        ex.printStackTrace();
                        }
                 
                        document = wfc.newDocument();
                        outputStream = document.getOutputStream();
                       
                        bos = new BufferedOutputStream(outputStream);
                        bos.write(translatedText.getBytes());
                       
                        System.out.println("MIRJANA GOOGLE TRANSLATION ... translatedText --> " + translatedText);
                       
                        wfc.setAdvancedStatus("Translated!");
                        wfc.setBasicStatus(000);
                       
                        bos.close();
                        wfc.putPrimaryDocument(document);
 
Build a service package
 
>> select the project you want to export in the Package Explorer
>> Right-click and select Export
>> In the Export window, select Mesa Studio > Service Packages as the export destination and
click Next
>> Browse to select the destination directory
>> Click Finish. The service package service name_version.jar is built and placed in the selected package folder/service name/dist/service name folder
 
The service is now ready to be installed into the application.
 
Install and run the service in an application test instance
 
>> MESA Studio perspective >> choose the application instance where the service will be Installed >> Right-click and choose Install Service Package
>> Browse and select the package file. Click Open
>> Click Finish to begin the installation of the service on the application instance
>> After the service package is installed, restart the application instance
>> Log in to the application and ensure that the service definition can be viewed and configured by using the options available from the Deployment > Services > Configuration screen
 
Service in a BP
 
 
 
  • This is what the find command found for all “Google files” in SI system:
 
[si@lin2 install]$ find . -name *oogle*
./properties/services/googleTranslator.xml
./properties/lang/en/googleTranslator_en.properties
./noapp/deploy/dashboard/webapp/search/images/google.gif
./noapp/deploy/dashboard_OLD/webapp/search/images/google.gif
./installed_data/patch/components/gis/components/neo/exploded_wars/dash
./installed_data/gis/components/neo/exploded_wars/dashboard/search/imag
./installed_data/GoogleTranslator_CustomService
./installed_data/GoogleTranslator_CustomService/ui/properties/lang/en/g
./installed_data/GoogleTranslator_CustomService/servicedefs/googleTrans
./installed_data/GoogleTranslator_CustomService/jars/GoogleTranslator_C
./installed_data/GoogleTranslator_CustomService/jars/GoogleTranslator_C                 stomService_3000.0.0.jar
./packages/GoogleTranslator_CustomService_3000.0.0.jar
 
 
  • Removing the services that we do not need any more:
 
1. Delete all configurations for the adapter you want to delete from the application.
 
2. Stop GIS.
 
3. A Directory structure with sub directories will have been created under the [SI_Install_Folder]/installed_data directory.
 
The directory name is the same as the name of the *.jar file installed. Remove the entire directory structure created.
 
Example:
 
rm -r GoogleTranslator_CustomService/
 
 
4. Remove the *.jar file from [SI_Install_Folder]/jar/si/version ?!?!
 
Could not find ‘si’ folder in UNIX/Linux system, but only ‘packages’!!!
 
Note 1:
  • Windows system contains package for custom service in [SI_Install_Folder]/installed_data,
[SI_Install_Folder]/jar/si/[Service_Version] and
[SI_Install_Folder]/packages
 
  • UNIX system contains custom service package in [SI_Install_Folder]/installed_data,
[SI_Install_Folder]/jar/[Service_Name]/[Service_Version]  and [SI_Install_Folder]/packages
 
UNIX: Found the package in jar directly, not under jar/si!!!
 
/si/si50-2/install/jar/GoogleTranslator_CustomService
 
Example:
 
rm GoogleTranslator_CustomService_3000.0.0.jar
 
Note 2: To be sure where the package is, you can make a note of the path referring to the *.jar file in dynamicclasspth.cfg and dynamicclasspth.cfg.in and remove the *.jar from the specified file system location.
 
Remove the *.jar file from the directory [SI_Install_Folder]/packages.
 
5. Remove the entries referring to the *.jar file in dynamicclasspth.cfg and dynamicclasspth.cfg.in
 
6. Remove the corresponding entry from the GIS database table service_def to avoid future issues with another custom service being imported with the same name.
 
7. Start GIS again.
 
Mirjana's picture

Google Translator - User Exit, used in Translation Map

Creating User Exit for Google Translator
 
Steps to do:
 
  • Download java api (package) for google translation
  • Install google translation package in SI system
  • Write user exit code
  • Compile and pack user exit code
  • Install user exit in SI system
  • Write the map that will use the user exit
 
1. Download google-api-translate-java-0.92.jar or newer that can be found at
 
 
Note: Be careful with google translator API version and java version used by SI. I think for GIS/SI versions that uses java 1.5 we should use Google Translator 0.92 and SI system that uses java 1.6, we should take Google Translator 0.95!
 
2. Install the jar with install3rdParty.sh/cmd script in SI system
 
SI_Install_Folder/bin/install3rdParty.cmd GoogleTranslator 0_92 -j /path_To_Jar/google-api-translate-java-0.92.jar
 
You will be able to find the jar file in
  • SI_Install_Folder/jar/GoogleTranslator/0_92/
  • Also, you will see the following line in the end of dynamicclasspath.cfg file:
 
 
3. Java code for user exit (GoogleTranslation.java)
 
package google.translation;
 
import com.google.api.GoogleAPI;
import com.google.api.translate.Language;
import com.google.api.translate.Translate;
 
         public class GoogleTranslation {
                   public String trans(String str, String sourceLanguage, String targetLanguage) {
                            String translatedText = new String();
                            GoogleAPI.setHttpReferrer("http://code.google.com/p/google-api-translate-java/");
                            try {
                                      translatedText = Translate.execute(str, Language.valueOf(sourceLanguage), Language.valueOf(targetLanguage));
                                      System.out.println(translatedText);
                                      } catch (Exception ex) {
                                      ex.printStackTrace();
                                      }
                                      return translatedText;
                  
         }
         }
4. Compile GoogleTranslation.java into GoogleTranslation.class
 
Compilation can be done with a proper version of java in eclipse or in the command line.
 
 
SI_Install_Folder/jdk/bin/javac /path_To_Java_Code/GoogleTranslation.java
 
… or …
 
C:\temp>c:\SterlingCommerce\MEFG_43\jdk\bin\javac -classpath c:\temp\google-api-translate-java-0.92.jar GoogleTranslation.java
 
GoogleTranslation.class should be created in the folder in which you have run the command.
 
5. Pack the class file into jar
 
  • Place the class file under package folder (google/translation)
  • Change directory to parent folder of ‘google’
  • SI_Install_Folder/install/jdk/bin/jar cvf GoogleTranslation.jar google
 
GoogleTranslation.class, in package (jar), must be under google\translation path, that means in the package defined in code.
 
 
 
6. Install GoogleTranslation.jar at SI system
 
 
SI_Install_Folder/bin/install3rdParty.cmd UserExit 1_0 -j /path_To_Jar/GoogleTranslation.jar
 
 
After installing google translate api (google-api-translate-java-0.92.jar) and GoogleTranslator.jar package as a User Exit, you can also find the following lines in dynamicclasspath.cfg (SI_Install_Folder/properties folder):
 
VENDOR_JAR=C:\SterlingCommerce\MEFG_43\jar\GoogleTranslator\0_92\google-api-translate-java-0.92.jar
VENDOR_JAR=C:\SterlingCommerce\MEFG_43\jar\UserExit\1_0\GoogleTranslation.jar
 
  • Restart GIS/SI system!!!
 
7. Google translation in Translation map
 
  • Extended rule in a #field:
 
///////////////////////////////////
 
object obj;
String[50] sourceLanguage;
String[50] targetLanguage;
 
obj = new("google.translation.GoogleTranslation");
 
sourceLanguage = "ENGLISH";
targetLanguage = "CROATIAN";
 
#word = obj.trans(#word,sourceLanguage,targetLanguage);
 
///////////////////////////////////
 
 
 
  • Input file:
 
Welcome to the World of Integration.
Wish you a nice day!
 
Different results for translation to CROATIAN, SPANISH and GERMAN languages:
 
  • Result of translation (from ENGLISH to CROATIAN langugae):



Dobro došli u svijet integracije.                                                                   
Želimo vam lijep dan!
 
(For specific Croatian characters I added 0x00 – 0xFF range in X Syntax Token and also set Encodings at both sides of the map to Cp1250 - Windows Eastern European)
 
  • Result of translation (from ENGLISH to SPANISH language):
 
////////////////////////////////
...
sourceLanguage = "ENGLISH";
targetLanguage = "SPANISH";
...
////////////////////////////////
 
Bienvenido al mundo de la integración.                                                             
Deseamos un buen día!                                                                              
 
  • Result of translation (from ENGLISH to GERMAN language):
 
////////////////////////////////
...
sourceLanguage = "ENGLISH";
targetLanguage = "GERMAN";
...
////////////////////////////////
 
Willkommen in der Welt von Integration.                                                            
Wünsche dir einen schönen Tag!                                                                     
 
8. Uninstall/Remove User Exit
 
  • Remove GoogleTranslation.jar from SI_Install_Folder/jar/User Exit/1_0, or remove the whole UserExit folder if there is nothing you need from it any more
  • Remove google-api-translate-java-0.92.jar SI_Install_Folder/jar/GoogleTranslator/0_92 or remove the whole GoogleTranslator folder if you do not need it any more
  • Remove the lines from dynamicclasspath.cfg file that reference to these packages, mentioned in the previous steps
 
Mirjana's picture

FTP List Service - different list from file system depending on settings

/home4/worldoh9/tmp/testFolder/folder
 
-- testFolder       -- a.txt
                            -- b.txt
folder
-- c.txt
-- d.txt
 
Result of ftp/dir command from cmd:
 
 
·        Bp – RemoteFileName (FTP Client LIST Service) -> *.*
 
 
o       Result of FTP Client LIST Service:
 
NamesOnly -> No
 
 
 
 
 
 
 NamesOnly -> Yes
 
 
 
 
 
 
·        BP – RemoteFileName (FTP Client LIST Service) -> * or empty
 
 
 
o       Result of FTP Client LIST Service:
 
NamesOnly -> No
 
 
 
 
NamesOnly -> Yes
 
 

Mirjana's picture

OFTP flow and test processing in SI

1. Main steps for starting with OFTP:
 
 
·        Configure OdetteFTP Adapter
·        Create OFTP Profile
o        Physical Partner - LOCAL
o        Physical Partner – REMOTE
o        Logical Partner – ORIGINATOR
o        Logical Partner - DESTINATION
o        Physical Partner Contract
o        Logical Partner Contract
·        Create/modify template process for adding a FILE/EERP/NERP to OFTP table in database (oftpfile/oftpeerp/oftpnerp), by OFTPQueue Handler Service.
·        Create and run/schedule the process that will check if there is anything to send, by comparing PPC (Physical Partner Contract) initiate OFTP communication. That can be oftpcheckmessages BP, with OFTPScheduler Adapter.
·        Create/modify template process for initiating OFTP communication between partners. That BP name is written in Initiator Business Process Name parameter of PPC, and oftpinitsession can be used.
 

 

2. Profile creation
 
Physical Partner - PartnerA:
 
 
Physical Partner - PartnerB:
 
 
PPC:
 
 
Logical Partner – L_PartnerA:
 
 
 
Logical Partner – L_PartnerB:
 
 
 
LPC:
 
 
3. OFTP in SI - diagram
 
 
Note: A part II can be skipped, as we can put the file in OFTP storage as shown in a part I, and run it manually as shown in the part III. The whole flow is for automatic procedure.
 
Explanation of all the steps from diagram:
 
 
·        BPML code:
 
<process name="myOftpfile">
   <sequence name="send">
      <assign to="LogicalPartnerContract" from="'LPC_PartnerA_PartnerB'"/>
      <assign to="filename">dataitem1.dat</assign>     
      <assign to="Date">060825</assign>
      <assign to="Time">153055</assign>
 
      <operation name="CreateFILEStructure">
         <participant name="AssignService"/>
         <output message="DataItemOut">            
            <assign to="OFTPDataItem/FILE/document" from="PrimaryDocument"/>           
            <assign to="OFTPDataItem/FILE/properties/LogicalPartnerContract" from="LogicalPartnerContract/text()"/>           
            <assign to="OFTPDataItem/FILE/properties/OFTPVirtualFilename" from="filename/text()"/>
            <assign to="OFTPDataItem/FILE/properties/Date" from="Date/text()"/>
            <assign to="OFTPDataItem/FILE/properties/Time" from="Time/text()"/>
            <assign to="OFTPDataItem/FILE/properties/FileFormat" from="FileFormat/text()"/>          
            <assign to="." from="*"/>
         </output>
         <input message="toProcessData">
            <assign to="." from="*"/>
         </input>
      </operation>
 
      <!-- Queue document for OFTP send process -->
      <operation name="QueueFile">
         <participant name="OFTPQueueHandler"/>
 
         <output message="OFTPOut">
            <assign to="." from="*"/>           
         </output>
 
         <input message="OFTPIn">
            <assign to="." from="*"/>           
         </input>
      </operation>
   </sequence>
</process>
 
  • Process Data after OFTPQueueHandler:
 
<?xml version="1.0" encoding="UTF-8"?>
<ProcessData>
          <PrimaryDocument SCIObjectID="MIRJANA:node1:12f4dbd1146:26471"/>
          <LogicalPartnerContract>LPC_PartnerA_PartnerB</LogicalPartnerContract>
          <filename>dataitem1.dat</filename>
          <Date>060825</Date>
          <Time>153055</Time>
          <OFTPDataItem>
                   <FILE>
                             <document>
                                      <PrimaryDocument SCIObjectID="MIRJANA:node1:12f4dbd1146:26471"/>
                             </document>
                             <properties>
                                      <LogicalPartnerContract>LPC_PartnerA_PartnerB</LogicalPartnerContract>
                                      <OFTPVirtualFilename>dataitem1.dat</OFTPVirtualFilename>
                                      <Date>060825</Date>
                                      <Time>153055</Time>
                             </properties>
                   </FILE>
          </OFTPDataItem>
</ProcessData>
 
 Record written to a database (OFTP_OBJECT & OFTP_OBJECT_EXT)
 
 
<?xml version="1.0" encoding="UTF-8"?>
<ROWSET>
          <ROW>
                   <EVENT_ID>3</EVENT_ID>
                   <TYPE>FILE</TYPE>
                   <STATUS>SCHEDULED</STATUS>
                   <WFC_ID>MIRJANA:node1:12f4859ecf9:264726</WFC_ID>
                   <MESSAGE_ID>0</MESSAGE_ID>
                   <DOCUMENT_ID>MIRJANA:node1:12f4859ecf9:264681</DOCUMENT_ID>
                   <LPC>LPC_PartnerA_PartnerB</LPC>
                        <PPC>PPC_PartnerB_PartnerA</PPC>
                   <SFIDDSN>dataitem1.dat</SFIDDSN>
                   <SFIDDATE_TIME>2006-08-25 15:30:55.0</SFIDDATE_TIME>
                   <SFIDTIMEC>2</SFIDTIMEC>
                   <SFIDUSER/>
                   <SFIDDEST>admin</SFIDDEST>
                   <SFIDORIG>mirjana</SFIDORIG>
                   <NERPCREA>null</NERPCREA>
                   <SFIDFMT>T</SFIDFMT>
                   <SFIDLRECL>0</SFIDLRECL>
                   <SFIDFSIZ>21504</SFIDFSIZ>
                   <SFIDREST>0</SFIDREST>
                   <NERPREAS>null</NERPREAS>
                   <DELIMITERS>-01-01</DELIMITERS>
                   <RETRY_COUNT>0</RETRY_COUNT>
                   <CREATE_TIME>2011-04-12 12:48:48.0</CREATE_TIME>
                   <UPDATE_TIME>2011-04-12 12:48:48.0</UPDATE_TIME>
                   <RETRY_TIME>null</RETRY_TIME>
                   <OBJECT_LOCK>U</OBJECT_LOCK>
                   <EXTENSION_POINT>301989888</EXTENSION_POINT>
          </ROW>
</ROWSET>
 
 Run manually or schedule oftpcheckmessages
 
Run it manually (normally should be scheduled)
 
 Provide OFTPPPCName to OdetteFTP Scheduler Adapter in oftpcheckmessages
 
·        BPML code:
 
<process name="oftpcheckformessages">
   <sequence name="check">
 
<assign to="OFTPPPCName">PPC_PartnerA_PartnerB</assign>   
     
<operation name="CheckForOFTPMessages">
         <participant name="OFTPScheduler"/>
         <output message="DataSetOut">
            <assign to="." from="*"/>
         </output>
         <input message="toProcessData">
            <assign to="." from="*"/>
         </input>
      </operation>
   </sequence>
</process>
 
 Matching PPC with database
 
If there is match between PPC (OFTPPPCName) and PPCs in a database, then Initiator Business Process (oftpinitsession) is run by OFTPScheduler.
If OFTPActionType in OdetteFTPScheduler Adapter is Conditional, Initiator BP will be run only if there is match between PPCs, but if it is Uncoditional, Initiator BP will be run regardless of matching PPCs.
 
 oftpinitsession
 
·        BPML code:
 
<process name="oftpinitsession">
          <sequence name="oftp">
                   <!-- Start OFTP send process in Mailbox Mode-->
                   <operation name="SendOFTP">
                             <participant name="myOdetteFTP"/>
                             <output message="Out">
                                      <assign to="." from="*"/>
                             </output>
                             <input message="In">
                                      <assign to="." from="*"/>
                             </input>
                   </operation>
          </sequence>
</process>
 
 
 
  • Process Data transferred to OdetteFTPAdapter (myOdetteFTP) is:
 
<?xml version="1.0" encoding="UTF-8"?>
<ProcessData>
          <PhysicalPartnerContract>PPC_PArtnerA_PartnerB</PhysicalPartnerContract>
</ProcessData>
 
 
 
Note:with preconfigured OdetteFTPAdapter configuration (i.e. OFTPSendFile), oftpinitsession cannot be run, although there is match between PPC given to OdetteFTPScheduler Adapter and database. When I create custom configuration of OdetteFTP Adapter (myOdetteFTP), it started to work!!!
 
 
 oftpin
 
·        BPML code:
 
<process name="oftpin">
          <rule name="is-FILE">
                   <condition>
                  ( OFTPInbound/Type/text() = 'File')
         </condition>
          </rule>
          <rule name="is-EERP">
                   <condition>
                  ( OFTPInbound/Type/text() = 'EERP')
         </condition>
          </rule>
          <rule name="is-NERP">
                   <condition>
                  ( OFTPInbound/Type/text() = 'NERP')
         </condition>
          </rule>
          <sequence name="receive">
                   <!-- Check type of inbound -->
                   <choice name="Choice Start">
                             <select>
                                      <case ref="is-FILE" activity="processFILE"/>
                                      <case ref="is-EERP" activity="processEERP"/>
                                      <case ref="is-NERP" activity="processNERP"/>
                             </select>
                             <sequence name="processFILE">
                                      <!-- Add your business logic for processing inbound files, e.g. call EDIDeenvelope -->
                                      <operation>
                                                <participant name="EDIDeenvelope"/>
                                                <output message="ediout">
                                                          <assign to="." from="*"/>
                                                </output>
                                                <input message="ediin"/>
                                      </operation>
                             </sequence>
                             <sequence name="processEERP">
                                      <!-- Add your business logic for processing inbound EERPs -->
                                      <assign to="key" from="concat(OFTPInbound/FileName/text(),
                                       OFTPInbound/Date/text(),
                                       OFTPInbound/Time/text())"/>
                                      <assign to="status" from="'SUCCESS'"/>
                             </sequence>
                             <sequence name="processNERP">
                                      <!-- Add your business logic for processing inbound NERPs -->
                                      <assign to="key" from="concat(OFTPInbound/FileName/text(),
                                       OFTPInbound/Date/text(),
                                       OFTPInbound/Time/text())"/>
                                      <assign to="status" from="'ERROR'"/>
                             </sequence>
                   </choice>
          </sequence>
</process>
 
 
 
  • Process Data after oftpin:
 
<?xml version="1.0" encoding="UTF-8"?>
<ProcessData>
          <PrimaryDocument SCIObjectID="MIRJANA:node1:12f4dbd1146:11419"/>
          <OFTPInbound>
                   <FileName>dataitem1.dat</FileName>
                   <Type>File</Type>
                   <FileSize>266</FileSize>
                   <Destination>admin</Destination>
                   <Time>1530550001</Time>
                   <Originator>mirjana</Originator>
                   <Date>20060825</Date>
                   <FileFormat>T</FileFormat>
          </OFTPInbound>
</ProcessData>
 

 

Mirjana's picture

Conditional XPath

Example of condition in XPath that can be used instead of bpml condition. Much shorter and simpler.

<assign to="result" from="if(urgent_ind/text() = 1,'U','N')"></assign>

 

SI User Authentication in Custom Web Application

Problem:
 
If you want to develop custom Web Application that will run on GIS Web Server & you want to provide GIS level authentication to your custom web application?
 
Problem Resolution:  Please follow the following steps 
  1. Include the JSP tag Library “userautho.tld” into your application WEB-INF folder. You can find this tld file at
<GIS Installation Folder>\SI\container\Applications\helloworld\WEB-INF\tld
 
  1. Add this taglib into your application by adding the following code into your application web.xml file
    <taglib>
        <taglib-uri>http://www.stercomm.com/uix/security</taglib-uri>
        <taglib-location>tld/userautho.tld</taglib-location>
    </taglib>
 
  1. Import this tag library into your JSP page using the following statement on top of JSP page
<%@ taglib uri='http://www.stercomm.com/uix/security' prefix='sec' %>
 
  1. Add the following code into your login jsp page
 
<sec:authenticate user="<%=strUser%>" pass="<%=strPass%>" login="error.jsp " />
            
Where "<%=strUser%>" & "<%=strPass%>" are the User Id & Password entered by user in Login page & error.jsp is the page which will be shown if user authentication failed.
Mirjana's picture

Run a BP from a map

This is just an info of how to run a BP from the map.

Example 1:

object BPLauncher;
integer i;

BPLauncher = new("com.sterlingcommerce.woodstock.dmi.routing.BPLauncher","BPname");

i = BPLauncher.run();

Note: Of course it is better to control if a BP is run or invoke by the service in a BP!!!

Example 2:

(pass the value - #KEY, to a Process Data)

object BPLauncher;
integer i;

BPLauncher = new("com.sterlingcommerce.woodstock.dmi.routing.BPLauncher","VC_om_autoReplay_runPerMsg");
BPLauncher.addContentElement("KEY",#KEY);
i = BPLauncher.run();

Mirjana's picture

Pull a part of Process Data by XSLT

Request: get a specific Output from the following Process Data
 
<ProcessData>
          <OUTPUT>
                   <Data>
                             <naziv>STAVKA1</naziv>
                             <kolicina>2</kolicina>
                             <cijena>10.20</cijena>
                             <uk_cijena>20.40</uk_cijena>
                             <produkt_ID>123</produkt_ID>
                             <adresa>Heinzelova 1</adresa>
                   </Data>
                   <Data>
                             <naziv>STAVKA2</naziv>
                             <kolicina>3</kolicina>
                             <cijena>15.10</cijena>
                             <uk_cijena>45.30</uk_cijena>
                             <produkt_ID>234</produkt_ID>
                             <adresa>Heinzelova 2</adresa>
                   </Data>
                   <Data>
                             <naziv>STAVKA3</naziv>
                             <kolicina>5</kolicina>
                             <cijena>12.41</cijena>
                             <uk_cijena>62.05</uk_cijena>
                             <produkt_ID>345</produkt_ID>
                             <adresa>Heinzelova 3</adresa>
                   </Data>
          </OUTPUT>
</ProcessData>
 
Output:
 
<ENABLED>
<naziv>STAVKA1</naziv>
          <produkt_ID>123</produkt_ID>
</ENABLED>
<ENABLED>
          <naziv>STAVKA2</naziv>
          <produkt_ID>234</produkt_ID>
</ENABLED>
<ENABLED>
          <naziv>STAVKA3</naziv>
          <produkt_ID>345</produkt_ID>
</ENABLED>
 
XSLT:
 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
          <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
          <xsl:template match="/">
                   <ROOT>
                             <xsl:for-each select="//Data">
                                      <xsl:element name="ENABLED">
                                                <xsl:element name="naziv">
                                                          <xsl:value-of select="naziv/text()"/>
                                                </xsl:element>
                                                <xsl:element name="produkt_ID">
                                                          <xsl:value-of select="produkt_ID/text()"/>
                                                </xsl:element>
                                      </xsl:element>
                             </xsl:for-each>
                   </ROOT>
          </xsl:template>
</xsl:stylesheet>
 
BPML – XSLT Service configuration (result goes to PrimaryDocument):
 
<operation name="XSLT Service">
          <participant name="XSLTService"/>
          <output message="XSLTServiceTypeInputMessage">
                   <assign to="." from="*"/>
                   <assign to="input_pd_xpath">/</assign>
                   <assign to="xml_input_from">ProcData</assign>
                   <assign to="xslt_name">TEST_ProcessData_pull</assign>
          </output>
          <input message="inmsg">
                   <assign to="." from="*"/>
          </input>
</operation>
 
Result in the Primary Document:
 
PrimaryDocument
 
Process Name: TEST_ProcessData_pull     Instance ID: 1342884
Service Name: XSLTService
Document Name: xslt_result      Document Store: Database 
Document ID: 911:7252702:12e71919a89:lin2:node1 
Document in process data:   text/xml 
 
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
          <ENABLED>
                   <naziv>STAVKA1</naziv>
                   <produkt_ID>123</produkt_ID>
          </ENABLED>
          <ENABLED>
                   <naziv>STAVKA2</naziv>
                   <produkt_ID>234</produkt_ID>
          </ENABLED>
          <ENABLED>
                   <naziv>STAVKA3</naziv>
                   <produkt_ID>345</produkt_ID>
          </ENABLED>
</ROOT>
 
 
Assign for moving it back to the ProcessData:
 
<assign to="." from="DocToDOM(PrimaryDocument)/*"></assign>
 
Result in the Process Data after the last assign:
 
<?xml version="1.0" encoding="UTF-8"?>
<ProcessData>
          <OUTPUT>
                   <Data>
                             <naziv>STAVKA1</naziv>
                             <kolicina>2</kolicina>
                             <cijena>10.20</cijena>
                             <uk_cijena>20.40</uk_cijena>
                             <produkt_ID>123</produkt_ID>
                             <adresa>Heinzelova 1</adresa>
                   </Data>
                   <Data>
                             <naziv>STAVKA2</naziv>
                             <kolicina>3</kolicina>
                             <cijena>15.10</cijena>
                             <uk_cijena>45.30</uk_cijena>
                             <produkt_ID>234</produkt_ID>
                             <adresa>Heinzelova 2</adresa>
                   </Data>
                   <Data>
                             <naziv>STAVKA3</naziv>
                             <kolicina>5</kolicina>
                             <cijena>12.41</cijena>
                             <uk_cijena>62.05</uk_cijena>
                             <produkt_ID>345</produkt_ID>
                             <adresa>Heinzelova 3</adresa>
                   </Data>
          </OUTPUT>
          <PrimaryDocument SCIObjectID="746:7278775:12e71919a89:lin2:node1"/>
          <ENABLED>
                        <naziv>STAVKA1</naziv>
                        <produkt_ID>123</produkt_ID>
            </ENABLED>
            <ENABLED>
                        <naziv>STAVKA2</naziv>
                        <produkt_ID>234</produkt_ID>
            </ENABLED>
            <ENABLED>
                        <naziv>STAVKA3</naziv>
                        <produkt_ID>345</produkt_ID>
            </ENABLED>
</ProcessData>
 
 
 
Syndicate content