Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mule ESB-如何通过HTTP POST方法调用API(发送参数)_Http_Post_Mule - Fatal编程技术网

Mule ESB-如何通过HTTP POST方法调用API(发送参数)

Mule ESB-如何通过HTTP POST方法调用API(发送参数),http,post,mule,Http,Post,Mule,又是我 我正在尝试创建一个将职位空缺发布到职位门户的流程。他们通过Post方法公开API。我不确定如何将这些值传递到HTTP端点。 这只是一个带有硬编码值的测试样本。当它工作时,我将让流从数据库中提取值 <?xml version="1.0" encoding="UTF-8"?> <mule xmlns:wmq="http://www.mulesoft.org/schema/mule/ee/wmq" xmlns:http="http://www.mulesoft.org/sch

又是我

我正在尝试创建一个将职位空缺发布到职位门户的流程。他们通过Post方法公开API。我不确定如何将这些值传递到HTTP端点。 这只是一个带有硬编码值的测试样本。当它工作时,我将让流从数据库中提取值

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:wmq="http://www.mulesoft.org/schema/mule/ee/wmq" 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="EE-3.4.2"
        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
    http://www.mulesoft.org/schema/mule/ee/wmq http://www.mulesoft.org/schema/mule/ee/wmq/current/mule-wmq-ee.xsd">
        <http:connector name="HTTP_CONFIG" cookieSpec="netscape" validateConnections="false" sendBufferSize="0" receiveBufferSize="0" receiveBacklog="0" clientSoTimeout="100000" serverSoTimeout="100000" socketSoLinger="0" proxyHostname="pta-proxy.work.co.za" proxyPort="3128" doc:name="HTTP\HTTPS" />
        <flow name="career24Flow1" doc:name="career24Flow1">
            <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8083" doc:name="HTTP" contentType="text/plain"/>       
            <message-properties-transformer  doc:name="Set the  post Values" >
                <add-message-property key="apikey" value="XXXX"/>
                <add-message-property key="integrationkey" value="567"/>
                <add-message-property key="consultantemail" value="integrations@work.com"/>
                <add-message-property key="title" value="Testing Mule API"/>
                <add-message-property key="reference" value="33175"/>
                <add-message-property key="jobtypeid" value="1"/>
                <add-message-property key="closingdate" value="01/06/2014"/>
                <add-message-property key="location" value="66"/>
                <add-message-property key="salaryfrom" value="10000.00"/>
                <add-message-property key="salaryto" value="20000.00"/>
                <add-message-property key="salaryunitid" value="4"/>
                <add-message-property key="description" value="Testing the Mule ESB to post to the portal"/>
                <add-message-property key="companyname" value="CSIR"/>
                <add-message-property key="sectorids" value="17"/>
                <add-message-property key="applicationmethodid" value="2"/>
                <add-message-property key="applicationurl" value="http://www.testing.com"/>
                <add-message-property key="package" value="2"/>
            </message-properties-transformer>
            <http:outbound-endpoint exchange-pattern="request-response" host="api.work.com" port="80" method="POST" doc:name="Post on Career24"  path="_integrations/httppost/vacancy.ashx" connector-ref="HTTP_CONFIG" contentType="application/x-www-form-urlencoded"/>

        </flow>
    </mule>
我也尝试过“消息到HTTP响应”转换器,但仍然没有成功

谢谢你的帮助

问候


Jaco.

将属性与http出站端点一起使用将它们设置为http头。相反,您需要Map类型的有效负载来将它们设置为POST变量

像这样:

<set-payload value="#[['xxx':'yyy']]"/>


谢谢安东。我只是想确定一下语法。或者这是错的?是的,你有正确的语法。但是,根据您的用例,您可能希望以其他方式填充地图。
<set-payload value="#[['xxx':'yyy']]"/>