Netduino Plus as web service server - General Discussion - Netduino Forums
   
Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Netduino Plus as web service server


  • Please log in to reply
8 replies to this topic

#1 Old Hack

Old Hack

    New Member

  • Members
  • Pip
  • 6 posts

Posted 21 November 2012 - 05:38 PM

Hello all, I have a Netduino Plus (probably pick me up a Plus 2 now :D) and want to know how I can have it use the Ethernet to respond to a web service call from another host computer. Basically I am wanting to control calling a method which will pass data into several shift registers which are daisy-chained to light LEDs. I thought about using a web page type example and then looking at the query string to figure out which LEDs should be on but it seems that a real web service might be a better (possibly more secure?) way to go. Any examples or thoughts are appreciated.

#2 Cuno

Cuno

    Advanced Member

  • Members
  • PipPipPip
  • 144 posts
  • LocationZürich / Switzerland

Posted 21 November 2012 - 06:54 PM

Hello all,

I have a Netduino Plus (probably pick me up a Plus 2 now :D) and want to know how I can have it use the Ethernet to respond to a web service call from another host computer. Basically I am wanting to control calling a method which will pass data into several shift registers which are daisy-chained to light LEDs. I thought about using a web page type example and then looking at the query string to figure out which LEDs should be on but it seems that a real web service might be a better (possibly more secure?) way to go. Any examples or thoughts are appreciated.

I'd recommend my book, but admittedly I'm a bit partial :D

http://www.amazon.co...s/dp/1449393578

I am waiting for my Netduino Plus 2 so that I can test the examples there as well, with NETMF 4.2.

Cuno

#3 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 21 November 2012 - 07:21 PM

I'd recommend my book, but admittedly I'm a bit partial :D

http://www.amazon.co...s/dp/1449393578

Ohh it's a good book, I vouch for that!
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#4 John Murdoch

John Murdoch

    New Member

  • Members
  • Pip
  • 1 posts

Posted 21 November 2012 - 07:26 PM

Cuno,

I've followed your link to Amazon.com, but don't see a specific answer to the original question--can the Netduino Plus 2 be used to expose a web service?

I'm curious about this as well--in my case I'm not lighting LEDs, I'm simply storing data. What I'm out to do is to create a simple data logger, based on the Netduino Plus 2, that exposes two web service methods. These mimic the web service interfaces exposed by our cloud data center--the data logger will enable us to support temporary field installations of digital energy meters, and record the meter data for replay at a later date.

(Background: we make digital energy meters, which typically report energy consumption over an IP network. In some circumstances clients want to meter energy consumption in places [construction sites, temporary mining or drilling sites, etc.] where Internet connectivity is impractical, and the weight, bulk, and cost of a PC make the project impractical. A Netduino Plus, an Ethernet cable, and a couple of pieces of Velcro to place the logger in our enclosure would do the trick perfectly.)

I have seen the "Embedded Netduino-Compatible Web Server" project on Codeplex--I'm a bit concerned about the explicit warning against HTTPRequest headers larger than 1K, but don't think that will be a problem. Do you discuss this web server (or another) in your book?

Thanks for your help.



I'd recommend my book, but admittedly I'm a bit partial :D

http://www.amazon.co...s/dp/1449393578

I am waiting for my Netduino Plus 2 so that I can test the examples there as well, with NETMF 4.2.

Cuno



#5 Paul Newton

Paul Newton

    Advanced Member

  • Members
  • PipPipPip
  • 724 posts
  • LocationBerkshire, UK

Posted 21 November 2012 - 07:38 PM

I'd recommend my book, but admittedly I'm a bit partial :D

http://www.amazon.co...s/dp/1449393578

I am waiting for my Netduino Plus 2 so that I can test the examples there as well, with NETMF 4.2.

Cuno


That's the book that got me started on the Netduino!

I have not used Pachube since I folllowed your examples. I know there have been some changes to Pachube since then. Is the book still OK for a complete internet novice (as I was)?

Paul

#6 NeonMika / Markus VV.

NeonMika / Markus VV.

    Advanced Member

  • Members
  • PipPipPip
  • 209 posts
  • LocationUpper Austria

Posted 22 November 2012 - 06:49 AM

You can totally do that! Just create a socket on your Netduino listening for HTTP Inputs and parse them. Check out the URL and the parameters and handle them the way you want them. Probably you want to have a look at my webserver, it does this things. If you want to use it, you just have to write on method per webservice and add the with one line of code to the webserver. If you have some questions, I'm happy to help. Greets. Markus

NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and d
own - and upload files

 

If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype :)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------


#7 Cuno

Cuno

    Advanced Member

  • Members
  • PipPipPip
  • 144 posts
  • LocationZürich / Switzerland

Posted 22 November 2012 - 09:28 AM

can the Netduino Plus 2 be used to expose a web service?

Yes, definitely. The book has three parts, the third part is about exposing simple RESTful Web services on a Netduino Plus. (No DPWS or similarly heavy-weight Web services though.)

Originally I tried developing the book examples with Microsoft's HTTP classes, but they used up too much RAM and Flash for the NP, so I wrote my own simple Web server for the book. Even there I came uncomfortably close to the NP's memory limits. With the additional 64 KB of RAM on an NP2, this will be far less of an issue. Hope that it will arrive any day now...

Do you need to access devices behind a firewall? If so, the book shows a robust way without the hassles of port forwarding or similar schemes.

#8 Cuno

Cuno

    Advanced Member

  • Members
  • PipPipPip
  • 144 posts
  • LocationZürich / Switzerland

Posted 22 November 2012 - 09:31 AM

I have not used Pachube since I folllowed your examples. I know there have been some changes to Pachube since then. Is the book still OK for a complete internet novice (as I was)?

Pachube has been sold and is now called Cosm. The REST API has changed somewhat, but not much (http://www.gsiot.inf...achube-to-cosm/).

I will test everything again, including the modifications in Part I for NETMF 4.2, when I get my Netduino Plus 2.

#9 Old Hack

Old Hack

    New Member

  • Members
  • Pip
  • 6 posts

Posted 25 November 2012 - 05:16 PM

Thanks everyone for the advise! I will check into website (Markus) and the book (Cuno).




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.