Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How can I use NiFi to Invoke a HTTP and send a RESTful web Service to another machines with IP address?

avatar
Contributor

Current setup, there are 2 computer machine

1) First machine (IP of 192.168.4.1)

  • It contain the NiFi setup as show in the image below:

NiFiHTTP.JPG

  • Inside the NiFi setup, I get a file from a local directory and I invoke a HTTP POST to send over to the second machine which hit the Wildfly Restful Webservice endpoint. Below image show the configuration I have done inside the Invoke HTTP:

NiFiHTTP_invokeConfig1.JPG

 

(Note: the Remote URL: http://192.168.3.1:8081/JaxRS-Nifi/restapi/multipart/upload )

 

2) Second machine (IP of 192.168.3.1)

 

  • It contain a Wildfly Restful Webservice which allow my first machine to hit the webservice endpoint.

Error that I am facing:

 

Error.png

 

I have a problem which the first machines doesn't send a HTTP POST over to the Second machines. I am currently looking for solutions on what are the different configurations should I do to make a NiFi HTTP over to hit the Restful Webservice endpoint?

 

Thanks. Appreciate if there is anyone who can help me.

 

 

 

3 REPLIES 3

avatar
Super Mentor

@techNerd 

I am not sure how large your multi-part form data is that your are trying to post to you endpoint is, but your timeout values are very aggressive at 5 sec and 15 sec.  

Have you tried sending these values to more common 30 sec?
Have you tried reaching this endpoint from command line on the host where NiFi is running?
How is the rest of yoru processor configured?

Try using the PostHTTP [1] processor instead.
Make sure you set the "Content-Type" configuration property to match the content that is actually being sent.
For example:

Content-Type = multipart/form-data; boundary=<boundary id for multipart content>

Replace boundary sting with whatever your source content uses in its multipart form data.

[1] http://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.13.2/org.apache...


If you found this helped with yoru query, please take a moment to login and click accept on this solution.
Thank you,

Matt

avatar
Contributor

@MattWho 

 

Hi Matt, 

Thanks for the reply. 

I am sending a 1kb file over the rest endpoint of a different IP machine. What I am asking here is how do I configure the invokeHTTP request using IP address? 

 

Example: Machine 1 (192.168.4.1)  which contain NiFi (GetFile processor --> invokeHTTP processor) to Machine 2 (192.168.3.1) which contain the Wildfly restful webservice. 

 

Thanks.  

avatar
Super Mentor

@techNerd 

I don't know anything about the Wildfly endpoint service, so I can only assume your URL is correct.  Using the IP as you have should not be an issue as long as the NiFi host can reach that network address.

What you are seeing is a timeout which indicates the endpoint you are trying to reach did not respond to you post request.  There could be numerous reasons for this such as network issues, incorrect or missing headers on post request, bad endpoint URL, too many concurrent connections to the endpoint at time of this request, failed authentication, using http for a https endpoint, bad or no client authentication, etc...

I would suggest you monitor the logs on Wildfly when the post request is made by NiFi to see if:
1. Wildfly acknowledges receiving the request.
2. Wildfly does not throw and exception about the request.

Since the endpoint URL you shared had multipart in it, I assumed that perhaps it only accepts multi-part form data and thus may be expecting the proper header fo this type of data.  And if it is multi-part form data, you are going to have better success using the postHTTP processor instead of the InvokeHTTP processor.

Hope this helps you,
Matt