3
votes

I'm new to Apache NiFi, and I developed an application to send JSON data to a NiFi endpoint via HTTP POST request.

In Apache NiFi, I have a HandleHTTPRequest processor connected to a PutFile processor then a HandleHTTPResponse processor. I've also tried using a LogAttribute processor. The response code and HTTP message from the NiFi web service is working properly, but I'm trying to make sure my JSON payload is being sent properly. Post is enabled in the HTTPRequest handler. Yet, the only files it's generating are blank and 0kb in size. Any ideas?

1
So can you use something like Postman to make a request to your webservice and check it responds with the correct data?Binary Nerd
I agree with the above comment about using Postman or some browser extension to make a POST to NiFi to determine if that gets the expected results. This will allow you to determine if the problem is in your code that is making the POST, or in the NiFi flow.Bryan Bende
Thanks for the replies. Interesting you both mention Postman, I actually tried that yesterday before I left and it's looking like it's replicating the same behavior - likely a problem with the NiFi flow. I'm simply using HandleHTTPRequest -> PutFile -> HandleHTTPResponse, yet it looks like (under data provenance) it's 0kb in and out...user6558079
Would you be able to make a template of your flow and post the template XML file somewhere? Would be willing to try it out.Bryan Bende
Posted it here, much appreciated: pastebin.com/6mci4hDvuser6558079

1 Answers

0
votes

Based on the comments above the conclusion is that there was no problem on the side of Nifi.

It's definitely an issue with the Java code, I used postman again after changing some local firewall configurations and it successfully logs any POST requests that are sent to it and puts it in a file

The key step towards resolving the issue was trying to connect with something like Postman as @Binary Nerd and @Brian Bende suggested.