You are not logged in.

Unanswered posts



Important! This site has been replaced. All content here is read-only. Please visit our brand-new community at https://community.talend.com/. We look forward to hearing from you there!



#1 2014-07-29 15:48:55

AlexisB
Member
3 posts

AlexisB said:

[resolved] Get header information from tRestRequest

Tags: [development]

Hello,

I am trying to developp a REST web service for a project.
For the need of the project, I would like to know if it's possible to get the header of the REST request ? And how ?

Thank's in advance for your answer.

Offline

#2 2014-07-30 15:11:21

sberyozkin
Talend Team


sberyozkin said:

Re: [resolved] Get header information from tRestRequest

Hi,
you can access individual headers by adding parameters in a schema editor and adding a 'header' to the Comment field.
tRESTRequest also sets the map of all the headers it receives as a context var, I don't have a studio opened right now but it will be easy to spot.
Going the schema editor route is the simplest approach
HTH, Sergey

Offline

#3 2014-07-31 14:31:37

morgan.hautman
Member
70 posts

morgan.hautman said:

Re: [resolved] Get header information from tRestRequest

sberyozkin,


I also have this problem and tried to add header in the Comment section like said in the documentation.
Any idea of what I'm doing wrong?

Here are my screenshots:
mini_1.png_20140731-1531.pngmini_2.png_20140731-1532.pngmini_3.png_20140731-1532.png

Last edited by morgan.hautman (2014-07-31 14:32:09)


Morgan Hautman
Talend ESB / Java Developer
Email : morgan.hautman@iadvise.eu
www.iadvise.eu

Offline

#4 2014-07-31 16:09:15

sberyozkin
Talend Team


sberyozkin said:

Re: [resolved] Get header information from tRestRequest

Works for me OK. I have a simple job which accepts the XMl payload via POST, passes it to tLogRow and echoes back via tRESTResponse.
tRESTRequest schema is exactly the same as in your example, except that I did not put a default value.
Doing:
"curl -X "Content-Type: application/xml" -H "EndpointNm: test" -d "<hello/>" http://localhost:8088"
results in tLogRow reporting:
<?xml version="1.0" encoding="UTF-8"?>
<hello/>|test
Cheers, Sergey

Offline

#5 2014-08-01 10:46:22

morgan.hautman
Member
70 posts

morgan.hautman said:

Re: [resolved] Get header information from tRestRequest

Damn I tried it out today and it magically worked smile

Thanks sberyoskin , even if you didn't do much ^^


Morgan Hautman
Talend ESB / Java Developer
Email : morgan.hautman@iadvise.eu
www.iadvise.eu

Offline

#6 2014-08-05 16:02:46

AlexisB
Member
3 posts

AlexisB said:

Re: [resolved] Get header information from tRestRequest

It works fine for me too !
Thank you so much.

Offline

#7 2017-03-29 08:08:31

mounica_ch
Member
10 posts

mounica_ch said:

Re: [resolved] Get header information from tRestRequest

I am not getting any output while I tried to print EndpointNm in tJavaFlex. I need to get username and password from the header like http basic  authentication.can anyone please suggest how can I get that.

I am attaching screen shots of error and my job.

mini_job-java.jpg_20170329-0011.jpgmini_job.jpg_20170329-0012.jpgmini_error.jpg_20170329-0012.jpg

Last edited by mounica_ch (2017-03-29 08:13:19)

Offline

Board footer

Talend Contributor Agreement - Talend Website Privacy Policy