Created 07-28-2016 12:42 PM
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.
Created 07-28-2016 12:48 PM
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.
Created 07-28-2016 12:48 PM
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.
Created 07-28-2016 01:11 PM
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.
Created 07-28-2016 01:18 PM
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?
Created 07-28-2016 01:31 PM
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.
Created 07-28-2016 01:49 PM
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.
Created 07-28-2016 02:07 PM
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.
Created 01-31-2020 11:10 AM
Try using SELECTHIVEQL processor for your hive connection and Hive query instead of ExecuteSQL or QueryDatabase