My colleague had a problem in trying to access a SOAP web service. Specifically, he needed to provide extended SOAP headers in regards to the security requirements, a SAML assertion in this case, and the standard Informatica Web Transformation wasn't doing much for him.
We discovered that this is quite easy to accomplish by way of a Java Transformation instead. So here's how we did it.
In informatica, create the Java Transformation. Below illustration depicts it between two other transformations, and we can see how the input and output values are transferred between them.
Please pardon the use of the Danish language; I hope the gist of it will suffice.
Below picture further illustrates the input and output ports of the Java transformation. These exact names are immediately available to us from the Java code we write.
Now, let's add the Java-code specific to the task of calling a SOAP web-service with headers and all.
We have multiple tabs available on the transformation - I used only the 'On Input Row' and 'Import Packages'.
In 'Import Packages', specify the Java imports required to perform the task. For my use-case, these were sufficient:
Given these imports, we can go ahead and add the Java code in the 'On Input Row' tab. Please forgive the wall of text; I felt it was important to include the complete SOAP request, headers and body and all, for the sake of completeness.
The above code pieces a SOAP-request together, replacing specific values within it with the input-port values. Then, by way of a standard Java HttpURLConnection, it fires off the request, and reads the response into a StringBuilder object. For our use-case we report succes or failure by looking for a particular piece of String-value, we had no need to parse the response further.
Do note the call to 'generateRow()', this is required by Informatica to populate the output value(s).
Also note the calls to logInfo(message) and logError(message), respectively, these enable logging into the Informatica Session log. So by all means go crazy with them, you can never have enough logging.
Hope it helps!
Buy me a coffee