Я пытался создать клиент WSO2ESB для загрузки документа (multipart / formdata) со следующей конфигурацией
<?xml version="1.0" encoding="UTF-8"?>
<api context="/v1/document" name="DocumentUpload " xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST" uri-template="/upload">
<inSequence>
<property name="username" scope="default" type="STRING" value="xxxx"/>
<property name="password" scope="default" type="STRING" value="xxxxx"/>
<property expression="fn:concat($ctx:username,':',$ctx:password)" name="credentials" scope="default" type="STRING"/>
<property expression="fn:concat('Basic ', base64Encode($ctx:credentials))" name="Authorization" scope="transport" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<root>
<filedata filename="testFile.txt">Random text content... </filedata>
<siteid>operational-document</siteid>
<containerid>documentLibrary</containerid>
<uploadDirectory>/2020/JUL/Jul-7</uploadDirectory>
<description>uploaded file</description>
<contenttype>cm:content</contenttype>
<thumbnails>doclib</thumbnails>
</root>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args/>
</payloadFactory>
<!-- <property name="messageType" scope="axis2" type="STRING" value="multipart/form-data"/> -->
<property name="messageType" scope="axis2" type="STRING" value="multipart/form-data"/>
<property name="ContentType" scope="axis2" type="STRING" value="multipart/form-data"/>
<property name="DISABLE_CHUNKING" scope="axis2" type="STRING" value="true"/>
<log level="full"/>
<call>
<endpoint>
<http method="post" uri-template="http://dmstest03:8080/alfresco/service/api/upload">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>1</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
<respond description="reponse back"/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
Это дает следующий ответ с неверными данными от сервера - Все обязательные поля переданы неправильно
{
"status": {
"code": 400,
"name": "Bad Request",
"description": "Request sent by the client was syntactically incorrect."
},
"message": "Required parameters are missing",
"exception": "",
"callstack": [],
"server": "Enterprise v5.2.3 (r852994b1-b12) schema 10,065",
"time": "13-Jul-2020 09:14:11"
}
Я вырезал журнал wirehack следующим образом: [щелкните следующую ссылку, чтобы увидеть изображение wirehack
изображение wirehack