0

我正在尝试将 JSON 有效负载发布到 MuleESB 中的公共 POST Rest API,但出现此错误:

org.mule.module.http.internal.request.ResponseValidatorException:响应代码 404 映射为失败。

我可以通过 Postman Chrome 应用程序调用带有 JSON 正文的 API,但不能通过 Postman 桌面应用程序或 MuleESB。在过去的两天里,我一直在谷歌搜索,但仍然不知道我错过了什么。如果您知道是什么导致这不起作用,请赐教。

这是 JSON 有效负载:

{
  "username": "dummy",
  "email": "dummy@dummy.com",
  "firstName": "dummy",
  "lastName": "dummy"
}

这是我的 MuleESB 代码片段(我使用的是 3.8.3):

        <http:request-config name="HTTP_Request_Configuration" host="api.domain.com" port="443" doc:name="HTTP Request Configuration" protocol="HTTPS" responseTimeout="180000" tlsContext-ref="TLS_TrustStore"/>
        <tls:context name="TLS_TrustStore" doc:name="TLS">
            <tls:trust-store path="cacerts.jks" password="pwd"/>
        </tls:context>
        ...
        <dw:transform-message doc:name="Transform Message" metadata:id="c77537ba-aaf3-4497-9f09-06792d1f7556">
        <dw:input-payload mimeType="application/java"/>
        <dw:input-variable doc:sample="sample_data\UserDefined.dwl" variableName="userData"/>
        <dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
{
    username: flowVars.username as :string,
    email: flowVars.email as :string,
    firstName: flowVars.firstName as :string,
    lastName: flowVars.lastName as :string
}]]></dw:set-payload>
        </dw:transform-message>
        <logger message="payload:#[payload]" level="INFO" doc:name="Logger"/>        
        <set-property propertyName="Content-Type" value="application/json" encoding="UTF-8" mimeType="application/json" doc:name="Property"/>        
        <until-successful maxRetries="3" doc:name="Until Successful" synchronous="true">
            <http:request config-ref="HTTP_Request_Configuration" path="/api/1/users" method="POST" doc:name="HTTP">
                <http:request-builder>
                    <http:header headerName="Authorization" value="abcdefg"/>
                </http:request-builder>
            </http:request>
        </until-successful>
4

0 回答 0