FileCreate

Создаёт новый файл.

Данный метод не загружает содержимое файла в созданную в Docsvision сущность — для этого необходимо использовать метод 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/FileCreate"

<?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>
    <FileCreate xmlns="http://schemas.docsvision.com/Platform/2009-02-03/StorageServer/">
      <sessionId>guid</sessionId>
      <name>string</name>
    </FileCreate>
  </soap:Body>
</soap:Envelope>
Параметры
sessionId

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

name

Название файл

Ответ

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>
    <FileCreateResponse xmlns="http://schemas.docsvision.com/Platform/2009-02-03/StorageServer/">
      <fileId>guid</fileId>
    </FileCreateResponse>
  </soap:Body>
</soap:Envelope>

Ответ содержит идентификатор файла.

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

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

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>
    <FileCreate xmlns="http://schemas.docsvision.com/Platform/2009-02-03/StorageServer/">
      <sessionId>6565c75b-298d-e511-9417-90e6ba57b9f8</sessionId>
      <name>Z:\\upload_file.docx</name>
    </FileCreate>
  </soap:Body>
</soap:Envelope>""" (2)

response = session.post(url, data=body) (3)

responseParsed = ElementTree.fromstring(response.content)
print(responseParsed.findtext(".//{http://schemas.docsvision.com/Platform/2009-02-03/StorageServer/}fileId")) (4)
1 Изменяем цель запроса в заголовке запроса.
2 SOAP-сообщение.
3 Отправляем SOAP-сообщение.
4 Разбираем ответ и выводим идентификатор созданного файла.