如何在Mule中使用PUT方法调用REST服务?

时间:2016-09-13 08:32:54

标签: rest mule mule-studio put anypoint-studio

以下是我的流程。我需要使用PUT方法调用REST服务。使用相同的json请求和相同的服务URL它从Postman工作正常,但是从Mule我得到错误:“不能PUT / api / sms / send”。有人可以告诉我有什么问题吗?

         <?xml version="1.0" encoding="UTF-8"?>

     <mule xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" 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.7.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
     http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd">
         <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8093" doc:name="HTTP Listener Configuration"/>
         <http:request-config name="HTTP_Request_Configuration" protocol="HTTPS" host="api.example.com" port="443" doc:name="HTTP Request Configuration"/>
         <flow name="testprojectFlow">
             <http:listener config-ref="HTTP_Listener_Configuration" path="/test" allowedMethods="GET" doc:name="HTTP"/>
             <dw:transform-message doc:name="Transform Message">
                 <dw:set-payload><![CDATA[%dw 1.0
     %output application/json
     ---
     {
         message_id: "d5c9af23-f1b2-4d5e-9d6b-439371e0009a",
         dst_number: "1234567890",
         src_number: "1234567891",
         message_type: "SMS:TEXT",
         message_data:  "TEST MESSAGE SMS API",
         submit_date: now
     }]]></dw:set-payload>
             </dw:transform-message>
             <http:request config-ref="HTTP_Request_Configuration" path="/api/sms/send" method="PUT" doc:name="HTTP"/>
             <logger level="INFO" doc:name="Logger"/>
         </flow>
     </mule>

0 个答案:

没有答案