简短:我想使用 POST 方法将几个参数(如 user=admin、key=12345678)发布到 PHP 页面(如 localhost/post-debug.php)。该脚本将读取 $_POST 值并执行任何操作。
我的问题是:
1.我怎样才能让下面的例子工作?
2. 如何从 JSON 编码的有效负载创建带有 POST 参数的地图有效负载并将其发送到 PHP 脚本?
下面是我试图运行的一个孤立案例(参数是从 HTTP 端点“读取”的)。我直接从浏览器调用以下 URL:
http://localhost:8081/httpPost?user=admin&key=12345678
底层 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:spring="http://www.springframework.org/schema/beans" version="CE-3.3.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd ">
<flow name="httpPostTestFlow1" doc:name="httpPostTestFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="httpPost" doc:name="HTTP"/>
<http:body-to-parameter-map-transformer doc:name="Body to Parameter Map"/>
<echo-component doc:name="Echo"/>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost/post-debug.php" port="80" contentType="application/x-www-form-urlencoded" doc:name="HTTP" />
</flow>
</mule>
我正在使用 MuleStudio 1.3.2,Mule ESB v.3.3。
我已经审查了许多类似的问题,但没有一个让我走上正轨。