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

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

问题描述

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

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.

提出的解决方案是:

使用InvokeHTTP,您可以添加动态属性,这些属性将在请求中作为标头发送.您可以使用动态属性来设置Content-Type和SOAPAction标头的值,只需将标头名称用作动态属性的名称即可. InvokeHTTP允许您控制HTTP方法,因此可以将其设置为POST.剩下的步骤将是获取request.xml的内容作为流文件发送到InvokeHTTP.一种方法是使用GetFile处理器从文件系统上的某个位置获取requeset.xml,并将GetFile的成功关系传递给InvokeHTTP

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

-杰夫.

我正在使用SOAPUI验证一切正常,并且在我获得适当的XML响应时也能正常工作.但是,我无法在NiFi中完成此操作.我的猜测是我不知道该怎么称呼我的动态属性.我也不太了解要添加到动态属性Value中的哪些数据.

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.

推荐答案

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

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.

使用InvokeHTTP处理器发出SOAP请求的关键是InvokeHTTP处理器要求以流文件的形式接收xml SOAP请求,原因是当处理器发送http POST请求时,它发送的是属性作为SOAP请求的标头,传入的流文件内容作为SOAP正文.这花了一段时间才能理解,然后才弄清楚如何自定义流文件的内容.

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.

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

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.

最后,一个个人这里将我吸引到关于如何使用ReplaceText处理器将我在GenerateFlowFile处理器中创建的属性转换为流文件内容的方式,如何使用自定义内容创建流文件.

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.

最后,我具有InvokeHTTP处理器所需的正确格式的流文件,以便发送/发布SOAP请求.

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

流程的屏幕截图:

GenerateFlowFile和ReplaceText处理器的属性:

Properties of GenerateFlowFile and ReplaceText Processors:

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

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天全站免登陆