Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Web Services
Objectives
• WebServices
Microsoft 2
Web services?
“Web services are web apps that return data, not presentation. Since
applications are typically about accessing data, web services are
poised to become the next evolutionary step in distributed
software development...”
• Why?
– cross-platform application development
– legacy system integration
obj obj
XML obj
obj
Web server
Microsoft 3
Overview
web service
WSDL
client app obj
obj
method obj
method call
call
.asmx
proxy
Web server
SOAP msg
(XML)
HTTP request
Microsoft 4
Example
Microsoft 5
Google web service
Microsoft 6
Working with web services
• Two steps:
1. build a web service
2. build clients to use it
Microsoft 7
(1) Building a web service
Microsoft 8
A web service is…
Microsoft 9
Example
[WebMethod]
public string[] Attendees()
{
<<open DB, read attendees into array, return it>>
}
}
Microsoft 10
(2) Building a client
Microsoft 11
Reference the component
• How?
– project references, right-click, Add web reference…
– type URL for web service, e.g.
• http://localhost/WebService/Service1.asmx
i = CInt(TextBox1.Text)
j = CInt(TextBox2.Text)
Microsoft 13
Underlying execution…
web service
client app
obj
<n1>10</n1>
<n2>20</n2>
</Add>
HTTP request: Service1.asmx
Microsoft 14
Summary
Microsoft 15
References
• Books:
– Y. Shohoud, "Real World XML Web Services: for .NET and VB
.NET Developers"
• Web sites:
– http://msdn.microsoft.com/webservices
Microsoft 16
Lab?
Microsoft 17