• No results found

Web Service &ndash

N/A
N/A
Protected

Academic year: 2022

Share " Web Service &ndash"

Copied!
79
0
0

Loading.... (view fulltext now)

Full text

(1)Web Services Woralak Kongdenfha (วรลักษณ์ คงเด่นฟ้า) http://www.cse.unsw.edu.au/~woralakk http://www.ecpe.nu.ac.th/woralak.

(2) Course Outline         . Introduction to the Web XML and the Web Service Oriented Architectures Web services standards SOAP-based Web Services Development Web services composition REST Architecture Developing REST-based Web Services Data services.

(3)

(4)

(5)

(6) Web Service – what is it? . A web service is a program code that’s accessible over the network for use by other programs. . Exposes part of an application (methods) to other applications Independent of language and platform:. . . Could be a java program running on a Linux server calling a service written in VB on a Windows 2008 server.

(7) Example: Amazon / books search.

(8) Example: Amazon / books search.

(9) Example: Amazon / books search.

(10) Amazon Search as a Service on the Web.

(11) Amazon Search as a Web Service.

(12) Fundamental Differences . Web Applications . . With humans, all you need is a URL and a nice web page or web form, people figure out what to do. Web Services . No human in the loop. The behavior of the client is based on its code, there is no intelligence, and no help (no form to drive input data, no page that explains).

(13) A distributed ASP.NET web application. Client HTTP request. Browser. Web server With IIS. Web server With IIS XML. HTTP response. Web page. Web service. • Unlike traditional web applications, web services do not require GUI, HTML or browsers.

(14) Web Services vs Existing technologies . Existing Technologies for accessing remote functionality   . . Microsoft COM (Component Object Model)/DCOM Java Remote Method Invocation (RMI), Enterprise JavaBean Object Management Group’s CORBA. Web Services . Cross-platform and naturally allow application-to-application communication over Internet protocol backbone.

(15) Web Services Commercial Frameworks     . Microsoft (www.microsoft.com/net) IBM (www.ibm.com/webservices) SUN (http://wwws.sun.com/software/sunone) Oracle (http://otn.oracle.com/tech/webservices) Hewlett Packard (http://www.hpmiddlware.com).

(16) Common aspects of distributed applications.

(17) Web Services Conceptual Architecture (IBM).

(18) Web Services Conceptual Architecture (IBM).

(19) Web Services Conceptual Architecture (IBM).

(20) Speaking a common Language . Everything is based on XML   . SOAP – Simple Object Access Protocol WSDL – Web Service Description Language UDDI – Universal Description, Discovery, and Integration.

(21) XML.

(22) Why XML???. . Early Web  . สร้ างเพือแสดงเอกสารให้ มนุษย์อ่าน HTML ถูกออกแบบเพือจุดประสงค์นี &. . Today’s Web . business activities จํานวนมากเกิดขึ &นบน Web. . กลายเป็ น platform สําหรับแลกเปลียนข้ อมูล. . web app ⇔ people, web app ⇔ web app. . แก้ ข้อเสียของ HTML ทีจําเป็ นต้ องแก้ โปรแกรมทีอา่ น HTML เมือ HTML page มีการเปลียนแปลง.

(23) eXtensible Markup Language (XML)   . . XML is a language that describes data It’s simple, flexible and extensible text data format “extensible” because the markup format is not fixed like HTML  คุณสามารถสร้ าง markup ของคุณเองได้. It separates presentation issues from the actual data.

(24) Separating the content from presentation XML. CSS. <xml version = “1.0”?>. staff{background-color: #cccccc; …}. <xml-style-sheet type=“text/css”. name{display: block; font-size: 20pt; …}. href=“staff.css”?> <staff> <name>Woralak Kongdenfha</name> <title>Lecturer</title> <email>woralakk@yahoo.com</email> <photo src=“me.gif”/> </staff>. title{display: block; margin-left: 20pt; …} email{display: block; margin-left: 20pt; …}.

(25) XML: tags, tags, tags . พิจารณาข้ อมูลพนักงานในตารางต่อไปนี &.

(26) XML Syntax . A XML document is a tree ….

(27) XML Syntax  . All XML documents must have a root element All XML elements must have a closing tag .   . Xml tags are case sensitive XML elements must be nested (<p><q></p></q>??) Element naming    . . Empty element tags end with />. Letters, numbers, and other characters Must not start with a number, ‘. (period)’, or ‘ – (hyphen)’ Must not start with ‘xml’ (or ‘XML’ or ‘Xml’..) Cannot contain spaces. Comments in XML: <!– This is a comment-->.

(28) Attributes in XML tags.  . Attribute values must be quoted (single or double) Attribute order is not significant.

(29) Entity references   . ข้ อมูลใน xml elements ไม่สามารถประกอบด้ วยอักษรทีมีความหมายพิเศษ (เช่น < ใช้ แทน opening tag ดังนันไม่ & สามารถแทนเครื องหมายน้ อยกว่าได้ ) คุณสามารถใช้ entity references เพือแทนอักษรทีมีความหมายพิเศษ XML มี 5 entity references ดังต่อไปนี &     . . &lt; - the less than sign (<) &gt; – the greater than sign (>) &amp; - the ampersand (&) &quot; - the straight double quotation marks (”) &apos; - the apostrophe, single quote (’). Example:  <image source=‘koala.gif’ width=‘122’ height=’66’ alt=‘powered by O&apos;Reilly books’/>.

(30) Web Service Standards SOAP, WSDL, UDDI.

(31) Interactions between WS and Client.

(32) Interactions between WS and Client.

(33) Interactions between WS and Client.

(34) SOAP.

(35) SOAP and Web Services •. SOAP is a protocol for transferring data across the internet. •. Web Services are the remote objects. They use SOAP to transmit data to and from client (clients can also be Web services). •. So SOAP is a part of what makes Web Services possible, but that is not the complete picture of Web services.

(36) Web Services interaction styles with SOAP RPC.

(37) Simple Object Access Protocol (SOAP).

(38) SOAP Syntax.

(39) SOAP Example.

(40) Web Services interaction styles with SOAP RPC.

(41) SOAP RPC Request for the bank service.

(42) SOAP RPC Response for the bank service.

(43) SOAP RPC Fault.

(44) Binding SOAP with a Transfer Protocol.

(45) Binding SOAP with a Transfer Protocol.

(46) An Example of SOAP Binding over HTTP.

(47) An Example of SOAP Binding over HTTP.

(48) An Example of SOAP Binding over HTTP.

(49) An Example of SOAP Binding over SMTP.

(50) WSDL.

(51) Web Services Description Language (WSDL).

(52) WSDL: Two parts.

(53) WSDL Main Elements: definitions.

(54) WSDL Main Elements: types.

(55) WSDL Main Elements: message.

(56) WSDL Main Elements: portType.

(57) WSDL Main Elements: binding.

(58) WSDL Main Elements: binding.

(59) WSDL Main Elements: binding.

(60) WSDL Main Elements: service.

(61)

(62)

(63) UDDI.

(64) Universal Description Discovery and Integration (UDDI).

(65) UDDI – The Big Idea.

(66) UDDI’s provided APIs.

(67) Web Services Development.

(68) Developing a Web Service with .NET  . Implemented in ASP.NET Similar to Web forms, but  .   . have .asmx file extension contains code, without UI. Can have a code-behind ASP.NET provides simple test hardness ASP.NET automatically generates WSDL.

(69) Creating a Web Service . In Visual Studio: .  . Create a new project (ASP.NET Web Service). Any methods that are to be publicly available over the network must have a [WebMethod] tag Hello World Example: <%@WebService language=“C#” class=“FirstService”%> using System; using System.Web.Services; using System.Xml.Serialization; { [WebMethod] Public string SayHello(string person) {return “Hello, ” + person;} }.

(70) Testing the created web service . View in a browser to see avaiable methods. . Service description link shows WSDL definition for the service. . SayHello link loads a testing page that shows the SOAP request/response schema and form for testing the method Submit this form to see actual SOAP response. .

(71) Consuming Web Services . Locate the desired Web Service . . Get detailed description of Web Service . . WSDL. Create a proxy that represents the Web Service . . UDDI. Proxy has the same methods/arguments/return values as the Web service. Application instantiates and uses the proxy as if it were a local object.

(72) Consuming Web Services. Create with WSDL.exe. Web Service Developer. Web Application Developer. Web Server C Web Server S .asmx. Service App. Proxy .cs. Web Form .aspx Service Application.

(73) Consuming Web Services . Web Services are URL addressable .  . HTTP request/response. Can request WSDL via URL Can invoke via:   . HTTP Post HTTP-SOAP 1.1 HTTP-SOAP 1.2.

(74) And today - REST . Representational State Transfer  . Simple than SOAP Uses all of the HTTP transfer methods    . . GET (Retrieve) POST (Create) PUT (Update) DELETE (Delete). We do not cover the content in this part, if you want to learn more, search the net ☺.

(75) Consuming Web Services . Request without method name or parameters . ASP.NET return a page listing all methods . . Ex: http://localhost/MyFirstService/FirstService.asmx. Click one of the methods to test it  . Ex: http://localhost/MyFirstService/FirstService.asmx?op=SayHello Specify parameters and invoke . . Only for primitive data types. Sample requests/responses.

(76) Consuming Web Services . Request with parameter “WSDL” .   . Formal WSDL description of Web Service XML-based grammar Can be used as input for wsdl.exe . . Ex: http://localhost/MyFirstService/FirstService.asmx?WSDL. This builds a proxy, and you can start using the Web Service functionality. Add a Web Reference to the Service . Client application instantiates and uses the proxy as if it were a local object Using System; Using System.IO; Class SvcEater { public static void main(String[] args) { FirstService mySvc = new FirstService(); Console.Writeline(“Calling Hello World Service:” + mySvc.SayHello()); } }.

(77) What’s out there: Web Service Examples.

(78) What’s out there: Web Service Examples.

(79) References . These slides are partly from  . Service Oriented Architecture course, CSE, UNSW Web Application Engineering, MIT.

(80)

References

Related documents

Step2: Calculate the Horizontal Loads • Transverse Surge load is taken as 10% of the combined. weight of the crab and the

The study of Nonnenberg and Mendonca (2004) finds that the factors such as the market size measured by GNP, growth rate of the product, the availability of skilled labor,

complying with the following conditions: (a) provide its Lifeline customers with 911 and enhanced 911 (E911) access regardless of activation status and availability of

Late maternal death is defined as a maternal death due to pregnancy (direct or indirect obstetric causes) which occurred more than 42 days but less than one year after the end

In view of the additional information provided and of the reported relevance of the relations for the work on medical devices, and in order to encourage

83,3 85,3 96 54,7 75,3 Jumlah 78,92 Bahwa hasil penelitian dan pengisian daftar pertanyaan (koesioner) ke 30 responden terhadap faktor internal yang terdiri dari 5 (lima)

If you decide to participate, you will be asked to participate in the following step-by-step process. 1) Participate in a pre and post parent survey (30 minutes x 2 surveys), 2)

This forum is dedicated to the discussion on the social values of Second Language Acquisition (SLA) research and is motivated by talks organized in the Fall of 2018 by Columbia