Версия для печати темы (https://pro1c.org.ua/index.php?s=6fd2439e5da46dec35b1f371bb41d446&showtopic=37113)

Нажмите сюда для просмотра этой темы в обычном формате

Украинский 1С форум: всё про 1С 8.3, 1С 8.2, 1С 8.1, 1С 8.0, 1С 7.7 _ Мобильная платформа 1С _ Обработка запроса oData

Автор: root123456 14.05.17, 14:03

Есть две базы(мобильный клиент и рабочая). С одной базы посылается HTTP запрос(пост) на другую базу. Есть ли способ обработать полученный запрос на базе приемника? На данный момент оно просто создает документ в базе.

Код

src = "/" + Constants.dbn.Get() + "/odata/standard.odata/Document_test1";
    Object = Ref.GetObject();
    
    QueryText = "<?xml version="+Char(34)+"1.0"+Char(34)+" encoding="+Char(34)+"UTF-8"+Char(34)+"?><feed xmlns="+Char(34)+"http://www.w3.org/2005/Atom"+Char(34)+"
    |    xmlns:at="+Char(34)+"http://purl.org/atompub/tombstones/1.0"+Char(34)+"
    |    xmlns:d="+Char(34)+"http://schemas.microsoft.com/ado/2007/08/dataservices"+Char(34)+"
    |    xmlns:m="+Char(34)+"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"+Char(34)+"
    |    xml:base="+Char(34)+Constants.srv.Get()+"/"+Constants.dbn.Get()+"/odata/standard.odata/"+Char(34)+">
    |<entry>
    |    <id>"+Constants.srv.Get()+"/"+Constants.dbn.Get()+"/odata/standard.odata/Document_test1(guid'00000000-0000-0000-0000-000000000000')</id>
    |    <category term="+Char(34)+"StandardODATA.Document_test1"+Char(34)+"
    |            scheme="+Char(34)+"http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"+Char(34)+"/>
    |    <title type="+Char(34)+"text"+Char(34)+"/>
    |    <updated>"+Format(CurrentDate(), "L=pl; DF=yyyy-MM-ddTHH:mm:ss")+"</updated>
    |    <author/>
    |    <summary/>
    |    <link rel="+Char(34)+"edit"+Char(34)+"
    |            href="+Char(34)+"Document_test1(guid'00000000-0000-0000-0000-000000000000')"+Char(34)+"
    |            title="+Char(34)+"edit-link"+Char(34)+"/>
    |    <content type="+Char(34)+"application/xml"+Char(34)+"><m:properties xmlns:d="+Char(34)+"http://schemas.microsoft.com/ado/2007/08/dataservices"+Char(34)+" xmlns:m="+Char(34)+"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"+Char(34)+">
    |        <d:Ref_Key>00000000-0000-0000-0000-000000000000</d:Ref_Key>
    |        <d:DataVersion>"+Object.DataVersion+"</d:DataVersion>
    |        <d:DeletionMark>"+?(Object.DeletionMark,"true", "false")+"</d:DeletionMark>
    |        <d:Number>"+Object.Number+"</d:Number>
    |        <d:Date>"+Format(Object.Date, "L=pl; DF=yyyy-MM-ddTHH:mm:ss")+"</d:Date>
    |        <d:Posted>"+?(Object.Posted,"true", "false")+"</d:Posted>
    |        <d:name>"+Object.name+"</d:name>
    |        <d:count>"+Format(Object.count, "NG=0")+"</d:count>
    |</m:properties>
    |</content>
    |    </entry>
    |</feed>";
    
    
    Connect = New HTTPConnection(Constants.srv.Get(),,,,,,New OpenSSLSecureConnection( Undefined, Undefined ));
    
    HTTPHeader = New Map();
    Query = New HTTPRequest(src, HTTPHeader);
    Query.SetBodyFromString(QueryText);
    RequestC = Connect.Post(Query);
    Request = RequestC.GetBodyAsString("UTF-8");
    
    Connect = Undefined;


 ! 

http://pro1c.org.ua/index.php?act=announce&id=2: 9
 

Автор: logist 14.05.17, 14:24

Цитата(root123456 @ 14.05.17, 15:03) *
Есть ли способ обработать полученный запрос на базе приемника?

Если на приемнике есть обработчик который выполняется при получении данных - то да, встраиваетесь в него, парсите ответ (вероятно используя Десериализовать())

Украинский 1С форум: всё про 1С 8.3, 1С 8.2, 1С 8.1, 1С 8.0, 1С 7.7
https://pro1c.org.ua