NiFi 如何将 InvokeHTTP 处理器与 SOAP 一起使用 [英] NiFi How to use InvokeHTTP Processor with SOAP

查看:51
本文介绍了NiFi 如何将 InvokeHTTP 处理器与 SOAP 一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到其他人已经能够让它发挥作用,但是我无法找到足够的细节来解释他们是如何做到这一点的,以便我能够让它发挥作用.

解决方案

这里我缺少的关键是需要将 xml SOAP 请求作为流文件内容而不是流文件属性发送.我花了一段时间才知道如何使用自定义内容创建流文件.

使用 InvokeHTTP 处理器发出 SOAP 请求的关键是要求 InvokeHTTP 处理器将 xml SOAP 请求作为流文件接收,因为当处理器发送 httpPOST 请求将其属性作为 SOAP 请求的标头发送,并将传入的流文件内容作为 SOAP 主体发送.这花了一些时间来理解,然后才弄清楚如何自定义流文件的内容.

我最初的错误是我试图单独使用 GenerateFlowFile 处理器并将其直接发送到 InvokeHTTP 处理器.这对我不起作用,因为我不知道如何将我放置到 GenerateFlowFile 动态属性中的文本"转换为内容.

最后一个人

GenerateFlowFile 和 ReplaceText 处理器的属性:

最后,我们只需要向 InvokeHTTP 处理器添加一些动态属性,并将其与传入的流文件一起作为 HTTP POST 请求提交.同样,属性作为标题发送,传入的流文件内容作为正文发送.这需要一点时间来理解,但是一旦您将各个部分组合在一起并正确设置,就很容易了.

I see that others have been able to get this to work however I am unable to find enough detail explaining how they accomplished this in order for me to get this to work.

This guy at this link claims he was able to do this. While there is a brief description as to how to do this I don't fully understand it.

The solution presented was:

With InvokeHTTP, you can add dynamic properties, which will be sent in the request as headers. You can use dynamic properties to set values for the Content-Type and SOAPAction headers, just use the header names for the names of the dynamic properties. InvokeHTTP lets you control the HTTP method, so you can set that to POST. The remaining step would be to get the content of request.xml to be sent to the InvokeHTTP as a flowfile. One way to do this is to use a GetFile processor to fetch requeset.xml from some location on the filesystem, and pass the success relationship of GetFile to InvokeHTTP

--Jeff.

I'm using SOAPUI to verify that everything works and it does as I am getting the appropriate XML response back. However I am unable to accomplish this in NiFi. My guess is that I don't know what to call my dynamic properties. I also don't fully understand what data I'd add to the Value of my dynamic properties.

InvokeHTTP Processor Properties Screenshot:

解决方案

The key here that I was missing was the need to send the xml SOAP request as Flow File Content rather than a Flow File Attribute. It took awhile before I was clued in as to how to create a Flow File with custom content.

The key with using the InvokeHTTP processor to make a SOAP request was the requirement for the InvokeHTTP processor to receive the xml SOAP request as a Flow File due to the fact that when the processor sends the http POST request it sends it's Attributes as the headers of the SOAP request and the incoming Flow File content as the SOAP Body. This took awhile to understand and after that to figure out how to customize the content of a Flow File.

My original mistake was my attempting to use the GenerateFlowFile processor by itself and send it directly to the InvokeHTTP processor. This didn't work for me as I had no clue how to convert the 'text' I placed into the GenerateFlowFile dynamic Attribute as the Content.

Finally an individual HERE clued me in as to how one could create a Flow File with custom Content by using the ReplaceText processor to convert the Attribute I had created in the GenerateFlowFile processor as the Flow File Content.

Finally I had the Flow File in the correct format that the InvokeHTTP Processor required in order to send/POST the SOAP request.

Screenshot of the Flow:

Properties of GenerateFlowFile and ReplaceText Processors:

Last we just need to add some Dynamic Attributes to the InvokeHTTP processor and submit that along with the incoming Flow File as an HTTP POST request. Again the Attributes are sent as Headers and the incoming Flow File Content is sent as the BODY. This took a little bit to understand but it's pretty easy once you have the pieces put together and setup correctly.

这篇关于NiFi 如何将 InvokeHTTP 处理器与 SOAP 一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆