Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Nifi PostHTTP response data

Solved Go to solution
Highlighted

Nifi PostHTTP response data

Explorer

I've successfully created a process in Nifi to send a POST to a web service, but i'm unable to find out how to incorporate the post response into the httpresponse for the caller. Does anyone know if this is possible or did I go the wrong route for a post/modify/response service?

EDIT:

the flow I have is:

HandleHttpRequest --> PutFile --> PostHTTP --> ReplaceText --> PutFile --> HandleHttpResponse

the only thing that seems to apply a change to the text is the ReplaceText being submitted. The first PutFile contains the text submitted, the second PutFile only contains the text modified by the replacetext. the PostHTTP result does not seem to be incorporated into the result.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Nifi PostHTTP response data

Hi @Christopher Amatulli,

Once your FlowFile is created when receiving your request, you make it goes your flow and change the content of your flow file with what you want to return to the user. Then you route this FlowFile to the response processor and you set the HTTP return code you want. The response body will be the content of your flow file.

Hope this helps.

View solution in original post

7 REPLIES 7
Highlighted

Re: Nifi PostHTTP response data

Hi @Christopher Amatulli,

Once your FlowFile is created when receiving your request, you make it goes your flow and change the content of your flow file with what you want to return to the user. Then you route this FlowFile to the response processor and you set the HTTP return code you want. The response body will be the content of your flow file.

Hope this helps.

View solution in original post

Highlighted

Re: Nifi PostHTTP response data

Explorer

That's not what is happening or at least it's not working that way in my setup. The flow I have is:

HandleHttpRequest --> PutFile --> PostHTTP --> ReplaceText --> PutFile --> HandleHttpResponse

the only thing that seems to apply a change to the text is the ReplaceText being submitted. The first PutFile contains the text submitted, the second PutFile only contains the text modified by the replacetext. the PostHTTP result does not seem to be incorporated into the result.

Highlighted

Re: Nifi PostHTTP response data

If possible, could you share your template, I'll have a quick look at it.

Is it the same flow file from one end to another? When putting your file on disk before the response processor does it have the content you are expecting? What are the properties in your response processor?

Highlighted

Re: Nifi PostHTTP response data

Explorer

attached, thanks. I can trace the PostHTTP, and I see the response from the post. but the text doesn't seem to make it through to the replacetext or the second putfile.

Highlighted

Re: Nifi PostHTTP response data

Oh... looking at your template, I think I realized I misunderstood you. Your problem is that the answer of the PostHTTP is not getting inside the content of the FlowFile and the consequence is that it won't make through to the HTTP response processor. Correct?

If yes, it is because PostHTTP is a legacy processor and the response of the request won't be written to the flow file content. Instead I recommend you using InvokeHTTP which a more recent processor with a lot of options and you will have a relationship for HTTP responses of your POST request.

Let me know if it is ok.

Highlighted

Re: Nifi PostHTTP response data

Explorer

InvokeHTTP looks to have gotten me closer, only issue now is I am only getting the Post response, the original text is stripped. Thanks, this solves my original problem though.

Highlighted

Re: Nifi PostHTTP response data

New Contributor

Try using SELECTHIVEQL processor for your hive connection and Hive query instead of ExecuteSQL or QueryDatabase

Don't have an account?
Coming from Hortonworks? Activate your account here