ZiBaT
=> Peter Levinsky
=> Programming => exercise |
SOAP |
Updated : 2016-09-26
|
To design and implement your own SOAP service using databases for persistence.
This is a refactoring of SOAP-service 3 to use database as persistence for storing sensor information.
The exercise Create you own SOAP-service part3
In your SQL object browser create a new database e.g. 'SensorDB'.
Create a table to hold Sensor Data i.e. (light, temperature, timestamp).
Add some data rows (i.e right click on table and pick view data, then you can add data)
Get the connectionstring i.e. right click on database pick properties pick connection-string
To retrieve and store data from and to the database you can use ADO.Net and SQL statements OR use the buildt in entity framework.
Which one you choose is up to you :-)
If you using ado.net it see https://msdn.microsoft.com/en-us/library/dw70f090(v=vs.110).aspx
Brief:
if you are using Enitity framework see https://www.tutorialspoint.com/entity_framework/entity_database_first_approach.htm
Brief:
You can use other posibilities like Linq, ...
The two types:
StoreData : e.g. db.SensorDatas.Add( << the object >>) -- perhaps you need to convert the incomming object to the DB-object
GetData : e.g. db.SensorDatas -- this is the list of data - again perhaps you need to convert the DB-object to the outgoing object
Make a console application that retrieves UDP-datagrams and forward these to the SOAP.
You need to be at the EGV-DMU2 network !!!!
The UDP broadcast are to port 7080
The format islight: 45
temp: 20
timestamp: YYYY-MM-DD-hh-mm-ss