简体   繁体   English

WSo2 API Manager 1.8.0-JSON解析问题

[英]WSo2 API Manager 1.8.0 - JSON parsing issue

I am new to wso2 API Manager, trying to set it up expose my plain HTTP POST back end calls as a REST API. 我是wso2 API Manager的新手,试图将其设置为将我的普通HTTP POST后端调用公开为REST API。 I am sure this is not a new pattern that I am trying to achieve here. 我确信这不是我要在这里实现的新模式。 The requirement is to convert the JSON data coming in (has array structures) into the HTTP URL query string parameters. 要求是将传入的JSON数据(具有数组结构)转换为HTTP URL查询字符串参数。

After some research through the documentation and other posts on this forum, decided to go with the script mediator that would parse the JSON data and convert it to a string that can be appended to the endpoint URL. 在对该文档的文档和该论坛上的其他文章进行了一些研究之后,决定使用脚本中介程序,该脚本中介程序将解析JSON数据并将其转换为可以附加到端点URL的字符串。 Some how I am not able to achieve this. 我如何无法做到这一点。

I have followed the following post that seems to be very straight forward. 我关注了以下似乎很简单的帖子。 As the original poster suggested, I am also not able to use getPayloadJSON() method. 正如原始海报所建议的那样,我也无法使用getPayloadJSON()方法。 Even have trouble using the work around suggested there due to JSON.parse() not working. 由于JSON.parse()无法正常工作,甚至无法使用建议的解决方法。

Link 链接

Also, this approach of editing the service bus configuration from source view does not sound like the correct option. 同样,从源代码视图编辑服务总线配置的这种方法听起来不像是正确的选项。 Is there another elegant solution to achieve this? 是否有另一个优雅的解决方案来实现这一目标? Thanks for the help in advance. 我在这里先向您的帮助表示感谢。

I was able to get both methods working by using an external script instead of the inline java script. 通过使用外部脚本而不是嵌入式Java脚本,我能够使这两种方法都起作用。 Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM