Dave Elliman - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

Dave Elliman

Description:

This means there are tools available to produce proxies ... Could have been Silverlight. Important Lessons. A Web Service leaves the choice of client open ... – PowerPoint PPT presentation

Number of Views:52
Avg rating:3.0/5.0
Slides: 9
Provided by: daveel1
Category:

less

Transcript and Presenter's Notes

Title: Dave Elliman


1
A Web Service Client
  • Dave Elliman

2
Web services
  • Describe themselves using WSDL
  • XML Web Service Description Language
  • This means there are tools available to produce
    proxies/skeletons/stubs
  • For .net we have the command wsdl
  • For Java (in JEE) there is wsdl2java

3
For example
  • http//www.xmlme.com/WSShakespeare.asmx
  • Add ?wsdl to see the xml definition
  • Add ?wsdl to see the xml definition
  • We can build a client to access this
  • wsdl http//www.xmlme.com/WSShakespeare.asmx?wsdl
  • This produced a C file Shakespeare.cs which
    contains everything needed to access the web
    service
  • I then created a C console application in VS2005

4
Hello World
using System using System.Collections.Generic us
ing System.Text namespace speare class
Program static void Main(string
args) Console.Out.WriteLine(
"Hello World")
5
To include the proxy
  • I added Shakespeare.cs to the project
  • I needed to add a reference System.Web.Services

6
I called the proxy methods
using System using System.Collections.Generic us
ing System.Text class Program static
void Main(string args) String
phrase, speech Shakespeare
shakespeare new Shakespeare() for
( ) phrase
Console.ReadLine() if
(phrase.Equals("quit")) break
String result shakespeare.GetSpeech(phrase)
Console.Out.WriteLine(result)

7
Reflections on that
  • It was very easy!
  • It was a synchronous method call (RPC)
  • In fact it used xml/SOAP
  • It was not especially fast in execution
  • The client was arbitrary
  • Could have been in a web page (ASP.NET)
  • Could have been Windows Forms
  • Could have been WPF
  • Could have been Silverlight

8
Important Lessons
  • A Web Service leaves the choice of client open
  • Code to connect is easily generated by tools
  • Could have used Java tools and JavaFX / Swing as
    easily as .Net clients
Write a Comment
User Comments (0)
About PowerShow.com