Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
corentin1
Contributor III
Contributor III

Getting HTTP Header on SOAP Response

Hello,
In Integration Perspective (ie without using routes) is it possible to get HTTP Header on a reponse from a SOAP Call ? (using tHTTPRequest,tSOAP,tESBConsumer..?). I am calling an external Webservice, and I need to retrieve informations from the http header (not the soap header).
I am using Talend 5.6.2.

Labels (2)
3 Replies
Anonymous
Not applicable

Hi,
As far as I know I requested to extend tHTTPRequest to support this feature as well, but it never happened. On the other hand it is not hard to change the component behavior to support this.
There is following block in tHttpRequest_main.javajet file:

if (java.net.HttpURLConnection.HTTP_OK == (urlConn_<%=cid%>.getResponseCode())) {
java.io.InputStream bis_<%=cid%> = new java.io.BufferedInputStream(urlConn_<%=cid%>.getInputStream());
<%

The first line is detecting if the method call was delivered, if yes, you can get from connection the headers like this:
urlConn_<%=cid%>.getHeaderFields();
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
// Change this to some object variable and map it to output of the component, this output you will need to define in XML configuration file
                System.out.println("Key : " + entry.getKey() + " ,Value : " + entry.getValue());
}

Or you can get single header just like this:
String myHeader = conn.getHeaderField("MY_HEADER");


If you are going to extend that component to support this, you might raise a ticket as new feature request at talend bug portal:
https://jira.talendforge.org/secure/Dashboard.jspa
and share it with others, so you will get new feature into Talend main stream

Ladislav
corentin1
Contributor III
Contributor III
Author

Thank you very much for this precise answer : for now, i have chosen the quick option, and I've just put a tJavaRow behind my tHttpRequest, in order to get my Headers. It's working now ! i'll check the 'rebuild the component' option later..
Anonymous
Not applicable

Of course I understand that, go as required 🙂