4 accepting a web binding from a smartserver, Accepting a web binding from a smartserver -20, Accepting a web binding from a smartserver – Echelon i.LON SmartServer 2.0 User Manual
Page 342

i.LON SmartServer 2.0 Programmer’s Reference
20-20
SmartServer._iLON.InvokeCmd(itemCollInvoke)
' set the DP priority to 200 (see section 4.3.7 for more information)
DirectCast
(dataColl.Item(0), iLON_SmartServer.Dp_Data).UCPTpriority = 200
DirectCast
(dataColl.Item(0), iLON_SmartServer.Dp_Data).UCPTprioritySpecified =
True
' set 100.0 1 as the value
DirectCast
(dataColl.Item(0), iLON_SmartServer.Dp_Data).UCPTvalue =
New
iLON_SmartServer.E_LonString(0) {}
DirectCast
(dataColl.Item(0), iLON_SmartServer.Dp_Data).UCPTvalue(0) =
New
iLON_SmartServer.E_LonString()
DirectCast
(dataColl.Item(0), iLON_SmartServer.Dp_Data).UCPTvalue(0).Value =
"100.0 1"
' to write a preset, do this (see section 4.3.5.2 for more information)
' DirectCast(dataColl.Item(0), iLON_SmartServer.Dp_Data).UCPTvalue(0).LonFormat = "UCPTvalueDef"
' DirectCast(dataColl.Item(0), iLON_SmartServer.Dp_Data).UCPTvalue(0).Value = "ON"
' call the write function
Dim
writeResp
As
iLON_SmartServer.Item_Coll = SmartServer._iLON.Write(dataColl)
If
writeResp.Item
Is
Nothing
Then
' sanity check. this should not happen
Console.Out.WriteLine(
"No items were returned"
)
ElseIf
writeResp.Item(0).fault
IsNot
Nothing
Then
' error
Console.Out.WriteLine((
"An error occurred. Fault code = "
+
writeResp.Item(0).fault.faultcode.Value
+
". Fault text = %s."
) +
writeResp.Item(0).fault.faultstring)
Else
' success
Console.Out.WriteLine(
"Write is successful"
)
Console.Out.WriteLine((
DirectCast
(dataColl.Item(0), iLON_SmartServer.Dp_Data).UCPTname
&
" = "
) +
DirectCast
(dataColl.Item(0), iLON_SmartServer.Dp_Data).UCPTvalue(0).Value)
End
If
Console.ReadLine()
Finally
SmartServer.CloseBindingToSmartServer()
End Try
End
Sub
End
Module
20.4
Accepting a Web Binding From a SmartServer
To create a Web connection between the SmartServer and your Web server, you need to expose a Web
service on your server. This section describes how to do so with Microsoft Visual Studio 2008 and
.NET Framework 3.5. You need to configure IIS (Web server) on your computer so that it can serve
the Web service that you are going to write in the following section. This section assumes you are
familiar with IIS configuration and Web server administration.
Notes:
• In order for your .NET application to support Web connection file attachment, you must download
the Web Services Enhancements 2.0 Add-On from Microsoft’s Web site at
• If you are not running the .NET Framework 3.5, you can download the wsdl.exe file from
Microsoft’s Web site at
environment.
To create a Web Binding, follow these steps:
1. Create a proxy class with the wsdl.exe Web services description language tool. To do this follow
these steps: