Basic SOAP/XML Procedure

A SOAP data source has a basic procedure that is the web service procedure where input parameters type is basic scalar or basic table.

Data can be transferred by XML-schema data types and each data type in the procedure is specified according to XML data type.

To develop a basic procedure, see the table with XML data types ad corresponding internal platform types:

XML data type Internal platform type
double double
integer text
long bigInt
byte bigInt
dateTime text
boolean bigInt
string text
hexBinary bytes
base64 bytes

Example

Consider the example of SOAP/XML web services based on 1C platform. The example uses the procedure that takes input parameters (two scalar parameters and two table parameters) 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 | Table JSON Service