Session 6 Module 2 Calling a Web Service from an ASP.NET Web Page.

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

Message Passing Vs Distributed Objects
Other Web Application Development Technologies. PHP.
Service Description: WSDL COMP6017 Topics on Web Services Dr Nicholas Gibbins –
Intesar G Ali IT DepartmentPalestinian Land Authority Web services Prepared by: Intesar Ali IT Department PLA August 2010.
© 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott COMP6325 Advanced Web Technologies Dr. Paul Walcott The University.
Building Localized Applications with Microsoft.NET Framework and Visual Studio.NET Achim Ruopp International Program Manager Microsoft Corp.
RPC Robert Grimm New York University Remote Procedure Calls.
Web Services Darshan R. Kapadia Gregor von Laszewski 1http://grid.rit.edu.
Building and Using Web Services with ASP.NET Rob Howard Program Manager.NET Framework Team Microsoft Corp.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 42 Web Services.
XML Web Services ASP.NET. Overview of Web Services (Page 1) Web Service – Part or all of a Web application that is publicly exposed so that other applications.
9. Web Services. 2 Microsoft Objectives “Web Services are poised to change the future of software development...” WebServices.
1 Software Testing and Quality Assurance Lecture 32 – SWE 205 Course Objective: Basics of Programming Languages & Software Construction Techniques.
1 Web Services Visual C# 2008 Step by Step Chapter 30.
Intro to dot Net Dr. John Abraham UTPA – Fall 09 CSCI 3327.
IT533 Lectures Configuring, Deploying, Tracing and Error Handling.
1 Lecture 22 George Koutsogiannakis Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
XML Web Services in Visual Studio.NET Peter Ty Developer Evangelist.NET and Developer Group.
An Introduction to ASP.NET Ed Dunhill blogs.msdn.com/edunhill SLIDE7.
CIS NET Applications1 Chapter 2 –.NET Component- Oriented Programming Essentials.
.Net Remoting. 2 Distributed Computing under.Net In.Net, there are three levels of access to distributed computing machinery: In.Net, there are three.
WSDL Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Grid Computing, B. Wilkinson, 20043b.1 Web Services Part II.
Introduction to Programming the WWW I CMSC Summer 2004 Lecture 6.
Standalone Java Application vs. Java Web Application
James Holladay, Mario Sweeney, Vu Tran. Web Services Presentation Web Services Theory James Holladay Tools – Visual Studio Vu Tran Tools – Net Beans Mario.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Web Server Administration Web Services XML SOAP. Overview What are web services and what do they do? What is XML? What is SOAP? How are they all connected?
Web Services Week 7 Aims: A detailed look at the underlying mechanisms for communication between web services Objectives: SOAP, WSDL, UDDI.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
ASP.NET.. ASP.NET Environment ASP.NET is Microsoft's programming framework that enables the development of Web applications and services. It is an easy.
Lecture Set 1 Part C: Understanding Visual Studio and.NET – Applications, Solutions, Projects (no longer used – embedded in Lecture Set 2A)
Murach’s ASP.NET 4.0/VB, C1© 2006, Mike Murach & Associates, Inc.Slide 1.
.Net and Web Services Security CS795. Web Services A web application Does not have a user interface (as a traditional web application); instead, it exposes.
1.NET Web Forms Web Services © 2002 by Jerry Post.
Chapter 3 Servlet Basics. 1.Recall the Servlet Role 2.Basic Servlet Structure 3.A simple servlet that generates plain text 4.A servlet that generates.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
Website Development with PHP and MySQL Saving Data.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files.
Chapter 10 Intro to SOAP and WSDL. Objectives By study in the chapter, you will be able to: Describe what is SOAP Exam the rules for creating a SOAP document.
Microsoft ® Visual Studio.NET Presented by Joseph J. Sarna Jr., MCSD JJS Systems, LLC.
XML Web Service. Overview of XML Web Service ASP.NET XML Web services enable you to remotely access the properties and methods of classes across a network.
Introduction to Web Services. Examples Using a Web Service Creating a new Web Service.
Integrating and Troubleshooting Citrix Access Gateway.
Christopher M. Pascucci.NET Programming CodeBehind.
Intro to dot Net Dr. John Abraham UTPA CSCI 3327.
Preliminary Ocean Project Page 1 WGISS SG May 15, C. Caspar G. Tandurella P. Goncalves G. Fallourd I. Petiteville Preliminary Ocean Project Phase.
Introducing ASP+ Scott Mitchell
ASP.NET Web Services.  A unit of managed code installed under IIS that can be remotely invoked using HTTP.
Week Six : Writing Web Services Aims: Creating and Consuming student’s first Web Services Learning Outcomes: Familiarity with VS.NET for creating and consuming.
Chapter 7: Creating and Consuming XML Web Services Understanding XML Web Services Creating XML Web Services Deploying and Discovering XML Web Services.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
Web Services from 10,000 feet Part I Tom Perkins NTPCUG CertSIG XML Web Services.
Web Services An Introduction Copyright © Curt Hill.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
Intro to Web Services Dr. John P. Abraham UTPA. What are Web Services? Applications execute across multiple computers on a network.  The machine on which.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files 8/10/ :35 PM.
.NET Mobile Application Development XML Web Services.
Introduction to ASP.NET, Second Edition2 Chapter Objectives.
Introduction to Web Services Srinath Vasireddy Support Professional Developer Support Microsoft Corporation.
Labs: Create, deploy and test a simple web service
Java Web Services Orca Knowledge Center – Web Service key concepts.
Jim Fawcett CSE681 – SW Modeling & Analysis Spring 2005
Programming the Web Using Visual Studio .NET
ASP.NET Web Forms and Web Services
Web Services Introduction
Web Server Administration
Creating a Distributed System with Remote Procedure Calls and Web Services Ch.5 B.Ramamurthy 2/17/2019 B.Ramamurthy.
Chapter 42 Web Services.
Presentation transcript:

Session 6 Module 2 Calling a Web Service from an ASP.NET Web Page

Tasks for this Module How wed ideally call a Web service from an ASP.NET Web page Creating a Proxy class with wsdl.exe –Using the Proxy class –Examining the Proxy class –Examining wsdl.exe Time allotment for this module and questions: 75 minutes

Calling a Web Service from an ASP.NET Web Page Ideally the developer calling a Web service from an ASP.NET Web page should be able to work with the Web service using the same syntax as if she was working with a component local to the Web server. Since calling a Web service involves marshalling the ingoing parameters properly and being able to marshal the return parameters properly, obviously performing such actions in an ASP.NET Web page would make the syntax differ wildly from using a local component, where such explicit marshalling was not needed.

Enter the Proxy Class In order to achieve the end goal of treating a Web service call just like a call to a local component, the.NET framework contains a command-line program called wsdl.exe (Web Service Description Language), which creates a proxy class for a specific Web service. This proxy class serves as an intermediate between the ASP.NET Web page and the Web service. (The diagram on the next slide should help clarify this…)

WEB SERVER #2 Web service WEB SERVER #1 SomePage.aspx an ASP.NET Web page PROXY CLASS STEP 3: The Web service unmarshals the incoming parameters, runs the method, and marshals the output parameters. These are sent back in an HTTP response. The Role of the Proxy Class STEP 1: The ASP.NET Web page SomePage.aspx instantiates an instance of the Proxy class: Dim objClass = New ProxyClassName And calls one of the Web service methods: objClass.MethodName(paramList) STEP 2: The proxy class marshals the parameter list and makes an HTTP request to the Web service sitting on Web Server #2 STEP 4: The proxy class unmarshals the return parameters and passes back the result to the ASP.NET Web page. Transaction complete!

Creating a Proxy Class Creating a Proxy class involves three steps: –Create the source code for the class, which depends upon the WSDL of the Web service. –Compile the class into a DLL –Copy the DLL to the \bin directory Once these three steps are complete we can use our Proxy class to access Web service methods as if they were methods of a local component! Visual Studio.NET can perform all of these tasks with the click of a button. We will examine how to do it via the command-line for those who dont have VS.NET installed.

Creating a Proxy Class (Continued…) When creating a proxy class, you must specify the WSDL for the Web service. This XML-formatted file contains information on the incoming and outgoing parameters. See Create the proxy class by simply calling wsdl.exe with the full URL of the WSDL as the parameter: Wsdl

Creating a Proxy Class (Continued…) Once we have the source code we need to compile this code into a DLL. Finally, once we have the Proxy class compiled into a DLL, we need to move it to the \bin directory, since that is the location where our DLLs need to reside to be picked up automatically by ASP.NET. Run cl.demo1.txt demo

Using the Proxy Class Once we have the Proxy class compiled and the DLL in the \bin directory, we can use it through an ASP.NET Web page. Show CallSimpleWS.aspx Demo Note how, when examining the syntax, it is impossible to tell if the instantiation of the ucsd.Math class is referring to a local or remote component. Mission accomplished!

Examining the Proxy Class Lets take a moment and examine Math.cs, the source code for the Proxy class created by wsdl.exe Examine Math.cs Note that the Proxy class is in C# - wsdl.exe provides a command-line switch to specify what language to use. Note that a class is created with the same name as the Web service class ( Math, in this example). Also, for each public Web method there is a public method in the Proxy class with the correct input and output parameters.

Examining the Proxy Class (Continued…) Note that in this Proxy class the Web service is being called using the SOAP request/response payloads. All of the complex behavior in hidden in macros or through methods defined in base classes from which our custom Math class inherits from.

Examining wsdl.exe Wsdl.exe contains only one required parameter, a URL or path to the WSDL for the Web service. The following optional parameters can be specified: –/language:language – specifies what language the Proxy class should be created in (vb/cs/js). –/protocol:protocol – specifies the payload protocol to be used (SOAP, HttpGet, HttpPost) –/namespace:namespace – the namespace of the generated Proxy class. –/out:filename – the filename of the Proxy class.

Module 2 in Conclusion Ideally, wed like to be able to call Web services from an ASP.NET Web page in an identical fashion to which we call local components. Creating a Proxy class allows us to call a Web services methods as if the Web service resided locally. The Proxy class handles the actual HTTP request as well as the marshalling of the input and output parameters. The command-line program wsdl.exe can create the source code of the Proxy class for us based upon a Web services WSDL. Once this class is compiled and placed in the \bin directory, it can be used through an ASP.NET Web page.

Questions??? Now would be a great time to ask questions! Dont you think? So ask away!