我是Mulesoft的新手,并试图发送一些(四个)查询参数。 “:” INVALID_REQUEST “ ”ERROR_DESCRIPTION当使用SOAP UI A screen shot of what I tested如何将查询字符串传递给使用mulesoft的发布请求
测试我使用下面的XML配置
<flow name="boxintegrationFlow1">
<http:listener config-ref="HTTP_Listener_Configuration1" path="*" doc:name="HTTP"/>
<logger message="Message: #[message.inboundProperties] Code: #[message.inboundProperties.'http.query.params'.code]" level="INFO" doc:name="Logger"/>
<set-property propertyName="Content-Type" value="application/x-www-form-urlencoded" doc:name="Property"/>
<set-variable variableName="QueryParameters" value="{'grant_type':'authorization_code', 'code':''#[message.inboundProperties.'http.query.params'.code]','client_id':'abc','client_secret':'xyz'}" doc:name="Variable" mimeType="application/x-www-form-urlencoded"/>
<logger message="#[flowVars.QueryParameters]" level="INFO" doc:name="Logger"/>
<set-payload value="#[flowVars.QueryParameters]" doc:name="PostQueryParameters"/>
<http:request config-ref="getToken" path="/oauth2/token" method="POST" sendBodyMode="ALWAYS" doc:name="HTTP">
<http:request-builder>
<http:query-param paramName="grant_type" value="authorization_code"/>
<http:query-param paramName="code" value="#[message.inboundProperties.'http.query.params'.code]"/>
<http:query-param paramName="client_id" value="xyz"/>
<http:query-param paramName="client_secret" value="abc"/>
</http:request-builder>
<http:success-status-code-validator values="400"/>
</http:request>
<logger message="Message: #[message.outboundProperties] " level="INFO" doc:name="Logger"/>
</flow>
在这样做我得到一个错误 “{” 错误重复这mulesoft“:”无效的grant_type参数或参数缺失“}”
我明白我们已经将它作为查询字符串传递,但我无法弄清楚我该如何做。
任何指针表示赞赏。先谢谢你!
其工作正常,当我测试它。在那里发送它作为查询参数。 –
您还在查询字符串和帖子正文中设置参数。你应该只在一个地方做。我知道骡OAuth提供商会给你一个错误,如果你把它放在两个地方。删除身体,只使用查询字符串,反之亦然。这可能是你的问题。 – Charles
感谢您的快速回复..建议我尝试删除它们在一个地方。 –