Select Page

Siebel Code Challange – #12

It’s been a while since I ran a Code Challenge. Times are busy, kids are growing, life is hectic. However, I came across some behaviour that was begging to be made into a challenge. As such, I give you this mighty slice of eScript delight!

As usual, no prize of a pint to the first to spot the problem with the following code:

Answers below, please!

Spoiler Inside: Reveal Answer SelectShow

InfoPath Integration And Base64 Decoder

I’ve been working on some functionality within Siebel to “integrate” Microsoft InfoPath. The premise of the requirement is to export an instance of an entity, Account for example, using Siebel EAI and allow a 3rd party, non-Siebel user to view the data in a convenient and useful manner.

InfoPath allows you to define templates based on an XSD. This template can be modified to present an XML instance, using this XSD, in a friendly and readable manner. Perfect for my requirements! However, there’s a snag – isn’t there always? The problem is with File Attachments.

Siebel EAI is really helpful when it comes to extracting file attachments in XML – it will base64 encode the binary file and stick it in a node in the XML. InfoPath does the same thing with file attachments, but it expects a 24 byte header within the base64 encoded file string. This is not something that Siebel does out of the box.

So I wrote a business service that creates that InfoPath header and presents a base64 encoded string that InfoPath is happy with. This business service is invoked in a Data Map that is used to extract the data to my InfoPath XSD.

The solution to building this byte stream header, and encoding everything in a way InfoPath expects, used some eScript functions that I haven’t used before. Specifically, String.fromCharCode() came in really handy as a way of building up an arbitrary byte stream.

For example, InfoPath has a fixed, 4 byte identifier as part of the header. This can easily be created using:

The same principal can be used to create the header size, version and reserved blocks – they are all 4 bytes long. The file size, name and terminator can be constructed using similar principals, using data supplied via EAI in the XML.

The final element of the solution is to decode the Siebel encoded string, append the header, then re-encode. The result is a Base64 encoded string that InfoPath will be happy with.

Here’s the code I used to decode the Siebel encoded attachment string. I pinched the basis for this from Stack Overflow. Thanks to Sniper and broc.sieb for these snippets. Feel free to use this in your own projects, with the usual caveats of course!

That’s it for another post – until next time!

Siebel Constants – COM and Java

As a big fan of the COM interfaces and the Siebel Java Data Bean, I’ve messed around a lot with invoking Siebel methods from outside the application. The type libraries supplied with Siebel make this very straight forward, but something that isn’t captured in there are the ‘Siebel Constants’.


I’d always assumed that anything that was effectively true or false could be translated as 0 or 1 respectively. Others, such a ViewMode, I just remember form the old days as being 0 to 3, 3 being ‘AllView’. One mistake I’ve made is assuming that ForwardOnly was 1 – not the case!

A quick look in Siebel Bookshelf reveals the true values of the Siebel Constants:

ConstantInteger Value

I’ve had to make a hasty update to my C# and Java Tools – I wonder if the performance of my Repository Analyser was affected by an invalid ExecuteQuery invocation?

Ideally, Oracle should ship a static class with these constants predefined: perhaps in Siebel 9.0? If you can’t wait that long, you can download a Class definition for C# from The Siebel Store!

Siebel on the Android Platform

I’ve been tinkering with Android development lately. Google have release a preview version of their new Android IDE called Android Studio. It’s a really lovely environment for building Android apps in – all the very best from Eclipse and IntelliJ rolled into a neat package. Very nice indeed.

I’m always thinking of new ways to use Siebel technology, so incorporating Android development with Siebel sounds like an interesting challenge. Here is a quick guide to how I built a very simple Android app that integrates with Siebel using the Siebel Java Data Bean. I’m aiming to expand on this in the future to build some useful Siebel tools that work natively in the Androis OS environment.

We’re going to build a really simple app that connects to your Siebel instance over the network. We’ll start by downloading the Android Studio IDE, creating a new project and incorporating the Siebel Java Data Bean JAR files.

Creating a new project

  1. Download and install the Android Developer software from this location
  2. From the splash screen, check for updates and left the software update to the latest version
  3. Create a new project as follows:
  4. Create a blank activity and call it SiebelActivity – let Android Studio set the class names for you
  5. Within your new project folder, create a “libs” folder and copy Siebel.jar and SiebelJI_enu.jar from your Siebel Tools installation to that location
  6. Back in Android Studio, locate the new “libs” folder, right click each .jar and “Add as Library”
  7. Your Studio project will look like this:

Create a simple layout

  1. Create the following in strings.xml:
  2. Double click “fragment_siebel.xml” amd add a Button and TextView into the default RelativeLayout:

Create a Siebel App Class

  1. Right click your src/main/java folder and select New > Java Class
  2. Use the name SiebelApp for your class
  3. Add the following member variables and a simple constructor:
  4. Create a Connect method that invokes the Siebel Java Data Bean:
  5. Create a simple method to return the current users position:
  6. Back in, add a member variable to hold a reference to the Siebel App and button:
  7. Then add a listener to the button with code to invoke the Siebel class, get the users position and update the TextView. A Toast will be displayed if any problems are encountered:

And that’s pretty much it!

It’s so easy to put Android apps together using the new Android Studio IDE. And the Siebel Java Databean gives you everything you need to access Siebel from any Android device. It’s just a matter of finding a practical use for it – the subject of another article!