В основном у меня есть команда curl (которая загружает файл в API), и я хочу выполнить эту команду curl через mule. Я читаю файл из коннектора чтения. Затем используйте данные multipart / form для преобразования команды curl. И затем передайте ее запросчику HTTP. БУТ во время работы приложения. API возвращает ошибку: «Входной файл отсутствует».
сообщение об ошибке
* - - + APPLICATION + - - * - - + DOMAIN + - - * - - + STATUS + - - *
*******************************************************************************************************
* mule_mediaupload * default * DEPLOYED *
*******************************************************************************************************
INFO 2020-05-25 19:56:16,835 [[MuleRuntime].io.04: [mule_mediaupload].so-file-http-request-sendFlow.BLOCKING @9753a94] [event: b17cd1f0-9e93-11ea-95ae-681401007098] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: Provider Name Date
Planetearth,2015-05-01
RockMusic,2017-09-01
INFO 2020-05-25 19:56:17,082 [[MuleRuntime].cpuIntensive.01: [mule_mediaupload].so-file-http-request-sendFlow.CPU_INTENSIVE @1fea2bb] [event: b17cd1f0-9e93-11ea-95ae-681401007098] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: ------=_Part_2583_1939156918.1590416776933
Content-Type: text/plain
Content-Disposition: form-data; name="params"
{Type:Import}
------=_Part_2583_1939156918.1590416776933--
INFO 2020-05-25 19:56:20,781 [[MuleRuntime].cpuLight.02: [mule_mediaupload].so-file-http-request-sendFlow.CPU_LITE @15368f21] [event: b17cd1f0-9e93-11ea-95ae-681401007098] org.mule.runtime.core.internal.processor.LoggerMessageProcessor: {
"success" : false,
"processId" : "CA410762B598945B",
"reasons" : [ {
"code" : 57040122,
"message" : "Input file is missing."
} ]
}
ниже - XML
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
<file:config name="File_Config" doc:name="File Config" doc:id="0272f407-da7b-46e7-a0e1-8f4edda4e3f9" >
<file:connection workingDir="C:\Files\" />
</file:config>
<http:request-config name="HTTP_Request_configuration" doc:name="HTTP Request configuration" doc:id="00b795c8-285e-445c-9bb0-8001f2ffdaf8" />
<http:request-connection protocol="HTTPS" host=" http://mysuperserver/" />
</http:request-config>
<flow name="so-file-http-request-sendFlow">
<scheduler doc:name="Scheduler" doc:id="d6b797dd-7f26-41eb-8bb9-74456a4606fc" >
<scheduling-strategy >
<fixed-frequency frequency="1" timeUnit="DAYS"/>
</scheduling-strategy>
</scheduler>
<file:read doc:name="Read" config-ref="File_Config" path="medialist.csv"/>
<logger level="INFO" doc:name="Logger" doc:id="2c9bb06a-e935-4469-8282-cef67adc5926" message="#[payload]"/>
<ee:transform doc:name="Transform Message" doc:id="7cc45c6a-9326-49de-bea1-d4c9a29a6b26">
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output multipart/form-data
---
{
parts : {
params : {
headers : {
"Content-Type": "text/plain"
},
content : "{actionType:Import}"
},
file : {
headers : {
"Content-Disposition" : {
"name": "file",
"filename": ",medialist.csv"
},
"Content-Type" : "application/csv"
}
}
}
}]]></ee:set-payload>
</ee:message>
</ee:transform>
<logger level="INFO" doc:name="Logger" doc:id="c5a60159-e14f-436b-8952-efabc3bc07ac" message="#[payload]"/>
<http:request method="POST" doc:name="Request" config-ref="HTTP_Request_configuration1" path="/media/upload/" doc:id="79ccd374-155d-40ca-b848-7e766337f5d3">
<http:headers ><![CDATA[#[output application/java
---
{
Accept : "application/json",
apiAccessKeyId : "username,
apiSecretAccessKey : "Password"
}]]]></http:headers>
</http:request>
<logger level="INFO" doc:name="Logger" doc:id="f2f8ffc4-3520-42d8-bca8-d45100adb144" message="#[payload]"/>
</flow>
</mule>