使用JSON的Pentaho HTTP Post [英] Pentaho HTTP Post using JSON

查看:215
本文介绍了使用JSON的Pentaho HTTP Post的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Pentaho的新手,我正在尝试以下工作流程:

I'm brand new to Pentaho and I'm trying to do the following workflow:


  • 读取一堆行数据库

  • 进行一些转换

  • 将它们发送到JSON中的REST Web服务

我已经使用输入步骤和Json输出步骤计算出前两个。

I've got the first two figured out using an input step and the Json Output step.

但是我有两个问题在做最后一步:

However I have two problems doing the final step:

1)我无法按照自己的意愿获得JSON格式。它只是想要 {...} 。这不是什么大问题 - 我可以解决这个问题,因为我可以控制Web服务,我可以稍微放宽输入要求。 (注意:此页面 http://wiki.pentaho.com/display/EAI/JSON+输出通过在块= 1 中设置 no. rows和一个空的JSON块名称,给出了我想要的输出示例,但它不起作用广告。)

1) I can't get the JSON formatted how I want. It insists on doing {""=[{...}]} when I just want {...}. This isn't a big deal - I can work around this since I have control over the web service and I could relax the input requirements a bit. (Note: this page http://wiki.pentaho.com/display/EAI/JSON+output gives an example for the output I want by setting no. rows in a block=1 and an empty JSON block name, but it doesn't work as advertised.)

2)这是关键的一个。我无法将数据作为JSON获取POST。它发布为 key = value ,其中键是我在HTTP Post字段名称中指定的名称(在Fields选项卡上),值是编码的JSON。我只想发布JSON作为请求体。我已经尝试使用谷歌搜索,但找不到其他人这样做,让我相信我只是接近这个错误。正确方向的任何指针?

2) This is the critical one. I can't get the data to POST as JSON. It posts as key=value, where the key is the name I specify in the HTTP Post field name (on the 'Fields' tab) and the value is the encoded JSON. I just want to post the JSON as the request body. I've tried googling on this but can't find anyone else doing it, leading me to believe that I'm just approaching this wrong. Any pointers in the right direction?

编辑:我很喜欢脚本(用Javascript或其他语言编写)但当我尝试在自定义的javascript片段中使用XmlHttpRequest时,我得到了没有定义XmlHttpRequest的错误。

I'm comfortable scripting (in Javascript or another language) but when I tried to use XmlHttpRequest in a custom javascript snippet I got an error that XmlHttpRequest is not defined.

谢谢!

推荐答案

这很简单......只需要使用REST客户端( http://wiki.pentaho .com / display / EAI / Rest + Client )而不是HTTP Post任务。不知何故,我所有的谷歌搜索都没有发现,所以我会留下这个答案,以防其他人遇到与我相同的问题。

This was trivial...just needed to use the REST Client (http://wiki.pentaho.com/display/EAI/Rest+Client) instead of the HTTP Post task. Somehow all my googling didn't discover that, so I'll leave this answer here in case someone else has the same problem as me.

这篇关于使用JSON的Pentaho HTTP Post的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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