beautypg.com

Datasets programming sample, Datasets programming sample -10, 4 datasets programming sample – Echelon i.LON 100 e2 Internet Server User Manual

Page 217

background image

A, the parent element, represents the DataSet Name. B represents the Table Name. This

must match the name of the child element below the element in the example SOAP
messages shown in Chapters 5-13 of this document. In this case, this must be

iLONDataServer, since the input string being generated by the DataSet will be passed to the
DataServerRead function.
Before making a SOAP call such as DataServerList using the above string, the parent

element A included in the DataSet must be removed, and the above message must be
reduced to:
<B>NVLB>

i.

LON 100 Internet Server Programmer’s Reference

Sample

As a result, the SOAP message generated by the application will include only a single parent
element: Data. The subroutine included in the following section, DataSets Programming

, removes the parent element from the string generated by the DataSet.

14.2.4

DataSets Programming Sample

The following SubRoutine utilizes ADO.NET DataSets to construct XML strings to be passed

to the DataServerRead function, and to retrieve data from the XML strings returned by the
function. The project containing this code must contain XML schemas for the

parameter you will supply to the function, and for the parameter the function will

return, as described in the previous section.

'Add an instance of the

i.

LON 100 WSDL file to the project.

'ILON100_Reference is the name assigned to the instance of the

'WSDL file in the Solution Explorer.

Dim

myWebReference

As

New

iLON100_Reference.iLON100()

'Create a DataSet defined by the XML Schema that has been added

'to this project. Note the use of the schema ID

'(DataServerList_Data_Element) here.

Dim

myDataSet_Data

As

New

DataServerList_Data_Element()

'Create a DataTable for the schema. This data added to this table

'will be used to create the XML string to be inserted into the

' parameter when DataServerRead is called, and the SOAP

'message is sent.

myDataTable_Data = myDataSet_Data.iLONDataServer

Dim

myDataRow_Data

As _

DataServerList_Data_Element.iLONDataServerRow

.UCPTdataPointType = "NVL"

.UCPTsetting = 0

Dim

myDataTable_Data

As _

DataServerList_Data_Element.iLONDataServerDataTable

'A DataTable is comprised of DataRows. When sending a SOAP

'message, one DataRow is used. When receiving SOAP messages, many

'DataRows may be used. Rows are used in cases where multiple

'objects of a type are present.

myDataRow_Data = myDataTable_Data.NewiLONDataServerRow

With

myDataRow_Data

14-10