Creating and Using Web ServicesObjectivesIn this lesson, you will learn to:Identify the need for Web servicesIdentify the ...
Creating and Using Web ServicesWeb Service Is similar to a component that provides a specific  functionality. Exposes a nu...
Creating and Using Web ServicesWeb Service (Contd.)Can be of different types:    One that provides a fundamental functiona...
Creating and Using Web ServicesEnabling Technologies Used in Web Services A Web service can be developed by using any  pro...
Creating and Using Web ServicesEnabling Technologies Used in Web Services(Contd.)Requirements are fulfilled by using vario...
Creating and Using Web ServicesEnabling Technologies Used in Web Services(Contd.)    Universal Description Discovery and I...
Creating and Using Web ServicesJust a Minute…What is the difference between a Web service and acomponent?   ©NIIT         ...
Creating and Using Web ServicesProblem Statement 15.D.1The Call Center application needs to provide a facility forvarious ...
Creating and Using Web ServicesTask ListIdentify a mechanism for writing reusable code.Identify the methods to be exposed ...
Creating and Using Web ServicesTask 1: Identify a mechanism for writing reusablecode.Result:A Web service allows applicati...
Creating and Using Web ServicesTask 2: Identify the methods to be exposed toapplications.Result:In the given scenario, you...
Creating and Using Web ServicesTask 3: Create a Web service project.Task 4: Create the methods to be exposed toapplication...
Creating and Using Web Services    The code-behind file imports the     System.Web.Services namespace, which contains     ...
Creating and Using Web ServicesTask 5: Execute the application.  ©NIIT           Creating and Using Web Services/Lesson 15...
Creating and Using Web ServicesProblem Statement 15.D.2A form needs to be designed in the Call Center application todispla...
Creating and Using Web ServicesTask ListIdentify the data to be displayed.Design the user interface.Write the code to disp...
Creating and Using Web ServicesTask 1: Identify the data to be displayed.Result:The data to be displayed includes:     Que...
Creating and Using Web ServicesTask 2: Design the user interface.Task 3: Write the code to display data by using thefuncti...
Creating and Using Web ServicesTask 4: Execute the application.  ©NIIT           Creating and Using Web Services/Lesson 15...
Creating and Using Web ServicesJust a Minute…2. How can you locate the Web services developed by a Web   service provider?...
Creating and Using Web ServicesASP.NETIs a powerful programming framework for the development of enterprise-class Web appl...
Creating and Using Web ServicesElements of ASP.NETUser interface - For accepting input and displaying text to a user in an...
Creating and Using Web ServicesWeb Form Allows you to create programmable Web pages that serve  as a user interface for yo...
Creating and Using Web ServicesSummaryIn this lesson, you learned that:A Web service exposes functionality that can be use...
Creating and Using Web ServicesSummary (Contd.)Web services use eXtensible Markup Language forinterchanging data in a stan...
Creating and Using Web ServicesSummary (Contd.)The Universal Description Discovery and Integration (UDDI)       initiative...
Creating and Using Web ServicesSummary (Contd.)In order to be able to access the functionality exposed by a       Web serv...
Creating and Using Web ServicesSummary (Contd.) The Web applications developed using Visual Studio.NET       are built on ...
Upcoming SlideShare
Loading in …5
×

Vb net xp_15

331 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
331
On SlideShare
0
From Embeds
0
Number of Embeds
14
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Vb net xp_15

  1. 1. Creating and Using Web ServicesObjectivesIn this lesson, you will learn to:Identify the need for Web servicesIdentify the enabling technologies in Web servicesCreate a Web serviceUse a Web service in a Visual Basic .NET local applicationUse a Web service in a Web application ©NIIT Creating and Using Web Services/Lesson 15/Slide 1 of 28
  2. 2. Creating and Using Web ServicesWeb Service Is similar to a component that provides a specific functionality. Exposes a number of methods that provide functionality that can be used by one or more applications, regardless of the programming languages, operating systems, and hardware platforms used to develop them. Functionality can be accessed by applications by using Internet standards, such as HTTP and XML. ©NIIT Creating and Using Web Services/Lesson 15/Slide 2 of 28
  3. 3. Creating and Using Web ServicesWeb Service (Contd.)Can be of different types: One that provides a fundamental functionality, which can be used in multiple applications. Second that can integrate the existing applications that might have been created using different software and hardware platforms. Third that can be a means to exchange data in business-to-business transactions. ©NIIT Creating and Using Web Services/Lesson 15/Slide 3 of 28
  4. 4. Creating and Using Web ServicesEnabling Technologies Used in Web Services A Web service can be developed by using any programming language in .NET suite. However, it requires: A common data representation format in order to ensure the interoperability of the data exchanged by the client application and the Web service. A standard method for sending messages from the client application to the Web service and vice versa. A standard format for describing the Web service. A mechanism to allow client applications to discover the Web services and their locations. ©NIIT Creating and Using Web Services/Lesson 15/Slide 4 of 28
  5. 5. Creating and Using Web ServicesEnabling Technologies Used in Web Services(Contd.)Requirements are fulfilled by using various standardssuch as: eXtensible Markup Language (XML) - Allows data interchange regardless of the hardware and software platform used to develop the application. Simple Object Access Protocol (SOAP) - Is a standard communication protocol for interchanging information in a structured format in a distributed environment. Web Services Description Language (WSDL) – Is an XML vocabulary that describes the methods that are exposed by a Web service. ©NIIT Creating and Using Web Services/Lesson 15/Slide 5 of 28
  6. 6. Creating and Using Web ServicesEnabling Technologies Used in Web Services(Contd.) Universal Description Discovery and Integration (UDDI) - Is used as a standard mechanism to register and discover a Web service provided by various Web service providers. ©NIIT Creating and Using Web Services/Lesson 15/Slide 6 of 28
  7. 7. Creating and Using Web ServicesJust a Minute…What is the difference between a Web service and acomponent? ©NIIT Creating and Using Web Services/Lesson 15/Slide 7 of 28
  8. 8. Creating and Using Web ServicesProblem Statement 15.D.1The Call Center application needs to provide a facility forvarious departments to view the status of the queries receivedfrom various customers. The organization also plans toprovide a facility to its customers to find out the status of theirqueries through a Web site. For this, a reusable code needs tobe written so that both local and Web applications can accessthe details about queries. ©NIIT Creating and Using Web Services/Lesson 15/Slide 8 of 28
  9. 9. Creating and Using Web ServicesTask ListIdentify a mechanism for writing reusable code.Identify the methods to be exposed to applications.Create a Web service project.Create the methods to be exposed to applications.Execute the application. ©NIIT Creating and Using Web Services/Lesson 15/Slide 9 of 28
  10. 10. Creating and Using Web ServicesTask 1: Identify a mechanism for writing reusablecode.Result:A Web service allows applications to transfer data by using standard protocols and data formats. Therefore, in the given scenario, you can create a Web service that exposes aWeb method to access query details. ©NIIT Creating and Using Web Services/Lesson 15/Slide 10 of 28
  11. 11. Creating and Using Web ServicesTask 2: Identify the methods to be exposed toapplications.Result:In the given scenario, you need to create a Web service and expose a Web method that takes a query ID as aparameter. The Web method should retrieve the detailsabout the query and populate a DataSet object with thequery details. This DataSet object should be returned to theclient application that uses the Web service. ©NIIT Creating and Using Web Services/Lesson 15/Slide 11 of 28
  12. 12. Creating and Using Web ServicesTask 3: Create a Web service project.Task 4: Create the methods to be exposed toapplications.Code model for Web services A Web service is composed of two parts, the Web service entry point and the code that provides the functionality to be used by other applications. The .asmx file serves as the entry point for the Web service. The .asmx file accesses the code from precompiled assemblies and the code-behind (.vb) file corresponding to the Web service. ©NIIT Creating and Using Web Services/Lesson 15/Slide 12 of 28
  13. 13. Creating and Using Web Services The code-behind file imports the System.Web.Services namespace, which contains the classes that are required to build and use Web services. All Web service classes inherit the WebService class, which belongs to the System.Web.Services namespace. While writing code within the Web service class, you can use the following attributes: ® WebService:Used to provide additional information about the Web methods exposed by a Web service. ® WebMethod: Used for every method that needs to be exposed for use by other applications. ©NIIT Creating and Using Web Services/Lesson 15/Slide 13 of 28
  14. 14. Creating and Using Web ServicesTask 5: Execute the application. ©NIIT Creating and Using Web Services/Lesson 15/Slide 14 of 28
  15. 15. Creating and Using Web ServicesProblem Statement 15.D.2A form needs to be designed in the Call Center application todisplay the details about a query. The code for retrieving thedetails about a query is provided in the GetQueryData Webservice. This Web service needs to be used in the Call Centerapplication to enable various departments of DiazTelecommunications to view the status of queries. ©NIIT Creating and Using Web Services/Lesson 15/Slide 15 of 28
  16. 16. Creating and Using Web ServicesTask ListIdentify the data to be displayed.Design the user interface.Write the code to display data by using the functionalityexposed by the Web service.Execute the application. ©NIIT Creating and Using Web Services/Lesson 15/Slide 16 of 28
  17. 17. Creating and Using Web ServicesTask 1: Identify the data to be displayed.Result:The data to be displayed includes: Query ID Date of submission Customer ID Employee ID Response date Status Feedback ©NIIT Creating and Using Web Services/Lesson 15/Slide 17 of 28
  18. 18. Creating and Using Web ServicesTask 2: Design the user interface.Task 3: Write the code to display data by using thefunctionality exposed by the Web service.To access the functionality exposed by a Web service,perform the following tasks: Locate the Web service that provides the functionality required in the application. Create a proxy class for the Web service. Reference the proxy class in the application code. Instantiate the proxy class. ©NIIT Creating and Using Web Services/Lesson 15/Slide 18 of 28
  19. 19. Creating and Using Web ServicesTask 4: Execute the application. ©NIIT Creating and Using Web Services/Lesson 15/Slide 19 of 28
  20. 20. Creating and Using Web ServicesJust a Minute…2. How can you locate the Web services developed by a Web service provider?3. Which attribute is used to describe a Web service? ©NIIT Creating and Using Web Services/Lesson 15/Slide 20 of 28
  21. 21. Creating and Using Web ServicesASP.NETIs a powerful programming framework for the development of enterprise-class Web applications.Is a part of the .NET Framework.Provides access to all the features of the .NET Framework. Therefore, you can develop an ASP.NET Web application by using any of the programming languages provided in.NET, such as Visual Basic .NET and C#. ©NIIT Creating and Using Web Services/Lesson 15/Slide 21 of 28
  22. 22. Creating and Using Web ServicesElements of ASP.NETUser interface - For accepting input and displaying text to a user in an ASP.NET Web application, Web Forms are used. The working of a Web Form is similar to that of a Windows Form except that the user interface is typically rendered in a Web browser.Components – For providing reusable code and addingbusiness logic in an ASP.NET Web application, Webservices are used.Data - For accessing data stored in a database in anASP.NET Web application, ADO.NET is used. ©NIIT Creating and Using Web Services/Lesson 15/Slide 22 of 28
  23. 23. Creating and Using Web ServicesWeb Form Allows you to create programmable Web pages that serve as a user interface for your Web application. Provides a combination of HTML, various Web Form controls, and code. Code provided in a Web Form is executed on a Web server running Internet Information Services (IIS) 5.0. Can be used to interact with any Web application regardless of the browser or the type of computer used by them. ©NIIT Creating and Using Web Services/Lesson 15/Slide 23 of 28
  24. 24. Creating and Using Web ServicesSummaryIn this lesson, you learned that:A Web service exposes functionality that can be used by one or more applications, regardless of theprogramming languages, operating systems, and hardwareplatforms used to develop them.The functionality exposed by a Web service can beaccessed by applications by using Internet standards, such as HyperText Transfer Protocol (HTTP) and eXtensible Markup Language (XML).A Web service can be created using any programminglanguage in .NET suite, such as Visual Basic .NET, VisualC#.NET, and Visual C++.NET. ©NIIT Creating and Using Web Services/Lesson 15/Slide 24 of 28
  25. 25. Creating and Using Web ServicesSummary (Contd.)Web services use eXtensible Markup Language forinterchanging data in a standard format between differentapplications.To be able to communicate with each other, a Web service and a client application must agree upon a common protocol. SOAP is a standard communications protocolfor interchanging information in a structured format in a distributed environment.To be able to use a Web service, the developers of a client application need to know the methods exposed by theWeb service and the parameters to be passed to thesemethods. Web Services Description Language (WSDL) isa markup language, which is used to describe a Webservice. ©NIIT Creating and Using Web Services/Lesson 15/Slide 25 of 28
  26. 26. Creating and Using Web ServicesSummary (Contd.)The Universal Description Discovery and Integration (UDDI) initiative is used to allow client applications to discoverthe Web services provided by various Web serviceproviders.A Web service consists of two parts, the Web service entry point and the code that provides the functionality thatis used by other applications.The .asmx file serves as the entry point for the Web service.The WebService attribute is an optional attribute that can be used to provide additional information about theWeb methods exposed by a Web service.You must place the WebMethod attribute before thedeclaration of every method that needs to be exposed foruse by other applications. ©NIIT Creating and Using Web Services/Lesson 15/Slide 26 of 28
  27. 27. Creating and Using Web ServicesSummary (Contd.)In order to be able to access the functionality exposed by a Web service, you need to perform the following tasks: Locate the Web service that provides the functionality required in the application. Create a proxy class for the Web service. Reference the proxy class in the application code. Instantiate the proxy class.Visual Studio .NET provides you with an integrateddevelopment environment for creating Web applicationsranging from traditional Web sites consisting of severalHTML pages to sophisticated business-to-businessapplications that provide Web-based components forperforming data interchange between trading partners. ©NIIT Creating and Using Web Services/Lesson 15/Slide 27 of 28
  28. 28. Creating and Using Web ServicesSummary (Contd.) The Web applications developed using Visual Studio.NET are built on ASP.NET, which is a powerfulprogramming framework for the development of enterprise-class Web applications.ASP.NET is a part of the .NET Framework. It providesaccess to all features of the .NET Framework.An ASP.NET Web application has the same elements as any other client-server application. These elements arethe user interface, components, and data.Web services can be effectively used in both local and Web applications. Using a Web service in an ASP.NET Web application involves the same steps as in the case of a Windows application. ©NIIT Creating and Using Web Services/Lesson 15/Slide 28 of 28

×