FileWrite

Записывает данные в файл.

Запрос

POST /DocsVision/StorageServer/StorageServerService.asmx HTTP/1.1
Host: DOCSVISION_SERVER.COM
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://schemas.docsvision.com/Platform/2009-02-03/StorageServer/FileWrite"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <FileWrite xmlns="http://schemas.docsvision.com/Platform/2009-02-03/StorageServer/">
      <sessionId>guid</sessionId>
      <fileHandleId>guid</fileHandleId>
      <compressed>boolean</compressed>
      <fileData>base64Binary</fileData>
    </FileWrite>
  </soap:Body>
</soap:Envelope>
Параметры
sessionId

Идентификатор пользовательской сессии

fileHandleId

Указатель на открытый файл

compressed

Используется сжатие данных, переданных в fileData

fileData

Содержимое файла

Ответ

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <FileWriteResponse xmlns="http://schemas.docsvision.com/Platform/2009-02-03/StorageServer/" />
  </soap:Body>
</soap:Envelope>

Пример запроса

Пример записи содержимого файла на диске в файл базы данных:

session.headers['SOAPAction'] = "http://schemas.docsvision.com/Platform/2009-02-03/StorageServer/FileWrite" (1)

with open("Z:\\Document.docx", "rb") as image_file:
    encoded_string = base64.b64encode(image_file.read()).decode('utf-8')

body = """<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <FileWrite xmlns="http://schemas.docsvision.com/Platform/2009-02-03/StorageServer/">
      <sessionId>6565c75b-298d-e511-9417-90e6ba57b9f8</sessionId>
      <fileHandleId>c40c8af4-5a8f-e511-9417-90e6ba57b9f8</fileHandleId>
      <compressed>false</compressed>
      <fileData>"""+encoded_string+"""</fileData>
    </FileWrite>
  </soap:Body>
</soap:Envelope>""" (2)

response = session.post(url, data=body) (3)
1 Изменяем цель запроса в заголовке запроса.
2 SOAP-сообщение.
3 Отправляем SOAP-сообщение.