Basic 1C Procedure

To work with 1C data source, the platform uses SOAP data transfer protocol. A basic procedure of 1C data source is a web service procedure where input parameter type is basic scalar or basic table. The basic table type is a flat table, and the basic scalar type is based on a simple 1C data type.

Data is sent by means of XML schema data types, and each data type in the procedure must be specified according to 1C data type.

To develop a basic procedure, there is a table with basic 1C types and corresponding internal platform types:

Basic scalar 1C type XML data type Internal platform type
Number double double
Number integer text
Number long bigInt
Number byte bigInt
Date dateTime text
Logical value boolean bigInt
Row string text
Binary data hexBinary bytes
Binary data base64 bytes

Example

The procedure that receives input parameters (two parameters of scalar type and two parameters of table type) and returns two tables.

Input table parameters:

The procedure returns two output tables:

Function SimpleTypesAndStructureNew(p1, p2, p3, p4)
   ReturnedValue = FactoryXDTO.Create(FactoryXDTO.Type("http://www.test-ws.org","SimpleTypesAndStructureNew"));
   
//ReturnedValue.p1 = p1;
   //ReturnedValue.p2 = p2;
   
For each PlanningPeriod From p3.PlanningPeriods Cycle
       ReturnedValue.p3.Add(PlanningPeriod);
   CycleEnd;
   For each Counterpart From p4.Counterpart Cycle
       ReturnedValue.p4.Add(Counterpart);
   CycleEnd;
   Return ReturnedValue;
FunctionEnd

The procedure takes input integer of the int type, that is the Count parameter, and returns a table with the number of rows specified in the input parameter:

Function GetPlanningPeriodsCount(Count)
   start = CurrentUniversalDateInMilliseconds();

   ReturnedValue = FactoryXDTO.Create(FactoryXDTO.Type("http://www.test-ws.org","PlanningPeriodsList"));
   XDTOElementType = FactoryXDTO.Type(
"http://www.test-ws.org""PlanningPeriodsElement");

   Request = New Request;
   Request.Text =
   
"SELECT FIRST 1
   | PlanningPeriods.Link,
   | PlanningPeriods.DeleteLabel,
   | PlanningPeriods.Code,
   | PlanningPeriods.Name,
   | PlanningPeriods.EvenSemecter,
   | PlanningPeriods.StartDate,
   | PlanningPeriods.EndDate,
   | PlanningPeriods.StartWeek,
   | PlanningPeriods.NumberWithPoint,
   | PlanningPeriods.Comment
   |FROM
   | Dictionary.PlanningPeriods AS PlanningPeriods"
;

   RequestResult = Request.Execute();
   If Not RequestResult.Empty() Then
       Sample = RequestResult.Select(); 
       Sample.Next();

       For Counter = 
1 To Count-1 Cycle
           XDTOElement = FactoryXDTO.Create(XDTOElementType);
           XDTOElement.UID = String(Sample.Link .UniqueIdentifier());
           XDTOElement.Code = String(Counter);
           XDTOElement.Name = Sample.Name;
           XDTOElement.DeleteLabel = Sample.DeleteLabel;
           XDTOEelement.EvenSemester = Sample.EvenSemester;
           XDTOElement.StartDate = Sample.StartDate;
           XDTOElement.EndDate = Sample.EndDate;
           XDTOElement.StartWeek = Sample.StartWeek;
           XDTOElement.NumberWithPoint = Sample.NumberWithPoint;
           XDTOElement.Comment = Sample.Comment;

           ReturnedValue.PlanningPeriods.Add(XDTOElement);
       CycleEnd;

       XDTOElement = FactoryXDTO.Create(XDTOElementType);

       XDTOElement.UID = String(Sample.Link.UniqueIdentifier());
       XDTOElement.Code = String(Counter);
       XDTOElement.Name = Sample.Name;
       XDTOElement.DeleteLabel = Sample.DeleteLabel;
       XDTOElement.EvenSemester = Sample.EvenSemester;
       XDTOElement.StartDate = Sample.StartDate;
       XDTOElement.EndDate = Sample.EndDate;
       XDTOElement.StartWeek = Sample.StartWeek;
       XDTOElement.NumberWithPoint = CurrentUniversalDateInMilliseconds() - start;
       XDTOElement.Comment = Sample.Comment;

       ReturnedValue.PlanningPeriods.Add(XDTOElement);
   EndIf;
   Return ReturnedValue;
FunctionEnd

See also:

Setting Up Integration with Table Data Sources | Basic Oracle Procedure