Posts

Creating a Cookie using jQuery

In one of my projects, I was tasked to create a cookie (no, not the chocolate chip dough, but a browser cookie), and I had to do it using jQuery, a commonly used JavaScript library. It can be done using plain old JavaScript, of course, but life is so much better with jQuery! By definition, a browser cookie is a text file created by a web browser for every unique website or domain. The cookie can only be accessed on the same domain where it was originally created. To be able to create a cookie using jQuery, you need to include a plug-in that can be downloaded from GitHub . Everything is already explained on the GitHub page, and the code is not very complicated. Perhaps, a few watch-outs would be: Differentiating between a session cookie and an expiring cookie. A session cookie is only valid until the user closes the web browser. An expiring cookie only gets removed after a specified number of days. Note: the unit of measure for the expires parameter is days .  The path p...

Specifying Custom Engine Properties in Designer

Image
Specifying custom engine properties in TIBCO Designer can either be done by modifying the designer.tra, or by creating a properties.cfg file. The advantage of the latter is that you don't have to restart TIBCO Designer every time you need to change the value of the property. Also the properties.cfg overrides the value of the engine properties you have specified in designer.tra . You can comment out the property by prepending a hashtag (#) to the property. Before loading and running the process in Designer tester, you need to specify the full file path to your properties.cfg file. Here are some of the common engine properties: #Enabling web service authentication via LDAP java.property.com.tibco.bw.security.login.jaas=true java.property.java.security.auth.login.config=jaas.conf java.property.TIBCO_SECURITY_VENDOR=true java.property.com.entrust.toolkit.security.crypto.random.DRBGusingSHA512=true #Salesforce Connection Forward Proxy Configuration java.property.co...

How To Map Password Type Global Variable In Activity Input

Image
As you may already know, you cannot map a global variable that is a password type to the Activity Input. You can only map it to a Shared Configuration resource when possible. One way to retrieve the global variable password value is to write a Java code. But there is another preferable way to have one less activity in your process definition, and that is using a Java Custom Function. Of course, you will still write Java code one time, but it's a whole lot reusable; and you can export it as a Project Library that you can use in a different Designer project. So you want to write a Java code, but you are not quite sure which JAR file the Java class is located; on the other hand, you know the fully qualified name of the class and the method name to invoke. Personally, I find it appropriate to use The Reflection API to write a few lines of code in order to achieve this. We want to have a function that retrieves the value of a password global variable passing the global variable path ...

How to Fix the SSLProtocolException: handshake alert

You might have probably encountered the following error when invoking a web service over HTTPs transport using SoapRequestReply activity. "javax.net.ssl.SSLProtocolException: handshake alert:  unrecognized_name" This could be a weird error especially if you know that the client certificates are valid, and you have installed the complete certificate chain in your keystore. In order to resolve this, you need to add the following property in the application .TRA file. java.property.jsse.enableSNIExtension=false I don't have an exact explanation for the root cause of this error, but I believe this is brought about by one of the the security enhancements in Java SE 7. "Server Name Indication (SNI) for JSSE client: The Java SE 7 release supports the Server Name Indication (SNI) extension in the JSSE client. SNI is described in RFC4366. This enables TLS clients to connect to virtual servers."

Creating Java Custom Functions

Image
You can create custom XPath functions that you can directly use in the Activity Input. These functions come very handy especially when you expect to use them repeatedly for mapping. You can do that by creating a Java Custom Function shared resource. You will have to write a Java class that has a public and static method and returns a value. The method cannot be void or explicitly throw an exception. Supposed you want to have a custom function that replaces all occurrences of a string with another string. This is, in my experience, a common function that is not readily available in TIBCO BW because it doesn't support XSLT 2.0; it's limited to XSLT 1.0. But it allows us to write a Java method and call it via XSLT! To demonstrate that, we can have a Java method that accepts three parameters: the input text, the regular expression or pattern, and the replacement text. I have named this method "replaceRegex" but it could be any descriptive name. I used the String...

Reassign stdout and stderr to BW logger

There are instances when you are using a third party Java class and you want to debug certain errors, but you couldn't get the error stack traces in the logs particularly in the application logs which you can also view via TIBCO Administrator (assuming you have no server-level access). There's no way you can change the Java class to add a custom log4j logger such as "bw.logger" in order to write into the BW log file. You know for certain that the Java class writes debug logs into the standard output and error stream (e.g. System.out and System.err). You can reassign standard and error output stream and into the BW log file by writing a custom Java code. Since these are static methods and a service instance runs in its own JVM, you only have to run this code once as part of a process starter (process definition with onStartup). Create a static Logger object (class org.apache.log4j.Logger). private static final Logger logger = Logger.getLogger("bw.log...

Dynamically Mapping Fields from Salesforce Query Activity Output

Image
While I was working on Salesforce.com integration, the TIBCO BusinessWorks plug-in provides a "Query All" and "Retrieve All" activities to query Salesforce objects. The "Query All" lets you use a SOQL statement freely, while "Retrieve All" only allows you to specify the list of fields and optionally the object IDs. The only filter you can use for the latter are the object IDs, which doesn't seem to be the case most of the time. Both activities have a generic output and are not specific to a particular Salesforce object. It has an "any element" field which you can coerce based on a specified schema and you would need a WSDL file generated from Salesforce to do this. However, the problem starts when Salesforce keeps on updating the WSDL at the same time, so you will need to map the newly added field all the time! The solution I have come up with for this dilemma was not actually quite that simple but it offers more flexibility in th...