'multipart SOAP request in Savon

I need to build this multipart request in SAVON for calling executeProcess method of a SOAP service:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsim="http://www.contoso.com/wsimport">
   <soapenv:Header/>
   <soapenv:Body>
      <wsim:executeProcess>
         <wsim:common-attribute wsim:name="client-id" wsim:value="CLIENT1"/>
         <wsim:common-attribute wsim:name="process-id" wsim:value="WSSync"/>
         <wsim:document wsim:name="Test.pdf" wsim:content-type="application/pdf">
            <!--Part name of multipart content-->
            <wsim:content>cid:1546150551033</wsim:content>
            <wsim:attribute wsim:name="type-id" wsim:value="fatp_el" />
            <wsim:attribute wsim:name="document-date" wsim:value="20200120"/>
            <wsim:custom-attribute wsim:name="year" wsim:value="2020"/>
            <wsim:custom-attribute wsim:name="month" wsim:value="01"/>
            <wsim:custom-attribute wsim:name="day" wsim:value="20"/>
         </wsim:document>
      </wsim:executeProcess>
   </soapenv:Body>
</soapenv:Envelope>

How can i upload a file and refer to a tag? Can i use savon-multipart gem?

How can i declare common-attribute, document, attribute and custom-attribute tags?

I tried this code without success, I'm pretty confused...

client = Savon.client wsdl: wsdl, basic_auth: ["user", "password"]
message = {}
message["common-attribute"] = []
common_attribute = {"common-attribute": "", attributes!: {"common-attribute": {name: "client-id", "value": "CLIENT1"}}}
message["common-attribute"] << common_attribute
common_attribute = {"common-attribute": "", attributes!: {"common-attribute": {name: "process-id", "value": "WSSync"}}}
message["common-attribute"] << common_attribute
...
response = client.build_request :execute_process, message: message
puts response.body


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source