Interfacing Hardware with Web Services - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Interfacing Hardware with Web Services

Description:

Free open-source Java SOAP framework. StAX based (Streaming API for XML) ... POJO. services.xml. web.xml. POJO Service. TempService. public TempService ... – PowerPoint PPT presentation

Number of Views:246
Avg rating:3.0/5.0
Slides: 14
Provided by: harpoo
Category:

less

Transcript and Presenter's Notes

Title: Interfacing Hardware with Web Services


1
Interfacing Hardware with Web Services
  • Jason Wambach
  • 2006 Harpoon Technologies

2
XFire
  • Free open-source Java SOAP framework
  • StAX based (Streaming API for XML)
  • Extremely simple
  • Still very new (1.0-RC1)
  • xfire.codehaus.org

3
Exposing a Service
  • POJO
  • services.xml
  • web.xml

4
POJO Service
  • TempService

public TempService() public String
readTemp() if (tempStr ! null)
return tempStr else return
"Error"
5
services.xml
  • META-INF Folder of Classpath!

ltbeans xmlns"http//xfire.codehaus.org/config/1.0
"gt ltservicegt ltnamegtTempServicelt/namegt
ltnamespacegthttp//vodkatonic.org/TempServicelt/name
spacegt ltserviceClassgtorg.vodkatonic.webservice
.TempServicelt/serviceClassgt lt/servicegt lt/beansgt
6
web.xml
lt?xml version"1.0" encoding"UTF-8"?gt ltweb-app
version"2.4" xmlns"http//java.sun.com/xml/ns/j2
ee" xmlnsxsi"http//www.w3.org/2001/XMLSchema-
instance" xsischemaLocation"http//java.sun.co
m/xml/ns/j2ee http//java.sun.com/xml/ns/j2ee/we
b-app_2_4.xsd"gt ltservletgt
ltservlet-namegtXFireServletlt/servlet-namegt
ltdisplay-namegtXFire Servletlt/display-namegt
ltservlet-classgt org.codehaus.xfire.transpo
rt.http.XFireConfigurableServlet
lt/servlet-classgt lt/servletgt
ltservlet-mappinggt ltservlet-namegtXFireServletlt/
servlet-namegt lturl-patterngt/servlet/XFireServl
et/lt/url-patterngt lt/servlet-mappinggt
ltservlet-mappinggt ltservlet-namegtXFireServletlt/
servlet-namegt lturl-patterngt/services/lt/url-pa
tterngt lt/servlet-mappinggt lt/web-appgt
7
Client
public interface TempService public String
readTemp()
XFire xfire XFireFactory.newInstance().getXFire(
) XFireProxyFactory factory new
XFireProxyFactory(xfire) Service serviceModel
new ObjectServiceFactory().create(TempService.cl
ass) TempService service (TempService)
factory.create(serviceModel,
http//192.168.1.708080/temp/services/TempServic
e") System.out.println(service.readTemp())
Thats all!
8
Even easier client
Client client new Client(new URL("http//vodkato
nic.org/xfire/services/TempService?wsdl")) Object
response client.invoke(readTemp", new
Object ) String temp (String) response0
  • No interface required
  • Very much a WIP

9
Glossed over details
  • Fixed bug with HTTP Proxies
  • Using RXTX libs for serial comm.
  • rxtx.org
  • Java Comm package no longer supported on Windows
    by Sun.
  • Bug introduced, EOL windows port instead of
    fixing it.
  • No longer needed
  • Use USB (Java 1.6?)

10
Glossed over (hardware)
  • AVR Atmega8 microcontroller
  • Hardware U(S)ART
  • 10 bit ADC
  • Firmware written in C (AVR-GCC)
  • Power stolen from serial port

11
Schematic
12
Screenshot
13
Resources
  • xfire.codehaus.org
  • rxtx.org
  • atmel.com
  • avrfreaks.net
  • vps.harpoontech.com/blog
Write a Comment
User Comments (0)
About PowerShow.com