beautypg.com

Echelon i.LON SmartServer 2.0 User Manual

Page 345

background image

i.LON SmartServer 2.0 Programmer’s Reference

20-23

7. Write the code for web service. You can simply copy and paste the following code snippet into

the public class Service1 : System.Web.Services.WebService.

using

System;

using

System

.

Collections;

using

System

.

ComponentModel;

using

System

.

Data;

using

System

.

Linq;

using

System

.

Web;

using

System

.

Web

.

Services;

using

System

.

Web

.

Services

.

Protocols;

using

System

.

Xml

.

Linq;

using

iLon100e4;

using

Microsoft

.

Web

.

Services2;

namespace

WebBinder

{

///

///

Summary description for Service1

///

[

WebService

(Namespace

=

"http://tempuri.org/")]

[

WebServiceBinding

(ConformsTo

=

WsiProfiles

.

BasicProfile1_1)]

[

ToolboxItem

(

false

)]

// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the

//following line:

// [System.Web.Script.Services.ScriptService]


public

class

Service1

: System

.

Web

.

Services

.

WebService

,

IILON100soap11Binding

{

private

messageProperties

_messagePropertiesValue

=

null

;

public

messageProperties

messagePropertiesValue {

get

;

set

;

}


///

public

Item_Coll

List(

E_xSelect

iLonItem) {

return

null

;

}

///

public

Item_CfgColl

Get(

Item_Coll

iLonItem) {

return

null

;

}

///

public

Item_Coll

Set(

Item_CfgColl

iLonItem) {

return

null

;

}

///

public

void

Delete(

ref

Item_Coll

iLonItem) {

}

///

public

Item_DataColl

Read(

Item_Coll

iLonItem) {

return

null

;

}

///

public

Item_Coll

Write(

Item_DataColl

iLonItem) {

System

.

Diagnostics

.

Trace

.

WriteLine("Got message from : "

+

messagePropertiesValue

.

UCPTipAddress);

#region

just for debugging, not needed as system throws exceptions anyway

// are the expected object existing ?

if

((

null

==

iLonItem)

||

(

null

==

iLonItem

.

Item[

0

])) {

System

.

Diagnostics

.

Trace

.

WriteLine("ERROR, Null object");

throw

new

System

.

NullReferenceException

();

}

#endregion