我正在尝试 mule training walkthrough 6-3 并获得不同的输出
I am trying mule training walkthrough 6-3 and getting a different output
这是 mule 4 开发人员培训的 6-3 中的示例演练。我在使用 Advanced Rest Client (ARC) 时得到不同的输出
谁能帮我解决这个问题。
下面是配置 XML 文件。
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="7afe9f88-0f1f-4a25-9c3f-572e417bd4a4" >
<http:listener-connection host="0.0.0.0" port="8081" />
</http:listener-config>
<http:request-config name="HTTP_Request_configuration" doc:name="HTTP Request configuration" doc:id="a965e1e5-26d7-49c1-9eb4-b169b18ff64f" >
<http:request-connection host="localhost" port="8081" />
</http:request-config>
<flow name="helloFlow" doc:id="d8e8afa2-238a-4dc5-9a43-96a932422a2a" >
<http:listener doc:name="GET /hello" doc:id="86b90724-ca42-46ee-bc40-41204f6a2f7f" config-ref="HTTP_Listener_config" path="/hello" allowedMethods="GET">
<http:response reasonPhrase="Success">
<http:headers ><![CDATA[#[output application/java
---
{
"name" : "Max"
}]]]></http:headers>
</http:response>
</http:listener>
<set-payload value="Hello World" doc:name="Hello" doc:id="c9c362cb-8d96-4a66-bdcf-91ce611cffbd" />
<http:request method="GET" doc:name="GET /goodbye" doc:id="a2eab23f-42d2-4fef-94ea-c170364c5e27" config-ref="HTTP_Request_configuration" path="/goodbye" responseTimeout="300000" />
<logger level="INFO" doc:name="Logger" doc:id="5f813a3c-9af8-4131-a1ec-2947e301ba90" />
</flow>
<flow name="apdev-examplesFlow" doc:id="06c419b2-f71e-4711-8d3c-4585b15fd8ed" >
<http:listener doc:name="GET /goodbyeFlow" doc:id="60dc16f6-47d5-460b-a471-4567ac7ec0d0" config-ref="HTTP_Listener_config" path="/goodbye" allowedMethods="GET"/>
<set-payload value="Goodbye Mulesoft" doc:name="Goodbye" doc:id="df40f379-5a7b-4556-abeb-7919863af9ec" />
<logger level="INFO" doc:name="Logger" doc:id="39f101bc-f33b-4fdc-b66c-032455f6d0af" />
</flow>
</mule>
预期输出
!(https://imgur.com/KRQJki0.png)
获得输出
为了在 ARC 中查看响应 headers - 单击最右侧的 'Details' link(它与 200 状态代码在同一行'
body 也不同,因为 set-payload 中有 'Goodbye Mulesoft' 而不是 'Goodbye':
<set-payload value="Goodbye Mulesoft" doc:name="Goodbye" doc:id="df40f379-5a7b-4556-abeb-7919863af9ec" />
更改为:
<set-payload value="Goodbye" doc:name="Goodbye" doc:id="df40f379-5a7b-4556-abeb-7919863af9ec" />
这将使您的 content-length headers 也匹配。
这是 mule 4 开发人员培训的 6-3 中的示例演练。我在使用 Advanced Rest Client (ARC) 时得到不同的输出
谁能帮我解决这个问题。
下面是配置 XML 文件。
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="7afe9f88-0f1f-4a25-9c3f-572e417bd4a4" >
<http:listener-connection host="0.0.0.0" port="8081" />
</http:listener-config>
<http:request-config name="HTTP_Request_configuration" doc:name="HTTP Request configuration" doc:id="a965e1e5-26d7-49c1-9eb4-b169b18ff64f" >
<http:request-connection host="localhost" port="8081" />
</http:request-config>
<flow name="helloFlow" doc:id="d8e8afa2-238a-4dc5-9a43-96a932422a2a" >
<http:listener doc:name="GET /hello" doc:id="86b90724-ca42-46ee-bc40-41204f6a2f7f" config-ref="HTTP_Listener_config" path="/hello" allowedMethods="GET">
<http:response reasonPhrase="Success">
<http:headers ><![CDATA[#[output application/java
---
{
"name" : "Max"
}]]]></http:headers>
</http:response>
</http:listener>
<set-payload value="Hello World" doc:name="Hello" doc:id="c9c362cb-8d96-4a66-bdcf-91ce611cffbd" />
<http:request method="GET" doc:name="GET /goodbye" doc:id="a2eab23f-42d2-4fef-94ea-c170364c5e27" config-ref="HTTP_Request_configuration" path="/goodbye" responseTimeout="300000" />
<logger level="INFO" doc:name="Logger" doc:id="5f813a3c-9af8-4131-a1ec-2947e301ba90" />
</flow>
<flow name="apdev-examplesFlow" doc:id="06c419b2-f71e-4711-8d3c-4585b15fd8ed" >
<http:listener doc:name="GET /goodbyeFlow" doc:id="60dc16f6-47d5-460b-a471-4567ac7ec0d0" config-ref="HTTP_Listener_config" path="/goodbye" allowedMethods="GET"/>
<set-payload value="Goodbye Mulesoft" doc:name="Goodbye" doc:id="df40f379-5a7b-4556-abeb-7919863af9ec" />
<logger level="INFO" doc:name="Logger" doc:id="39f101bc-f33b-4fdc-b66c-032455f6d0af" />
</flow>
</mule>
预期输出
!(https://imgur.com/KRQJki0.png)
获得输出
为了在 ARC 中查看响应 headers - 单击最右侧的 'Details' link(它与 200 状态代码在同一行'
body 也不同,因为 set-payload 中有 'Goodbye Mulesoft' 而不是 'Goodbye':
<set-payload value="Goodbye Mulesoft" doc:name="Goodbye" doc:id="df40f379-5a7b-4556-abeb-7919863af9ec" />
更改为:
<set-payload value="Goodbye" doc:name="Goodbye" doc:id="df40f379-5a7b-4556-abeb-7919863af9ec" />
这将使您的 content-length headers 也匹配。