NiFi 如何使用带有 SOAP 的 InvokeHTTP 处理器

NiFi How to use InvokeHTTP Processor with SOAP

我看到其他人已经能够让这个工作,但是我找不到足够的细节来解释他们是如何完成的,以便我让这个工作。

This guy at this link 声称他能够做到这一点。虽然有关于如何执行此操作的简短说明,但我并不完全理解它。

提出的解决方案是:

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.

我正在使用 SOAPUI 来验证一切正常,并且在我收到适当的 XML 响应时它确实有效。但是我无法在 NiFi 中完成此操作。我的猜测是我不知道如何称呼我的动态属性。我也不完全理解我要添加到动态属性的 Value 中的数据。

调用 HTTP 处理器属性屏幕截图:

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

使用 InvokeHTTP 处理器发出 SOAP 请求的关键是要求 InvokeHTTP 处理器将 xml SOAP 请求作为流文件接收,因为当处理器发送 http POST 请求它发送它的属性作为 SOAP 请求的 headers 和传入的流文件内容作为 SOAP Body。这花了一些时间来理解,然后才弄清楚如何自定义流文件的内容。

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

最后,一个人 HERE 告诉我如何通过使用 ReplaceText 处理器转换我在 [=11= 中创建的属性来创建具有自定义内容的流文件] 处理器作为流文件内容。

最后,我得到了 InvokeHTTP 处理器 send/POST SOAP 请求所需格式正确的流文件。

流程截图:

GenerateFlowFile 和 ReplaceText 处理器的属性:

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