In our system landscape, besides SAP systems there is a small unix-like server. This system is used for employess private websites and mail accounts.
While working with Exchange Infrastructure i wondered if we could use it to monitor configuration changes in this unix system or synchronize it’s configuration data with other system in our landscape. I focused on monitoring the user list.
In most unix systems user list is maintained in csv-like file, /etc/passwd, which looks like this:
... named:*:70:70:BIND Name Service Daemon:/var/named:/sbin/nologin proxy:*:71:71:Proxy Services:/nonexistent:/sbin/nologin nobody:*:32767:32767:Unprivileged user:/nonexistent:/sbin/nologin nathan:*:1000:1000:nth:/home/nathan:/bin/sh ...
The records are organized in lines and fields are of different lengths separated by a colon.
XI gives us File Content Conversion message protocol in the file adapter. I wanted to try it out. After some experiments and heavy reading of help.sap.com i managed to configure the adapter to do the job the way i wanted it to.
Technical conversion attributtes look like this
Document name and namespace decide what the root of created XML message would be, Recordset name decides about the next tag in XML hierarchy and recordset structure defines what kind of records are in the file – here we have one called “user”, and how many records of that kind are there – “*” means that there can be any number of records.
In additional configuration we setup the field separator (here colon), field names to be created in the XML document and a technical settings informing XI that field names are configured.
Rest is configured for standard FTP message processing. One has to remember that when pointing directly to a configuration file, the processing mode has to be “Test”, otherwise the configuration file would get deleted, what would lead to unix system malfunction.
This configuration of file adapter converts /etc/passwd file to XML looking like this:
<?xml version="1.0" encoding="utf-8" ?> <ns:userlistMessage xmlns:ns="http://bcc.openbsd.org/"> <userlist> <user> <usename>root</usename> <password>*</password> <uid>0</uid> <guid>0</guid> <name>Charlie </name> <folder>/root</folder> <shell>/bin/sh</shell> </user> ... </userlist> </ns:userlistMessage>
To make such configured file adapter to work for you in a integration scenario you have to define proper data and message types in your integration repository.