使用Apache Camel处理JSON请求

M. *_*nos 1 java json jetty apache-camel

我想处理一个第三方对我的系统执行的HTTPs请求。请求包含一个JSON对象

我尝试使用骆驼的码头组件,但是当第三方执行请求时,骆驼抛出以下异常:

org.apache.camel.RuntimeCamelException: Cannot read request parameters due Invalid parameter, expected to be a pair but was {"id":"321","rec":"533","status":"ok"}
Run Code Online (Sandbox Code Playgroud)

在蓝图中,Jetty端点定义为:

<camel:endpoint id="getRequestEndpoint" uri="jetty:{{webServiceProtocol}}://{{jettyIp}}:{{jettyPort}}/getRequest?sslContextParametersRef=sslContextParameters"/>
Run Code Online (Sandbox Code Playgroud)

我是否缺少某些东西或走在完全错误的道路上?

rau*_*ulk 5

确保您的客户端正在Content-Type为JSON 发送适当的HTTP请求标头,即:

Content-Type: application/json
Run Code Online (Sandbox Code Playgroud)

好像没有发送,Jetty组件回退以形成数据解释。