Consuming and Creating XML Web Services
Consuming and Creating XML Web Services
The weather
Forecast calls for:
Rain
Internet Exchange Rate
The exchange rate is: $1.56 XML Web Service
11
2. Select an XML
Web service
method
22
4. View the XML
response
33
44
Lesson: Calling an XML Web Service by Using a
Proxy
• What Is a Proxy?
Web
Form Internet XML Web
Service
SOAP
Proxy
Steps for Calling an XML Web Service
1.
11 Create a Web reference for the XML Web Service
2.
22 Create an instance of the XML Web Service
3.
33 Call the Web methods of the XML Web Service
4.
44 Build the ASP.NET Web Application
C# Code Example
XML Web Service Error Handling
• Service unavailable
•
1
1
Create a new XML Web Service project in
Visual Studio 2008
•
2
2 Declare the WebMethod functions
•
3
33 Build the XML Web Service project
•
4
4
Test with
a browser
XML Web Service Code
• .asmx page
Imports System
Imports System.Web.Services
Class Service1
<WebMethod()> Public Function function1() As type
'function_here
End Function
End Class
C# Code Example
Consuming and Creating XML Web Services
• Exercise 1: Create the Dentist XML Web Service and the
GetAllDentists XML Web Service Method
• Exercise 2: Create the GetDentistsByPostalCode XML Web
Service Method
• Exercise 3: Consume the GetAllDentists XML Web Service
Method
• Exercise 4: Consume the GetDentistsByPostalCode XML
Web Service Method
Logon information
Logon Page
Login.aspx
Benefits
Coho Home Page Page Header ASPState
Winery Default.aspx Header.ascx
Menu
Registration Component
Register.aspx Class1.vb or Class1.cs Web.
tempdb
config
XML
Doctors Dentists
Files
Lab Review
Module Review and Takeaways
Review Questions
• Does an XML Web Service have a user interface?