ADN Open CIS
Сообщество программистов Autodesk в СНГ

12/03/2014

Лёгкое программирование под Autodesk Vault. Часть 3

НазадСодержаниеДалее


Все методы Vault API могут быть разделены на группы по типам операций. Сформируем их на основании первого слова в имени метода. На диаграмме ниже представлено распределение типов,  в которых присутствует более трёх методов.

Вы можете видеть здесь Get, Update, Delete, Add, и пр. Считаю, что впоследствии было бы правильно начать изучение с наиболее «частых» типов методов.

Клиент-серверное общение выполняется в виде SOAP команд по HTTP. Вы можете убедиться в этом, пронаблюдав за клиент-серверным диалогом при помощи веб-дебаггера, такого как  Fiddler, например. Мы можем инициировать общение при помощи вызова PowerShell, который получает все группы на сервере.

Код - PowerShell: [Выделить]
  1. Add-Type -Path "C:\Program Files (x86)\Autodesk\Autodesk Vault 2014 SDK\bin\Autodesk.Connectivity.WebServices.dll"
  2. $cred = New-Object Autodesk.Connectivity.WebServicesTools.UserPasswordCredentials ("localhost","Vault","Administrator","",$true)
  3. $webSvc = New-Object Autodesk.Connectivity.WebServicesTools.WebServiceManager ($cred)
  4. $groups = $webSvc.AdminService.GetAllGroups()
  5. $groups | Out-GridView

Что происходит в процессе общения. Запрос клиента:

Код - HTML: [Выделить]
  1. POST http://localhost/AutodeskDM/Services/SecurityService.asmx HTTP/1.1
  2. User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.2034)
  3. Content-Type: text/xml; charset=utf-8
  4. SOAPAction: "http://AutodeskDM/Services/Security/1/20/2011/SignInReadOnly"
  5. Host: localhost
  6. Content-Length: 1287
  7. Expect: 100-continue
  8. Connection: Keep-Alive
  9.  
  10. <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><soap:Header><wsa:Action>http://AutodeskDM/Services/Security/1/20/2011/SignInReadOnly</wsa:Action><wsa:MessageID>urn:uuid:d855ea25-abb7-4fbe-bbc9-9b24a2e91b33</wsa:MessageID><wsa:ReplyTo><wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address></wsa:ReplyTo><wsa:To>http://localhost/AutodeskDM/Services/SecurityService.asmx</wsa:To><wsse:Security><wsu:Timestamp wsu:Id="Timestamp-e1aaa0b4-81b5-4fab-9782-19da84e1f16c"><wsu:Created>2014-02-22T23:22:43Z</wsu:Created><wsu:Expires>2014-02-22T23:27:43Z</wsu:Expires></wsu:Timestamp></wsse:Security></soap:Header><soap:Body><SignInReadOnly xmlns="http://AutodeskDM/Services/Security/1/20/2011/"><userName>Администратор</userName><userPassword /><knowledgeVault>Vault test-drive</knowledgeVault></SignInReadOnly></soap:Body></soap:Envelope>
  11. HTTP/1.1 200 OK
  12. Cache-Control: private
  13. Content-Length: 453
  14. Content-Type: text/xml; charset=utf-8
  15. Server: Microsoft-IIS/7.5
  16. X-AspNet-Version: 4.0.30319
  17. X-Powered-By: ASP.NET
  18. Date: Sat, 22 Feb 2014 23:22:30 GMT
  19.  
  20. <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><SecurityHeader xmlns="http://AutodeskDM/Services/Security/1/20/2011/"><Ticket>aeffa132-95a0-431a-ab76-df3ba4fb5d5b</Ticket><UserId>2</UserId></SecurityHeader></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SignInReadOnlyResponse xmlns="http://AutodeskDM/Services/Security/1/20/2011/"/></s:Body></s:Envelope>

Ответ сервера: 

Код - HTML: [Выделить]
  1. POST http://localhost/AutodeskDM/Services/AdminService.asmx HTTP/1.1
  2. User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.2034)
  3. Content-Type: text/xml; charset=utf-8
  4. SOAPAction: "http://AutodeskDM/Services/AdminService/1/20/2011/GetAllGroups"
  5. Host: localhost
  6. Content-Length: 1324
  7. Expect: 100-continue
  8.  
  9. <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><soap:Header><SecurityHeader xmlns="http://AutodeskDM/Services/AdminService/1/20/2011/"><UserId>2</UserId><Ticket>aeffa132-95a0-431a-ab76-df3ba4fb5d5b</Ticket></SecurityHeader><wsa:Action>http://AutodeskDM/Services/AdminService/1/20/2011/GetAllGroups</wsa:Action><wsa:MessageID>urn:uuid:68a7c614-f589-4551-bfde-095b0b20ed92</wsa:MessageID><wsa:ReplyTo><wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address></wsa:ReplyTo><wsa:To>http://localhost/AutodeskDM/Services/AdminService.asmx</wsa:To><wsse:Security><wsu:Timestamp wsu:Id="Timestamp-0d71fe47-3863-480f-8541-f0174ee2c37e"><wsu:Created>2014-02-22T23:22:56Z</wsu:Created><wsu:Expires>2014-02-22T23:27:56Z</wsu:Expires></wsu:Timestamp></wsse:Security></soap:Header><soap:Body><GetAllGroups xmlns="http://AutodeskDM/Services/AdminService/1/20/2011/" /></soap:Body></soap:Envelope>
  10. HTTP/1.1 200 OK
  11. Cache-Control: private
  12. Content-Length: 499
  13. Content-Type: text/xml; charset=utf-8
  14. Server: Microsoft-IIS/7.5
  15. X-AspNet-Version: 4.0.30319
  16. X-Powered-By: ASP.NET
  17. Date: Sat, 22 Feb 2014 23:22:30 GMT
  18.  
  19. <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetAllGroupsResponse xmlns="http://AutodeskDM/Services/AdminService/1/20/2011/"><GetAllGroupsResult><Group Id="1" Name="Все пользователи" EmailDL="" CreateUserId="0" CreateDate="2013-11-28T14:29:14.657" IsActive="true" IsSys="true" Auth="Vault"/></GetAllGroupsResult></GetAllGroupsResponse></s:Body></s:Envelope>

Автор: Дмитрий Емельянов
Автор перевода: Дмитрий Емельянов

Обсуждение: http://adn-cis.org/forum/index.php?topic=644

Опубликовано 12.03.2014
Отредактировано 06.08.2014 в 15:07:26