Presentation 15 SOAP on the Microsoft Platform (.NET)

Slides:



Advertisements
Similar presentations
© 2009 Dr. Paul Walcott – The University of the West Indies: Cave Hill CampusDr. Paul Walcott COMP6325 Advanced Web Technologies Dr. Paul Walcott The University.
Advertisements

Introduction to .NET Framework
 2004 Prentice Hall, Inc. All rights reserved. Chapter 23 – ASP.NET Outline 23.1 Introduction 23.2.NET Overview NET Framework ASP (Active.
.NET Framework Overview
Tahir Nawaz Introduction to.NET Framework. .NET – What Is It? Software platform Language neutral In other words:.NET is not a language (Runtime and a.
Using.NET Platform Note: Most of the material of these slides have been taken & extended from Nakov’s excellent overview for.NET framework, MSDN and wikipedia.
Presentation 7 part 2: SOAP & WSDL.
Presentation 10 SOAP on the Microsoft Platform (.NET)
.NET Session Prepared By : Manu Sharma IBE Team. Topics Types of.NET Applications.NET Framework CLR Garbage Collection Importance of.NET.
SE 370: Programming Web Services Week 4: SOAP & NetBeans Copyright © Steven W. Johnson February 1, 2013.
Web Services Darshan R. Kapadia Gregor von Laszewski 1http://grid.rit.edu.
Presentation 11: SOAP on small devices. Ingeniørhøjskolen i Århus Slide 2 af 14 Outline Which small devices? What are the limitations and what kind of.
Presentation 7: SOAP, WSDL & introduction to UDDI.
SOAP, WSDL & introduction to UDDI
Internetteknologi (ITNET1) Extra Presentation Java IDE Tool Support.
ASP.NET (Active Server Page) SNU OOPSLA Lab. October 2005.
Henrico Dolfing Business Segment Partners. Océ Document Technologies GmbH2 June, NET Framework Version 3.0.
Presentation 7 part 2: SOAP & WSDL. Ingeniørhøjskolen i Århus Slide 2 Outline Building blocks in Web Services SOA SOAP WSDL (UDDI)
Windows Communication Foundation and 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.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
1 Web Services Visual C# 2008 Step by Step Chapter 30.
Platforms and tools for Web Services and Mobile Applications Introduction to C# Bent Thomsen Aalborg University 3rd and 4th of June 2004.
Intro to dot Net Dr. John Abraham UTPA – Fall 09 CSCI 3327.
Microsoft.Net vs. J2EE Suresh Ramachandran Duke Energy.
A Free sample background from © 2001 By Default!Slide 1.NET Overview BY: Pinkesh Desai.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
February 24 th -25 th 2004 Daragh Byrne – EPCC Additional.NET Concepts.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
1 Introduction to.NET Framework. 2.NETFramework Internet COM+ Orchestration Orchestration Windows.NET Enterprise ServersBuildingBlockServices Visual Studio.NET.
Introduction to ASP.NET. Prehistory of ASP.NET Original Internet – text based WWW – static graphical content  HTML (client-side) Need for interactive.
1 8/29/05CS360 Windows Programming Professor Shereen Khoja.
Intro to C# Dr. John P. Abraham UTPA. Background required Thorough C++ programming – If you made an A in 1370/1170 you will do fine with some effort.
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
Presentation 15 SOAP on the Microsoft Platform (.NET)
CIS 375—Web App Dev II Microsoft’s.NET. 2 Introduction to.NET Steve Ballmer (January 2000): Steve Ballmer "Delivering an Internet-based platform of Next.
Presentation 8: SOAP in a distributed object framework, Application Servers & AXIS SOAP.
Presentation: SOAP in a distributed object framework, Application Servers & AXIS SOAP.
1 HKU CSIS DB Seminar: HKU CSIS DB Seminar: Web Services Oriented Data Processing and Integration Speaker: Eric Lo.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
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.
.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.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
Presentation 23.NET Remoting Introduced. Ingeniørhøjskolen i Århus Slide 2 af 20 Outline.NET Framework introduced.NET Remoting strategies Architecture.
.Net – The First Glance What Is.Net, Why Use.Net.
Introducing ASP.NET 2.0. Internet Technologies WWW Architecture Web Server Client Server Request Response Network HTTP TCP/IP PC/Mac/Unix + Browser (IE,
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
Active Server Pages (ASP), also known as Classic ASP or ASP Classic, was Microsoft's first server-side script engine for dynamically generated web pages.
Module 3: Using Microsoft.NET- Based Languages. Overview Overview of the.NET-Based Languages Comparison of the.NET-Based Languages.
Intro to dot Net Dr. John Abraham UTPA CSCI 3327.
ASP.NET in Definition: 1.ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites,
Module 1: Overview of the Microsoft .NET Framework
ASP.NET (Active Server Page) SNU OOPSLA Lab. October 2005.
Chapter 7: Creating and Consuming XML Web Services Understanding XML Web Services Creating XML Web Services Deploying and Discovering XML Web Services.
NJIT 1 Apache Tomcat (Version 6.0) THETOPPERSWAY.COM.
.NET Mobile Application Development XML Web Services.
Introduction to Web Services Srinath Vasireddy Support Professional Developer Support Microsoft Corporation.
Labs: Create, deploy and test a simple web service
Windows Communication Foundation and Web Services
Suresh Ramachandran Duke Energy
Writing simple Java Web Services using Eclipse
Outline SOAP and Web Services in relation to Distributed Objects
ASP.NET Web Forms and Web Services
Introduction to .NET Framework Ch2 – Deitel’s Book
Outline SOAP and Web Services in relation to Distributed Objects
Windows Communication Foundation and Web Services
Chapter 23 – ASP.NET Outline 23.1 Introduction NET Overview
Web Development Using ASP .NET
Student: Popa Andrei-Sebastian
Presentation transcript:

Presentation 15 SOAP on the Microsoft Platform (.NET)

Ingeniørhøjskolen i Århus Slide 2 af 29 Outline You have already been introduced to SOAP, WSDL & UDDI on the JAVA platform using AXIS Now we will take a look at the MS. NET platforms SOAP capabilities Luckily – SOAP & WSDL are well standardized – so we do not need to look at these again Instead we will: –Show the counterpart of the AXIS project in.NET - IIS –Show the alternatives to JAVA development – using the tools from.NET framework & Microsoft Visual Studio.NET

Ingeniørhøjskolen i Århus Slide 3 af 29 Apache Tomcat vs. Microsoft Internet Information Server Apache Tomcat with AXIS & J2SE Java SDK –Works on: Windows, UNIX, LINUX Open source Can be compiled to any platform (with some work) –Server listening for events: HTTP on port 80 (test http 8080 at startup) Executes Servlets/JSP and JavaBeans –AXIS is an embedded project within the Tomcat environment but works with most J2EE compliant AS Microsoft Internet Information Server with the.NET Framework SDK (ASP.NET) –Works on: Only Windows platforms (Windows NT, 2000, XP) –Server listening for events: HTTP on port 80 (optional) Executes Web resources – ASP.NET, Web services, Web forms (resulting in client side HTML ),.NET code –Tightly integrated with the Visual Studio.NET – for easy deployment & debugging SOAP Client Java, C++, C#, Delphi, VB Application SOAP Client Java, C++, C#, Delphi, VB Application SOAP over HTTP Web Server MS Internet Information Server & the.NET Framework SDK (ASP.NET) (vs. Apache Tomcat, with AXIS & J2SE SDK) Web Server MS Internet Information Server & the.NET Framework SDK (ASP.NET) (vs. Apache Tomcat, with AXIS & J2SE SDK) Web Forms Web Forms Web Service Web Service C++ unman. C++ unman. Managed code Managed code Common code base – but only MS!

Ingeniørhøjskolen i Århus Slide 4 af 29 Web service enabling Windows You need to: –Install.NET Framework SDK Download from Microsoft (130 MB) Comes standard with Visual Studio 2003.NET –Install Internet Information Server Enabled via the Control Panel Remember to shut down after using!!! –Visual Studio.NET Already installed (7 or 7.1) More detailed instructions will follow for the LAB exercise

Ingeniørhøjskolen i Århus Slide 5 af 29 Not a Windows.NET course You will NOT be required to be an expert on.NET You will be required to be knowledgeable about it History: –Open source, Java, Linux the WWW threatened MS –Especially Java was gaining widespread support amongst developers for its ease of use, productivity and heterogeneity –The Empire Strikes back = the.NET Framework

Ingeniørhøjskolen i Århus Slide 6 af 29 Benefits of.NET Changes EVERYTHING –Takes all that was nice in Java and enhances it –End of DLL incompatibilities, DLL Hell, COM registry hell –Enter world of VM’s and Java like code (C#) including Garbage collection – BUT with easy support for legacy umanaged code (e.g. C++ for speed) and COM –Performs much better than Java, and almost equivalent with Win32 C++ applications –Still only support Microsoft operating systems BUT –.NET and C# is ECMA standard: Mono ( for Linux is being developedwww.go-mono.org –IIOP.NET ( for CORBA interophttp://iiop-net.sourceforge.net/index.html

Ingeniørhøjskolen i Århus Slide 7 af 29 The.NET Framework Components Win32 MessageQueuingCOM+ (Transactions, Partitions, Object Pooling) IISWMI Common Language Runtime.NET Framework Class Library ADO.NET and XML XML Web Services User Interface Visual Basic C++C#PerlJScript… Application services. E.g. IIS, Message Queuing etc. CLR:runtime execution environment. Equlas JVM of Java. Microsoft Intermediate Language (MSIL) equals Java ByteCode A collection of class libraries (over 9000) wraps Win32 like Java API ActiveX Data Objects 3 types of user interfaces: Web forms, Windows forms (Win32), Command Console For inter-process communications Any language conforming to the Common Language Specification (CLS) may be used. Source code Source code Compiler Intermediate Language Intermediate Language.NET Framework.NET Framework Other IL libraries Other IL libraries Linker Linked Program Linked Program JIT-compiler Executable Program Executable Program JIT-compiler only runs first time! Here we find the.NET Remoting libraries

Ingeniørhøjskolen i Århus Slide 8 af 29 Benefits of Using the.NET Framework Based on Web standards and practices Functionality of.NET classes is universally available Code is organized into hierarchical namespaces and classes Language independent Windows API ASP.NET Framework 1980’s 1990’s2000’s Visual Basic MFC/ATL

Ingeniørhøjskolen i Århus Slide 9 af 29 Visual Studio.NET: The Tool for.NET Development Visual Studio.NET Windows Forms Tools Web Forms Tools Error Handling Data Access Multiple Languages Web Services Tools DevelopDebugDeployDesign

Ingeniørhøjskolen i Århus Slide 10 af 29 Multiple Language Support The.NET Framework is designed to support many languages –More than 20 languages currently supported –Microsoft provides Visual Basic.NET, C#, Visual J#.NET, and JScript.NET (backwards compatible with JScript) – others: Delphi (object pascal) Benefits of multiple-language support –Code modules are reusable –API access is the same for all languages –The right language is used for the right task –Performance is roughly equal between all languages (which was not the case in ASP)

Ingeniørhøjskolen i Århus Slide 11 af 29 The Common Language Runtime One runtime for all. NET-Based Languages Manages threads and memory –Garbage collection Enforces code security Eliminates DLL versioning problems –Multiple versions of a DLL can run simultaneously –Applications can specify a version of a DLL to use Reminds one of the Java Virtual Machine

Ingeniørhøjskolen i Århus Slide 12 af 29 Runtime Compilation and Execution Native code C# code Visual Basic.NET code Which language? A Basic.NET compiler C# compiler MSIL JIT compiler Web form (default.aspx) or Web service (default.asmx) Runtime HTML / SOAP

Ingeniørhøjskolen i Århus Slide 13 af 29 Ressources for learning more Feel free to learn more about ASP.NET: –Getting started with the.NET framework – us/cpguide/html/cpcongettingstartedwithnetframework.asphttp://msdn.microsoft.com/library/default.asp?url=/library/en- us/cpguide/html/cpcongettingstartedwithnetframework.asp –Link can be found at the course site –Books on the subject Beginning.NET Web Services using C# by Joseph Bustos and Karli Watsom (WROK forlag) More will be listed on the course site Other relevant courses at IHA: –Windows programming (WIN1) –Komponent baseret udvikling (KPU1)

Ingeniørhøjskolen i Århus Slide 14 af 29 Making the HelloWorld application Using Notepad ! Using Microsoft Visual Studio.NET First: –Install.NET Framework –Install IIS Then: –Produce code Manually for Notepad Wizard for Visual Studio –Deploy in the IIS folder \inetpub\wwwroot\ As an.asmx file –Test the Web service Using the build in functionality –Write the Client – and all is well

Ingeniørhøjskolen i Århus Slide 15 af 29 C# Notepad HelloWorld Name(missing): identifies localname of service Namespace: the default namespace for the service Description: a purely descriptive text information WebService processing directive for the ASP.NET environment, e.g. class & language info WebService Attribute, for configuration “behind the scenes” programming WebMethod Attribute: indicates that the following method is to be exposed as a Web Service method (only public methods are allowed of course). Allowed properties: -BufferResponse, CacheDuration, Description, EnableSession, MessageName, TransactionOption

Ingeniørhøjskolen i Århus Slide 16 af 29 Using Visual Studio (managed C++) Wizards Available: for Managed C++ (see below example VB and C# Code-behind: generates.asmx file and code behind (e.g..cpp in C++ or.cs in C#)

Ingeniørhøjskolen i Århus Slide 17 af 29 Deploy & Test – access via browser IIS test : supports viewing WSDL & code testing via browser WSDL: using ?WSDL SOAP request & test: small test program generated

Ingeniørhøjskolen i Århus Slide 18 af 29 Developing the Client application Support for using Web services in an Visual Studio application Stubs are automatically compiled by Visual Studio using the “Add Web Reference” function OR You may simply use command line tools Note on command line usage: If you do not wish to use Visual Studio IDE you may use the tool via the command line: wsdl " /out:hello.cs This will produce the hello.cs file which must be compiled as a DLL (using the C#.NET compiler) csc hello.cs /t:library /out:hello.dll /r:System.Web.Service.dll /r:System.Xml.dll Note on command line usage: If you do not wish to use Visual Studio IDE you may use the tool via the command line: wsdl " /out:hello.cs This will produce the hello.cs file which must be compiled as a DLL (using the C#.NET compiler) csc hello.cs /t:library /out:hello.dll /r:System.Web.Service.dll /r:System.Xml.dll See example at: See example at:

Ingeniørhøjskolen i Århus Slide 19 af 29 New Application & Add Web Reference Add Web Reference: Visual Studio support for generating a proxy using WSDL document

Ingeniørhøjskolen i Århus Slide 20 af 29 Discover & bind the Web service Add Web Reference: Just enter the Web service endpoint address

Ingeniørhøjskolen i Århus Slide 21 af 29 Visual Studio produces a Proxy DLL Performed by Visual Studio tool: a DLL is generated (Web Service Proxy Generator), and a header file and a WSDL support document is made available

Ingeniørhøjskolen i Århus Slide 22 af 29 Proxy class DLL DLL is generated by Visual Studio The generated Proxy class derives from System.Web.Service.Protocols.SoapHttpClientProtocol It contains the following properties –ClientCertificates allows clients to pass Authenticode X.509 v.3 certificates –CookieContainer for handling state –Credentials for authentication purposes –PreAuthenticate saves the roundtrip by sending credentials first –Proxy use this property if you need to pass a proxy –Timeout default milisseconds – may be set for infinite –Url from the location attribut of the service used

Ingeniørhøjskolen i Århus Slide 23 af 29 using System.Diagnostics; using System.Xml.Serialization; using System; using System.Web.Services.Protocols; using System.ComponentModel; using System.Web.Services; /// [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Web.Services.WebServiceBindingAttribute(Name="HelloWorldSoap", Namespace=" public class HelloWorld : System.Web.Services.Protocols.SoapHttpClientProtocol { public HelloWorld() { this.Url = " } [System.Web.Services.Protocols.SoapDocumentMethodAttribute(" RequestNamespace=" ResponseNamespace=" Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public string Hello(string myName) { object[] results = this.Invoke("Hello", new object[] { myName}); return ((string)(results[0])); } public System.IAsyncResult BeginHello(string myName, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("Hello", new object[] { myName}, callback, asyncState); } public string EndHello(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); return ((string)(results[0])); } using System.Diagnostics; using System.Xml.Serialization; using System; using System.Web.Services.Protocols; using System.ComponentModel; using System.Web.Services; /// [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Web.Services.WebServiceBindingAttribute(Name="HelloWorldSoap", Namespace=" public class HelloWorld : System.Web.Services.Protocols.SoapHttpClientProtocol { public HelloWorld() { this.Url = " } [System.Web.Services.Protocols.SoapDocumentMethodAttribute(" RequestNamespace=" ResponseNamespace=" Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public string Hello(string myName) { object[] results = this.Invoke("Hello", new object[] { myName}); return ((string)(results[0])); } public System.IAsyncResult BeginHello(string myName, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("Hello", new object[] { myName}, callback, asyncState); } public string EndHello(System.IAsyncResult asyncResult) { object[] results = this.EndInvoke(asyncResult); return ((string)(results[0])); } The Proxy code generated by the WSDL Proxy generator

Ingeniørhøjskolen i Århus Slide 24 af 29 Write the C++ code

Ingeniørhøjskolen i Århus Slide 25 af 29 Try it out Not that much fun with command line … lets make a proper Windows solution

Ingeniørhøjskolen i Århus Slide 26 af 29 Piece of Cake – Now C# Add Web Reference: Again we use the Web service endpoint address with the “Add Web Reference” feature We add a button, a text field and a label. Clicking the button gives access to the event handler “OnClick” of the button Simple C# Windows Form Application:No point in producing another command line app

Ingeniørhøjskolen i Århus Slide 27 af 29 C# - coding the connection Using the Proxy DLL: We recognize the connection between the WSDL, the DLL and the C# client code

Ingeniørhøjskolen i Århus Slide 28 af 29 Heterogeneous system C# to Java Proxy DLL stub generated by VS Proxy skeleton class generated by AXIS // Hello World.Java public class HelloWorld { public HelloWorld() { } public String getHelloWorldMessage(String name) { return "Hello World to "+name; } private void button1_Click(object sender, System.EventArgs e) { localhost.HelloWorldService hello = new localhost.HelloWorldService(); textBox1.Text = hello.getHelloWorldMessage("Stefan"); } C# to Java Lets change it to our Axis Web service Add Web Reference: We need to generate a new Proxy DLL Other way around: and of course it also works the other way around Proxy: if we are not using.JWS deployment, we need to generate the skeleton classes in AXIS as well

Ingeniørhøjskolen i Århus Slide 29 af 29 Try it with C++ WARNING: In VS7 there seems to be a bug! –Problem with port 8080 –Need to manually paste the WSDL file and compile the proxy stub DLL –This works fine in C# –No problem in VS7.1