我试图在http请求中传递多个URI参数,如下所示:
<http:listener-config name="HTTP_Listener_Configuration"
host="localhost" port="8081" doc:name="HTTP Listener Configuration"
connectionIdleTimeout="40000" />
<http:request-config name="HTTP_Request_Configuration1" protocol="HTTPS" host="" port="443" doc:name="HTTP Request Configuration" connectionIdleTimeout="300000" responseTimeout="50000">
<http:basic-authentication username="user" password="123"/>
</http:request-config>
<flow name="testFlow">
<http:listener config-ref="HTTP_Listener_Configuration"
path="/paypal" allowedMethods="GET" doc:name="HTTP" />
<set-variable variableName="config" value="#[{'p1':'3054', 'p2':'child/Lines'}]" doc:name="Variable"/>
<http:request config-ref="HTTP_Request_Configuration1" path="/resources/shipment/{p1}/{p2}" method="GET" doc:name="HTTP">
<http:request-builder>
<http:uri-params expression="#[flowVars.config]"/>
</http:request-builder>
</http:request>
</flow>但这让我犯了以下错误:
响应代码404映射为failure.
ERROR 2019-01-04 18:46:34,526
[[paypaltest].HTTP_Listener_Configuration.worker.01]
org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Response code 404 mapped as failure.
Payload : org.glassfish.grizzly.utils.BufferInputStream@b473ec2
Element : /testFlow/processors/1 @ test:test.xml:29 (HTTP)
Element XML : <http:request config-ref="HTTP_Request_Configuration1" path="/resources/shipments/{p1}/{p2}" method="GET" doc:name="HTTP">
<http:request-builder>
<http:uri-params expression="#[flowVars.config]"></http:uri-params>
</http:request-builder>
</http:request>
--------------------------------------------------------------------------------
Root Exception stack trace:
org.mule.module.http.internal.request.ResponseValidatorException: Response code 404 mapped as failure.如果可以提供任何帮助,请让我知道!
发布于 2019-01-04 13:50:15
这意味着url不存在。在执行Mule之前,尝试在邮递员中直接点击网址。既然你消灭了host="",我就假装它是example.com。我的猜测是,它与p2有问题。如果要发送实际字符串,则需要对"/“进行URL编码,即%2F
因此,要测试命中https://www.example.com/resources/shipments/3054/child%2FLines,使用基本8月的授权。
发布于 2019-01-08 10:14:57
我面临的问题对我来说是独一无二的,我尝试了来自SOAPUI的REST调用,在那里它给了我同样的错误,即404 not found,所以我将它与POSTMAN请求进行比较,发现Authorization头是这方面缺少的部分。在将这个添加到http header之后,它完美地工作了。
发布于 2019-01-09 06:37:38
请参阅https://docs.mulesoft.com/connectors/http/http-authentication
这里有两个解决方案: 1.在基本身份验证配置中添加preemptive="true“,先发制人选项传递用户名和密码,而无需等待服务器的提示。
https://stackoverflow.com/questions/54039838
复制相似问题