Notes 23 - ServicesOverview

Notes 23 - ServicesOverview - Web Services and.NET Web An...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Web Services and .NET Web An Overview Copyright E. Horowitz 2007 The challenge: a multiplicity of devices Access Points Apps Devices Services Services myInbox SOAP myContacts myCalendar OS independent: Windows, Windows CE, UNIX, Mac, Palm, etc. Palm, We want to be able to write applications that run across devices, and use any language across Copyright E. Horowitz 2007 2 XML is the Lingua Franca For XML Software Data Formats Software XML Web GUI PC The browser has become the The universal GUI XML has become the XML universal data format Programmable XML Web Programmable Services will become the universal programming model between devices Copyright E. Horowitz 2007 3 Many Standard Services are Already Using XML <myInbox> <mailFolders>…</mailFolders> <mailHeaders>…</mailHeaders> </myInbox> <myContacts> <folder name=“friends”> <contact>…</contact> </folder> </myContacts> <myCalendar> <event> <title>…</title> <eventTime>…</eventTime> </event> </myCalendar> 4 myInbox myContacts myCalendar Copyright E. Horowitz 2007 What Is An XML Web Service? A web site's information must be pulled down web A Web Service makes information available to other Web programs Web site information is now transformed into Web reusable components One can publish and/or consume Web services One Secure interactions across trust boundaries Secure An integration methodology An Uses XML interactions between systems Uses Works with any operating system, programming Works language or network Can expose existing code as Web service Can Copyright E. Horowitz 2007 5 What Is An XML Web Service? (cont’d) Most of the web’s work is done by 2 methods: GET, Most and POST and a simple markup language, HTML The term “services” does NOT mean coarse-grained The grained like amazon.com, but component services that amazon.com but others might use to build bigger services others For example, some component services might For include: Currency conversion Currency Language translation Language Claim processing Claim Authentication Authentication Definition: web services are self-contained, selfDefinition: describing, modular applications that can be describing, published, located and invoked across the web published, Copyright E. Horowitz 2007 6 Web Services Architecture Stack Copyright E. Horowitz 2007 7 Core Technologies XML solves a key technology requirement that appears in many XML places. By offering a standard, flexible and inherently extensible data format, XML significantly reduces the burden of deploying the many technologies needed to ensure the success of Web services. SOAP 1.2 provides a standard, extensible, composable framework for SOAP packaging and exchanging XML messages. SOAP also provides a convenient mechanism for referencing capabilities (typically by use capabilities (typically of headers). WSDL describes Web services starting with the messages that are WSDL exchanged between the requester and provider agents. The messages themselves are described abstractly and then bound to a concrete network protocol and message format. Copyright E. Horowitz 2007 8 The General Process of Engaging a Web Service (1) The requestor and provider become known (2) the requester and provider agree on the service that governs their interaction; (3) the service is realized by requester and provider, and (4) requester and provider exchange messages Copyright E. Horowitz 2007 9 Styles of use: RPC, Service, REST RPC Web services present a distributed function (or method) call interface. RPC terface. Typically, the basic unit of RPC Web services is the WSDL operation. Typically, Service-oriented Architecture: Web services can also be used to implement an Service Web architecture according to Service-oriented architecture (SOA) concepts, where Service the basic unit of communication is a message, rather than an operation. This ration. is often referred to as "message-oriented" services. is Representational State Transfer (REST) Representational RESTful Web services attempt to emulate HTTP and similar protocols by RESTful Web constraining the interface to a set of well-known, standard operations (e.g., GET, constraining known, PUT, DELETE). Here, the focus is on interacting with stateful resources, rather than stateful resources, messages or operations. messages RESTful Web services can use WSDL to describe SOAP messaging over HTTP, RESTful use describe which defines the operations, or can be implemented as an abstraction purely on top ction of SOAP (e.g., WS-Transfer). of Copyright E. Horowitz 2007 10 SOAP Wire-protocol based on XML and HTTP that consists of: An envelope for describing what is in a message An and how to process it A set of encoding rules for expressing instances set of application-defined data types A convention for representing remote procedure convention calls and responses Copyright E. Horowitz 2007 11 Sample SOAP request POST /CurrencyServer/CurrencyExchange.asmx HTTP/1.1 Host: theseus Host: theseus Content-Type: text/xml; charset=utf-8 Type: charset Content-Length: length SOAPAction: http://di.unipi.it/webservices/Euro http://di.unipi.it/webservices/Euro <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema xmlns:soap=http://schemas.xmlsoap.org/soap/envelope> <soap:Body> <Euro xmlns=http://di.unipi.it/webservices> Euro xmlns <currency>100 EUR</currency> </Euro> </soap:Body> </soap:Envelope> Copyright E. Horowitz 2007 12 Sample SOAP response HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Type: charset Content-Length: length <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema xmlns:soap=http://schemas.xmlsoap.org/soap/envelope> <soap:Body> <EuroResponse xmlns=http://di.unipi.it/webservices> <EuroResult>121.524 USD</EuroResult> </EuroResponse> </soap:Body> </soap:Envelope> Copyright E. Horowitz 2007 13 WSDL WSDL stands for Web Services WSDL Description Language WSDL is written in XML WSDL WSDL is an XML document WSDL WSDL is used to WSDL Specify the characteristics of a Web service Describe where it is located and Describe How It is invoked How Copyright E. Horowitz 2007 14 WSDL (cont’d) WSDL enables a service provider to specify the following characteristics of a Web service: Name of the Web service and addressing information Protocol and encoding style to be used when accessing the public operations Type information: Operations, parameters, and data types comprising the interface Copyright E. Horowitz 2007 15 W3C WSDL Site http://www.w3.org/2002/ws/desc/ wsdl 2.0 is a “recommendation”: 2.0 http://www.w3.org/TR/wsdl20/ Copyright E. Horowitz 2007 16 WSDL Basics WSDL enables one to separate the description of the abstract WSDL functionality offered by a service from concrete details of a service description such as "how" and "where" that functionality is offered At an abstract level, WSDL describes a Web service in terms of At the messages it sends and receives; messages are described independent of a specific wire format using messages a type system, typically XML Schema. An operation associates a message exchange pattern with one or An operation more messages. A message exchange pattern identifies the sequence and message cardinality of messages sent and/or received as well as who they are logically sent to and/or received from. An interface groups together operations without any commitment An interface to transport or wire format. At a concrete level, a binding specifies transport and wire At binding format details for one or more interfaces. An endpoint associates a network address with a binding. And An endpoint finally, a service groups together endpoints that implement a service common interface. Copyright E. Horowitz 2007 17 WSDL Elements A WSDL document defines a web service using these basic elements: Element Defines <portType> The operations performed by the web service: an abstract set of one or more operations supported by one or more ports. <message> The messages used by the web service: an abstract, typed definition of the data being communicated. A message can have one or more typed parts. <types> The data types used by the web service: a container for data type definitions using some type system, such as XML Schema. <binding> The communication protocols used by the web service: a concrete protocol and data format specification for a particular port type. <service> A collection of related ports. Copyright E. Horowitz 2007 18 Explanations of WSDL Elements (cont’d) definitions - The definitions element must be definitions The element of all WSDL documents. It defines the the web service, declares multiple namespaces throughout the remainder of the document, and all the service elements described here. the root name of used contains types - The types element describes all the data types types The used between the client and server. WSDL is not tied exclusively to a specific typing system, but it uses the W3C XML Schema specification as its default choice. If the service uses only XML Schema built-in simple If in types, such as strings and integers, the types element is not required. is message - The message element describes a one-way message way message, whether it is a single message request or a single message response. It defines the name of the message and contains zero or more message part elements, which can refer to message parameters or message return values. Copyright E. Horowitz 2007 19 Explanations of WSDL Elements (cont’d) portType - The portType element combines multiple portType The portType element message elements to form a complete one-way or roundmessage trip operation. For example, a portType can combine one trip portType can request and one response message into a single request/response operation, most commonly used in SOAP services. Note that a portType can (and frequently portType can does) define multiple operations. binding - The binding element describes the concrete binding The specifics of how the service will be implemented on the wire. WSDL includes built-in extensions for defining wire. in SOAP services, and SOAP-specific information therefore SOAP specific goes here. service - The service element defines the address for service The invoking the specified service. Most commonly, this includes a URL for invoking the SOAP service. includes Copyright E. Horowitz 2007 20 WSDL Structure The main structure of a WSDL document looks like this: The <definitions> <types> <types> definition of types........ definition </types> </types> <message> <message> definition of a message.... definition </message> </message> <portType> definition of a port....... definition </portType> </ <binding> <binding> definition of a binding.... definition </binding> </binding> </definitions> </definitions> Copyright E. Horowitz 2007 21 Another Summary of the WSDL Structure (cont’d) Types Message Port Type Operation Binding Service Port Data type definitions Signature of request and reply for Signature each method (≈ IDL) each <service, protocol> operations <service, messages method method messages Protocol and data-format format specification specification binding } { Port Port binding Address (≈ URL) Copyright E. Horowitz 2007 22 WSDL Elements / Relationships Described as an Entity-Relationship Diagram Copyright E. Horowitz 2007 23 WSDL Namespaces Copyright E. Horowitz 2007 24 Operation Patterns Supported by WSDL Figure 6-3. Operation patterns supported by WSDL 1.1 Copyright E. Horowitz 2007 25 WSDL example – Service Code WSDL // Java-based service with 1 method public class HelloWorld { public HelloWorld public String Echo(String s1) { return s1; } } In Axis, save the above as a JWS file In A JWS file must include the declaration of a single top-level public JWS level class. This is the class that defines your web service. This The name of your web service is the name of this class The // VB-based service with 1 method // public class HelloWorld public HelloWorld public Function Echo (ByVal s1 As String) as String Return s1; Return End Function End End Class In Axis, generate the WSDL with: In http://csci571b.usc.edu:9980/axis/HelloWorld.jws?wsdl http://csci571b.usc.edu:9980/axis/HelloWorld.jws?wsdl In Axis, call the service with: In http://csci571b.usc.edu:9980/axis/HelloWorld.jws?method=Echo&s1=hel http://csci571b.usc.edu:9980/axis/HelloWorld.jws?method=Echo&s1= lo%20world Copyright E. Horowitz 2007 26 WSDL example (1 method) <?xml version="1.0" encoding="UTF-8" ?> 8" <wsdl:definitions targetNamespace="http://csci571b.usc.edu:9980/axis/HelloWorld.jws" ="http://csci571b.usc.edu:9980/axis/HelloWorld.jws" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns /" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:apachesoap soap" xmlns:impl="http://csci571b.usc.edu:9980/axis/HelloWorld.jws" xmlns:impl="http://csci571b.usc.edu:9980/axis/HelloWorld.jws" xmlns:intf="http://csci571b.usc.edu:9980/axis/HelloWorld.jws" xmlns:intf xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenc /soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl /" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdlsoap /" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> xmlns:xsd <wsdl:message name="EchoResponse"> <wsdl:part name="EchoReturn" type="xsd:string" /> /> </wsdl:message> </ <wsdl:message name="EchoRequest"> <wsdl:part name="s1" type="xsd:string" /> /> </wsdl:message> </ <wsdl:portType name="HelloWorld"> <wsdl:operation name="Echo" parameterOrder="s1"> name="Echo" parameterOrder <wsdl:input message="intf:EchoRequest" name="EchoRequest" /> /> <wsdl:output message="intf:EchoResponse" name="EchoResponse" /> /> </wsdl:operation> </ </wsdl:portType> Copyright E. Horowitz 2007 27 WSDL example (cont’d) <wsdl:binding name="HelloWorldSoapBinding" type="intf:HelloWorld"> <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> transport="http:// /soap/http" <wsdl:operation name="Echo"> <wsdlsoap:operation soapAction="" /> ="" <wsdl:input name="EchoRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /soap/encoding/" namespace="http://DefaultNamespace" use="encoded" /> namespace="http:// use="encoded" </wsdl:input> </ <wsdl:output name="EchoResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /soap/encoding/" namespace="http://csci571b.usc.edu:9980/axis/HelloWorld.jws" use="encoded" /> </wsdl:output> </ </wsdl:operation> </wsdl:binding> <wsdl:service name="HelloWorldService"> <wsdl:port binding="intf:HelloWorldSoapBinding" name="HelloWorld"> <wsdlsoap:address location="http://csci571b.usc.edu:9980/axis/HelloWorld.jws" /> location="http://csci571b.usc.edu:9980/axis/HelloWorld.jws" </wsdl:port> </ </wsdl:service> </wsdl:definitions> Copyright E. Horowitz 2007 28 WSDL example (2 methods) <!-- A helloworld example with two methods: public string HelloWorld(string InputStr) public string ByeWorld(string InputStr) --> <?xml version="1.0" encoding="utf-8"?> <definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://formosa.usc.edu/webservices/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://formosa.usc.edu/webservices/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <types> <s:schema elementFormDefault="qualified" targetNamespace="http://formosa.usc.edu/webservices/"> <s:element name="HelloWorld"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="InputStr" type="s:string" /> </s:sequence> </s:complexType> </s:element> Copyright E. Horowitz 2007 29 WSDL example (cont'd) <s:element name="HelloWorldResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="HelloWorldResult" type="s:string" /> </s:sequence> </s:complexType> </s:element> <s:element name="ByeWorld"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="InputStr" type="s:string" /> </s:sequence> </s:complexType> </s:element> <s:element name="ByeWorldResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="ByeWorldResult " type="s:string" /> </s:sequence> </s:complexType> </s:element> </s:schema> </types> Copyright E. Horowitz 2007 30 WSDL example (cont'd) <message name="HelloWorldSoapIn"> <part name="parameters" element="s0:HelloWorld" /> </message> <message name="HelloWorldSoapOut"> <part name="parameters" element="s0:HelloWorldResponse" /> </message> <message name="ByeWorldSoapIn"> <part name="parameters" element="s0:ByeWorld" /> </message> <message name="ByeWorldSoapOut"> <part name="parameters" element="s0:ByeWorldResponse" /> </message> <portType name="Service1Soap"> <operation name="HelloWorld"> <input message="s0:HelloWorldSoapIn" /> <output message="s0:HelloWorldSoapOut" /> </operation> <operation name="ByeWorld"> <input message="s0:ByeWorldSoapIn" /> <output message="s0:ByeWorldSoapOut" /> </operation> </portType> Copyright E. Horowitz 2007 31 WSDL example (cont'd) <binding name="Service1Soap" type="s0:Service1Soap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <operation name="HelloWorld"> <soap:operation soapAction="http://formosa.usc.edu/webservices/HelloWorld" style="document" /> <input> <soap:body use="literal" /> </input> <output> <soap:body use="literal" /> </output> </operation> <operation name="ByeWorld"> <soap:operation soapAction="http://formosa.usc.edu/webservices/ByeWorld" style="document" /> <input> <soap:body use="literal" /> </input> <output> <soap:body use="literal" /> </output> </operation> </binding> <service name="Service1"> <port name="s0:Service1Soap" binding="typens:Service1Soap"> <soap:address location="http://formosa.usc.edu/webservices/" /> </port> </service> </definitions> Copyright E. Horowitz 2007 32 WSDL Standardization Efforts WSDL 1.1 is an OASIS standard WSDL 2.0 is a “W3C Recommendation”: http://www.w3.org/TR/wsdl20/ includes language clarifications that make it easier for developers to understand and use WSDL provides support for W3C recommendations, including XML Schemas, XML Information Set, RDF Mapping Copyright E. Horowitz 2007 33 Building Web Services Commercial Platforms Microsoft .NET http://www.microsoft.com/net IBM WebSphere http://www.ibm.com/websphere Sun J2EE http://java.sun.com/javaee/index.jsp Standards SOAP http://www.w3.org/TR/SOAP WSDL http://www.w3.org/TR/wsdl20 UDDI http://www.uddi.org ebXML http://www.ebXML.org Commercial Tools Microsoft Visual Studio http://msdn2.microsoft.com/en-us/vstudio/ IBM Rational Application Developer for WebSphere http://www306.ibm.com/software/awdtools/developer/application/index .html Sun Java Studio Enterprise http://developers.sun.com/jsenterprise/index.html Copyright E. Horowitz 2007 34 Microsoft .NET A Software Platform for building XML Web Services Spans clients, servers and services Spans Consistent programming model Consistent Interoperable via XML Web Services Interoperable Key capabilities Key Deliver software as a service Deliver Integration becomes intrinsic Integration Enable smart, service-aware systems Enable Copyright E. Horowitz 2007 35 Web Standards/Practices .NET Framework supports .NET HTML, XML, SOAP, XSLT, XPath HTML, Web services enables Internet scale distributed Web applications State-full connected model does not work State full Loosely connected web services enables Loosely scalable applications XML support is built-in deeply XML Data, remoting, serialization, documentation, Data, config Copyright E. Horowitz 2007 36 ASP.NET Web Services ASP.NET Web services supported by Visual Studio .NET development environment Copyright E. Horowitz 2007 37 Web Service in .NET The web service below exposes 2 methods (Add, SayHello) .NET web services use .asmx extension FirstService.asmx <%@ WebService language="C" class="FirstService" %> <%@ WebService %> using System; using System.Web.Services; using System.Xml.Serialization; using [WebService(Namespace="http://localhost/MyWebServices/")] public class FirstService : WebService { public FirstService WebService [WebMethod] public int Add(int a, int b) { return a + b; } int a, int [WebMethod] public String SayHello() { return "Hello World"; } } SayHello() A Web Service must be published to a web server with SOAP extensions SOAP Copyright E. Horowitz 2007 38 A Web Service Consumer In the head you define operations SayHello In WebApp.axpx and Add. <%@ Page Language="C#" %> In the body you define two text boxes to Contain two numbers to be supplied by <script runat="server"> the consumer. You also define void runSrvice_Click(Object sender, EventArgs e) { Web Service Result FirstService mySvc = new FirstService(); Hello World Service: Label1 Add Service: Label2 Label1.Text = mySvc.SayHello(); Button that calls runSrvice Label2.Text = mySvc.Add(Int32.Parse(txtNum1.Text), Int32.Parse(txtNum2.Text)).ToString(); } </script> <html> <head> </head> <body> <form runat="server"> <p> <em>First Number to Add </em>: <asp:TextBox id="txtNum1" runat="server" Width="43px">4</asp:TextBox> </p> <p> <em>Second Number To Add </em>: <asp:TextBox id="txtNum2" runat="server" Width="44px">5</asp:TextBox> </p> <p> <strong><u>Web Service Result -</u></strong> </p> <p> <em>Hello world Service</em> : <asp:Label id="Label1" runat="server" FontUnderline="True">Label</asp:Label> </p> <p> <em>Add Service</em> : & <asp:Label id="Label2" runat="server" FontUnderline="True">Label</asp:Label> </p> <p align="left"> <asp:Button id="runSrvice" onclick="runSrvice_Click" runat="server" Text="Execute"></asp:Button> </p> </form> </body> </html> Copyright E. Horowitz 2007 39 Interoperability The J2EE and Microsoft version of web services differ in some respects The Web Services-Interoperability Organization (WS-I) is an open, industry organization chartered to promote Web services interoperability across platforms. See http://www.ws-i.org/ WS-I released WS-I Basic Profile 1.1, consisting of a set of non-proprietary Web services specifications, along with clarifications and amendments to those specifications which promote interoperability. See: http://www.ws-i.org/Profiles/BasicProfile-1.1.html Copyright E. Horowitz 2007 40 Web Services Security (WS-Security) W3C XML Security Recommendations: http://www.w3.org/TR/xmldsig-core/ http://www.w3.org/TR/xmlenc-core/ W3C XML Security Working Groups: http://www.w3.org/Signature/ http://www.w3.org/Encryption/ IBM Specifications: Web Services Security (WS-Security) Version 1.0: http://www.ibm.com/developerworks/webservices/library/ws-secure/ Web Services Security Addendum (August 2002): http://www.ibm.com/developerworks/webservices/library/ws-secureadd.html OASIS Technical Committees on Web Services Security: Web Services Security: SOAP Message Security V1.0 (March 2004): http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-securi ty-1.0.pdf Web Services Security: UsernameToken Profile V1.0 (March 2004): http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-prof ile-1.0.pdf Web Services Security: X.509 Token Profile V1.0 (March 2004): http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile1.0.pdf Copyright E. Horowitz 2007 41 Example: Lets build a service interface to a mobile Example: phone retail company phone 4 steps steps 1. the service interface 1. 2. making parameters 2. 3. message and transport 3. 4. summing up 4. Copyright E. Horowitz 2007 42 1. the WSDL interface file MobilePhoneService has two methods MobilePhoneService getListOfModels() – returns an array of strings of getListOfModels modelNumbers getPrice(modelNumber) – returns the price getPrice(modelNumber Copyright E. Horowitz 2007 43 Defining Operations <?xml version="1.0" encoding="UTF-8" ?> 8" <definitions name="MobilePhoneService“ <definitions targetNamespace="www.mobilephoneservice.com/MobilePhoneService-interface" interface" xmlns=http://schemas.xmlsoap.org/wsdl/ xmlns xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" /" xmlns:tns=http://www.mobilephoneservice.com/MobilePhoneService xmlns:tns xmlns:xsd="http://www.w3.org/1999/XMLSchema"> ="http://www.w3.org/1999/XMLSchema"> <portType name="MobilePhoneService_port"> "> <operation name="getListOfModels "> <operation "> ....... ....... </operation> <operation name="getPrice"> <operation "> ....... ....... </operation> </portType> </ </definitions> </definitions> Copyright E. Horowitz 2007 44 2. making parameters Here you define parameters to send and that they will return Here <?xml version="1.0" encoding="UTF-8" ?> encoding="UTF<definitions name="MobilePhoneService" same as on previous slide> name="MobilePhoneService" same <types> <xsd:schema targetNamespace="http://www.mobilephoneservice.com/MobilePhoneService" targetNamespace="http://www.mobilephoneservice.com/MobilePhoneService" xmlns="http://www.w3.org/1999/XMLSchema/"> xmlns="http://www.w3.org/1999/XMLSchema/"> <xsd:complexType name="Vector"> <xsd:element name="elementData" type="xsd:String" /> name="elementData" type="xsd:String" <xsd:element name="elementCount" type="xsd:int" /> name="elementCount" type="xsd:int" </xsd:complexType> </xsd:complexType> </xsd:schema> </xsd:schema> </types> <message name="ListOfPhoneModels"> name="ListOfPhoneModels"> <part name="models" type="tns:Vector"> type="tns:Vector"> </message> <message name="PhoneModel"> name="PhoneModel"> <part name="model" type="xsd:String"> type="xsd:String"> </message> <message name="PhoneModelPrice"> name="PhoneModelPrice"> <part name="price" type="xsd:String"> type="xsd:String"> </message> <portType name="MobilePhoneService_port"> name="MobilePhoneService_port"> <operation name="getListOfModels "> name="getListOfModels <output message="ListOfPhoneModels"/> message="ListOfPhoneModels"/> </operation> <operation name="getPrice"> name="getPrice"> <Input message="PhoneModel"/> message="PhoneModel"/> <output message="PhoneModelPrice"/> message="PhoneModelPrice"/> </operation> </portType> </definitions> </portType> 3 parameters are defined of type vector, and two strings Port contains all operations and parameters Copyright E. Horowitz 2007 45 3. message and transport SOAP is the most popular binding technique SOAP WSDL will specify a SOAP server that has access to the actual implementation of your Web service WSDL It is SOAP's job to take the user from the WSDL file to its implementation It WSDL <binding name="MobilePhoneService_Binding" type="MobilePhoneService_port"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> /soap/http" <operation name="getListOfModels "> <operation "> <soap:operation soapAction="urn:MobilePhoneService" /> /> <input> <soap:body encodingStyle=http://schemas.xmlsoap.org/soap/encoding/ namespace="urn:MobilePhoneService" use="encoded" /> use="encoded" </input> <output> <soap:body encodingStyle=http://schemas.xmlsoap.org/soap/encoding/ namespace="urn:MobilePhoneService" use="encoded" /> use="encoded" </output> </operation> <operation name="getPrice"> <operation "> <soap:operation soapAction="urn:MobilePhoneService" /> /> <input> <soap:body encodingStyle=http://schemas.xmlsoap.org/soap/encoding/ <input> namespace="urn:MobilePhoneService" use="encoded" /> use="encoded" </input> <output> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" <output> /soap/encoding/" namespace="urn:MobilePhoneService" use="encoded" /> namespace=" use="encoded" Copyright E. Horowitz 2007 46 </output> </operation> </binding> </output> 4. summing up This WSDL file completely describes the interface of the mobile phone service. phone This WSDL file WSDL also requires the additional step of creating a summary of the WSDL WSDL creating file. WSDL calls this a an implementation file, which you will use while publishing your WSDL implementation file, use le Web service at a UDDI registry. See the next slide. See Its main features are the following: Its The root <definitions> element is exactly the same as in the WSDL interface file, The WSD interface except that the implementation file refers to a different targetNamespace, which targetNamespace which refers to your implementation file There is an <import> element that refers to the interface file of (file name There MobilePhoneService-interface.wsdl) and its namespace. and There is a <service> tag with a logical name for this service. Within the service There element is a port element that refers to the SOAP binding. binding. Copyright E. Horowitz 2007 47 5. WSDL Implementation file <?xml version="1.0" encoding="UTF-8" ?> 8" <definitions name="MobilePhoneService“ <definitions targetNamespace=http://www.mobilephoneservice.com/MobilePhoneService xmlns="http://schemas.xmlsoap.org/wsdl/" /" xmlns:soap=http://schemas.xmlsoap.org/wsdl/soap/ xmlns:soap xmlns:tns="http://www.mobilephoneservice.com/MobilePhoneService" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <import location="http://localhost:8080/wsdl/MobilePhoneService<import interface.wsdl" interface.wsdl" namespace="http://www.mobilephoneserviceservice.com/MobilePhoneServicenamespace=" interface" /> /> <service name="MobilePhoneService"> <service "> <documentation> Mobile Phone Information Service </documentation> <documentation> ation> <port binding="MobilePhoneService_Binding" <port name="MobilePhoneService_ServicePort"> name=" <soap:address location="http://localhost:8080/soap/servlet/rpcrouter" /> location="http://localhost:8080/soap/servlet/rpcrouter" </port> </service> </definitions> </definitions> Copyright E. Horowitz 2007 48 Service Oriented Model The Service Oriented Model builds on the basics of message communication The Service builds by adding the concept of action and service. Essentially, the service model action and service Essentially, allows us to interpret messages as requests for actions and as responses allows to those requests. to Copyright E. Horowitz 2007 49 Resource Oriented Model The Resource Oriented Model extends The SOA further by adding the concept of The Resource extends resource. Resources are important internally to the architecture (a Web service is resource Resources best understood as a resource in the context of Web service management and in best gement terms of policy management) and externally: resources are an important metaphor terms ortant for interpreting the interaction between a requester entity and a provider entity. requester and provider Copyright E. Horowitz 2007 50 Policy Model Copyright E. Horowitz 2007 51 ...
View Full Document

This note was uploaded on 05/12/2011 for the course CSCI 571 taught by Professor Papa during the Fall '07 term at USC.

Ask a homework question - tutors are online