Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 7: Creating and Consuming XML Web Services Understanding XML Web Services Creating XML Web Services Deploying and Discovering XML Web Services.

Similar presentations


Presentation on theme: "Chapter 7: Creating and Consuming XML Web Services Understanding XML Web Services Creating XML Web Services Deploying and Discovering XML Web Services."— Presentation transcript:

1 Chapter 7: Creating and Consuming XML Web Services Understanding XML Web Services Creating XML Web Services Deploying and Discovering XML Web Services Consuming an XML Web Service

2 © Slide 2 Understanding XML Web Services  Overview of XML Web Services  XML Web Services Infrastructure  Communication Between the Client and the XML Web Service

3 © Slide 3 Overview of XML Web Services  XML Web service is a component.  Using standard protocols, such as HTTP, XML, and SOAP, to access the functionality.  XML Web services use XML-based messaging to send and receive data.  Aplication independent with platforms.

4 © Slide 4 XML Web Services Infrastructure  XML Web services directories  XML Web services discovery  XML Web services description  XML Web service wire formats

5 © Slide 5 Communication Between the Client and the XML Web Service

6 © Slide 6 Creating XML Web Services  Creating an XML Web Service

7 © Slide 7 Creating an XML Web Service Imports System Imports System.Web.Services Public Class ClassName Inherits WebService Public Function FunctionName() As Type Coding here End Function End Class

8 © Slide 8 Creating an XML Web Service(Cont)  You can write code direct into file XML Webservice or Codebehind  Code direct:  Code behind Note: Codebehind that mean coding are written into file *.asmx.vb

9 © Slide 9 Creating an XML Web Service(Cont) You must change: <System.Web.Services.WebService(Namespace:= "http://tempuri.org/ProjectName/ClassServiceName")> _ Public Class ClassServiceName Inherits System.Web.Services.WebService  Open file *.asmx -> Change Codebehind and Class properties  Extension file of XML Webservice is *.asmx

10 © Slide 10 Example 1  This case code are written into *.asmx file imports System imports System.Web.Services Public Class ClassWebServiceA inherits System.Web.Services.WebService Public Function GetSubject() As String() Dim ArrSubject(2) as String ArrSubject(0)="Design Web Page" ArrSubject(1)="XML Webservices" ArrSubject(2)="ASP.NET Developer" return ArrSubject End Function End Class

11 © Slide 11 Example 2  This case code are written into *.asmx.vb file imports System imports System.Web.Services <System.Web.Services.WebService (Namespace:="http://tempuri.org/PWebService/ ClassWebServiceB ")> Public Class ClassWebServiceB inherits System.Web.Services.WebService Public Function GetSubject() As String() Dim ArrSubject(2) as String ArrSubject(0)="Design Web Page" ArrSubject(1)="XML Webservices" ArrSubject(2)="ASP.NET Developer" return ArrSubject End Function End Class

12 © Slide 12 Deploying and Discovering XML Web Services  Publishing an XML Web Service  Items Published with a Web Service  Understanding the XML Web Services Discovery Mechanism.  Configuring Discovery Information for a Web Service

13 © Slide 13 Publishing an XML Web Service  We have two way deploy XML Webservice:  Setup Web XML WebService  Create by manual which is the same Website (Create Virtual Directory)

14 © Slide 14 Items Published with a Web Service  The Web application directory.  The.asmx file  The.disco file  The Web.config file  The \Bin directory

15 © Slide 15 Understanding the XML Web Services Discovery Mechanism The XML Web service discovery mechanism enables a client application to locate or discover the documents that describe an XML Web service. The XML Web service discovery mechanism returns a service description document to a client. The service description document is written in Web Services Description Language (WSDL) and contains information about the capabilities of an XML Web service, its location, and how to interact with it

16 © Slide 16 Consuming an XML Web Service  Consuming an XML Web Service  Adding a Web Reference  Generating a Proxy Class  Creating an Object of the Proxy Class  Accessing the Web Service Using a Proxy Object  Consuming the Methods Exposed by a Web Service

17 © Slide 17 Consuming an XML Web Service  Add a Web reference to the XML Web service in the client application by discovering the XML Web service that you want to consume.  Generate a proxy class for the XML Web service.  Create an object of the XML Web service proxy class in the client application.  Access the XML Web service by using a proxy object.

18 © Slide 18 Add a Web reference to the XML Web service in the client application

19 © Slide 19 WebServices on the Local Machine

20 © Slide 20 A method of XML WebService

21 © Slide 21 Generating a Proxy Class  Proxy Class is created when you press to Add reference button.  The proxy class of an XML Web service contains instructions for calling each XML Web service method.  Visual Studio.NET uses WSDL to create the proxy class.  The proxy class is described in the.wsdl file.

22 © Slide 22 Creating an Object of the Proxy Class  You need to include the proxy class namespace in your client application before you can create an object of the proxy class.  You create an object of the proxy class by using the new operator Dim objWS as new ServerName.ClassNameService Access to Method of XML Webservice objWS.MethodName()


Download ppt "Chapter 7: Creating and Consuming XML Web Services Understanding XML Web Services Creating XML Web Services Deploying and Discovering XML Web Services."

Similar presentations


Ads by Google