您可以将文件内容包含在 base64 编码中并使用curl post。
这是一个例子:
$ cat req.xml
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:mtom="http://ws.apache.org/axis2/mtomsample/" xmlns:xm="http://www.w3.org/2005/05/xmlmime">
<soap:Header/>
<soap:Body>
<mtom:AttachmentRequest>
<mtom:fileName>one.txt</mtom:fileName>
<mtom:binaryData xm:contentType="application/txt">SSBhbSB0aGUgZ3JlYXRlc3Qu</mtom:binaryData>
</mtom:AttachmentRequest>
</soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)
$ cat req.xml | curl -X POST -H '内容类型:application/soap+xml' -d @-
http://yourmachine.com:8080/axis2/services/MTOMSample.MTOMSampleSOAP12port_http/
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns2:AttachmentResponse xmlns:ns2="http://ws.apache.org/axis2/mtomsample/">
File saved succesfully.
</ns2:AttachmentResponse>
</soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)
这对你有用吗?