store-and-forward(1)_第1页
store-and-forward(1)_第2页
store-and-forward(1)_第3页
store-and-forward(1)_第4页
store-and-forward(1)_第5页
已阅读5页,还剩171页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Web ServicesChapter 281Web Basics2InternetCollection of physically interconnected computers.Messages decomposed into packets.Packets transmitted from source to destination using a store-and-forward technique.Routing algorithm directs packets to destination3Connection-Oriented ProtocolPrior to transm

2、ission: connection is established between source and destination. Each maintains state information:Sequence numbers, acknowledgements provide reliabilityguarantee that packet loss or duplication will be detectedpackets arrive in the order they were sentBuffers, flow control algorithm guarantee trans

3、mission rate appropriate to both sender and receiverDestination addressCharacteristics of connection (e.g., out-of-band messages)Transmission Control Protocol (TCP) is connection-oriented.Problem: Overhead of setting up & taking down connection.4Hypertext Transfer Protocol (HTTP)A high level protoco

4、l built on top of a TCP connection for exchanging messages (with arbitrary content)Each (request) message from client to server is followed by a (response) message from server to client.Facilitates remote invocation of methods on the server.Web: A set of client and server processes on the Internet t

5、hat communicate via HTTP.5Protocol StackHTTPTCPLink LevelProtocolProtocol for tranmitting packets between neighboring nodesNetwork LevelProtocolEnd-to-end protocolAdded features to supportclient interactions (reliabilityflow control, .)6Clients and ServersClient: browser capable of displaying HTML p

6、ages.Web Server: stores pages for distribution to clients.Pages identified by Uniform Resource Locator (URL).: protocol to be used to communicate with host.Example - http, ftp: Directory server translates this into the hosts internet addressExample becomes 32: name of file on host.:/7HTTP Request Fo

7、rmatStart line: CrLfFollowed by: *Followed by: CrLfFollowed by: = GET | HEAD | POST | PUT | . = HTTP/1.1 | .there canbe severalheader lines8Request MethodsGET: response body contains data identified by argument URLHEAD: response header describes data identified by argument URL (no response body)Use:

8、 has page changed since last fetched?PUT: request body contains page to be stored at argument URL9Request MethodsDELETE: delete data at argument URLPOST: request body contains a new object to be placed subordinate to object at argument URLUse: adding file to directory named by URLUse: information en

9、tered by user on displayed formOthers .10HTTP Request Format = : CrLf = From | - senders e-mail addressAccept | - acceptable response formatsUser-Agent | - identifies requestors programSOAPAction - identifies SOAP processor to receive message (if data is a SOAP message) If-Modified-Since | - send do

10、cument only if modified since (used with GET)Content-Type | - type of data (application/soap+xml for SOAP)Host | - destination host = ASCII text (default)11Simple Client / Server Interaction I1. User supplies URL (clicks on link) http:/items/printers.html2. Browser translates () to host_internet_add

11、ress (using name server)3. Browser assumes a port number of 80 for http (if no port is explicitly provided as part of ) Program at port 80 interprets http headers12Simple Client / Server Interaction I4. Browser sets up TCP connection to at (host internet address, 80)5. Browser sends http message GET

12、 items/printers.html HTTP/1.0 over connection 13HTTP ResponseStatus line: CrLfFollowed by: *Followed by: 14HTTP Response = 3 digitsEx: 2xx - success 4xx - bad request from client 5xx - server failed to fulfill valid request = explanation for human reader = : CrLf = Allowed |- methods supported by UR

13、L Date | - creation date for response Expires |- expiration date for data Last-Modified |- creation date for object Content-Length | Content-Type | .15Simple Client/Server Interaction I6. Server sends response message with requested html page to browser7. Server releases TCP connection (stateless)8.

14、 Browser receives page and displays itHTTP/1.0 200 Document followsDate: Content-Type: text/htmlContent-Length: integerExpires: datehtml document items/printers.html goes here16Simple Client/Server Interaction II1. Page displayed by browser is a form with tag2. Client fills input boxes3. If METHOD=G

15、ET, client sets up connection to and sends http request: Values in input boxes encoded as suffix. Since ACTION designates a servlet, server invokes placeorderGET /servlets/placeorder?name1=value1&name2=value2 HTTP/1.0 17Simple Client / Server Interaction II4. If METHOD=POST, client sends http reques

16、t invoking POST to ; data contains values in input boxes.POST /servlets/placeorder HTTP/1.0Content-Type: text/.Content-Length: 54321Printer=HP660&Name=Art+Bernstein18HyperText Transfer Protocol (HTTP 1.1)1. Client sets up TCP connection to server named in URL2. Client sends a request3. Client receiv

17、es a response4. If (server has not disconnected) goto 2 else goto 1 - Only actively used connections are maintained19SOAPVersion 1.220What is SOAP?The de facto standard for Web Service communication that provides support for:Remote procedure call (RPC) to invoke methods on serversMessaging to exchan

18、ge documentsExtensibilityError handlingFlexible data encodingBinding to a variety of transports (e.g., SOAP, SMTP)We will discuss Version 1.221HTTP BindingA SOAP message must be carried by some transport protocolHTTP is frequently used for this purposeMessage is the data part of a request invoking P

19、OSTPOST /fareService/getFareOp HTTP/1.1Host: www.SlowHContent-Type: application/soap+xmlContent-Length: xxxSOAPAction: yyy ! the SOAP message goes here 22SOAP and XMLSince XML is language and platform independent, it is the lingua franca for the exchange of information in a heterogeneous distributed

20、 system.SOAP supports the transmission of arbitrary XML documentsFor RPC, SOAP provides a message format for invoking a procedure and returning results in XML23SOAP MessageMessage BodyHeader BlockHeader BlockSOAP BodySOAP HeaderSOAP Enveloperequiredoptional24SOAP Envelope /2003/05/soap-envelope iden

21、tifies a name space that defines the structure of a SOAP message25Using SOAPFor document exchange, the XML document being exchanged is nested directly in SOAP envelope.Referred to as document-style SOAPConversational mode of message exchangeFor RPC, SOAP defines the format of the body of messages to

22、 be used for invocation and response.Referred to as RPC-style SOAPUses a request-response patternParameters are passed by value/result26RPC Request Message IBM Client invocation of procedure:public Float getQuoteOp(String symbol);generates SOAP request message:27RPC Response Message 30.45 28RPC Requ

23、est/Response MessagesConventions:Name of the request structure is same as method name.Name of response structure is same as method name concatenated with “Response”Name and order of in and in/out parameters in request structure same as name and order in signatureValue of method (if returned) is firs

24、t child element of response structure; out and in/out parameters follow, their name and order same as name and order in signature29Data EncodingProblem: SOAP provides a language/platform independent mechanism for invoking remote proceduresArgument values are carried in an XML documentCaller and call

25、ee may use different representations of the same types (e.g., Java, C)A mechanism is needed for mapping from callers format to XML syntax and from XML syntax to callees format (referred to as serialization/deserialization)Example: mapping a Java array to XML syntax30SerializationSerialization is sim

26、ple for simple types (integer, string, float,) since they correspond to XML Schema types.Translate from binary to ASCII using XML schema specified formatSerialization not so simple for complex typesEx: What tags will be used for an array? Will it be stored by rows or by columns? How will a sparse ar

27、ray be sent?31Encoding StyleencodingStyle attribute used to identify the serialization rules to encode the data contents of an elementAn arbitrary set of rules can be usedSOAP defines its own set of rulesMessage is referred to as RPC/encodedRPC refers to the format of the message as a wholeEncoded r

28、efers to the fact that argument values have been represented using the rule set specified in the encoding style attribute32SOAP Encoding StyleSOAP defines its own graphical data model for describing complex types and rules for transforming instances of the model into serialized ASCII stringsVendors

29、provide serializers (and deserializers) which maps each local type to an instance of the model and then transforms the local representation to the encoded data using the SOAP rules33Data Encoding IBM 34SOAP ExtensibilityA SOAP message goes from client to server to advance some application related ca

30、use.It is often the case that some orthogonal issues related to the message must be handled:Security: encryption, authentication, authorizationTransaction managementTracingLogging35IntermediariesTo support scalability and decentralization, these issues need not be handled by the server.Intermediarie

31、s between client and server are usedIntermediaries perform orthogonal services as the message passes along a routeintermediaryintermediaryclientserver36ExampleclientProxy/gatewaypurchasingserveraccountingserverinventoryserverMessage addressed to Proxy.Contains target dept (purchasing), client name,

32、password, and request body.Proxy performs authentication.Message addressed to target dept.Contains authenticated Id and request body.Target department services the request.37RequirementsInformation directed to each intermediary and to final destination kept separateIntermediaries can be easily added

33、/deleted, route changedSOAP does not specify how routing is to be doneIt is up to each node along the chain to know where to send the message nextInformation carried in the message may direct routing38HeaderSOAP envelope defines an optional header containing an arbitrary number of header blocks. Eac

34、h block:Has an optional role and should be processed by an intermediary that can perform that roleCan have its own namespace declarationEliminates the possibility of interference between groups that independently design headers.39Example Message Sent by ClientPOST /purchasing/retailSale HTTP/1.1 - m

35、ethod invoked at final destinationHost: - initial destination intermediary . - this header better be processedpurchasing - identifies next node - this header better be processed madonna xxxxxx 40Processing ModelAn intermediary has an assigned set of rolesOn receiving a message, it identifies the blo

36、cks whose role attribute matches an element of its set (or has value next)A block without a role attribute is targeted for final destinationThe intermediary can modify/delete its block can insert new blocksshould retarget the message to the next destinationcan do anything (frowned upon)41Must Unders

37、tandAn intermediary can choose to ignore a block directed to itIf mustUnderstand attribute has value “true” intermediary must process the block or else abort the message and return a fault message42Example Message Sent by ProxyPOST /purchasing/retailSale HTTP/1.1 - method invoked at destinationHost:

38、 - initial intermediary . - this block better be processed by - destination (no role specified) 122334 - same body43Example Message Sent by ProxyProxy has deleted the two headersVerified that user is valid using and and determined IdRetargeted message to final destination using Proxy has inserted a

39、new header containing IdFinal destination uses Id to determine authorization44WS-AddressingProblem: As described up to this point destination address (including target SOAP processor) is not included in SOAP messageThis information is contained in transport header (e.g., SOAPAction header in HTTP)In

40、formation has to be supplied separately to the transport and the mechanism for doing this is different for different transportsSOAP is not transport-neutral45WS-AddressingSolution: Include the information in SOAP header blocks.WS-Addressing is defined for this purpose: - destination URL - message in

41、tent (analogous to SOAPAction) - unique Id - address for reply - Id of another message.46WS-AddressingThe type EndpointReferenceType is defined to carry references to endpoints (e.g., value of ReplyTo)Contains destination address as well as additional information that might be needed to send a messa

42、ge to that address:Identity of WSDL elements describing destination (port type, service,.)Policy information (e.g., should message be encrypted)47SOAP FaultsSOAP provides a message format for communicating information about errors containing the following information:Fault category identifies error

43、(not meant for human consumption) VersionMismatchMustUnderstand related to headersSender problem with message contentReceiver error had nothing to do with the messagehuman readable explanationnode at which error occurred (related to intermediaries)application specific information about Client error4

44、8Embedding SOAP in HTTP: POSTFor document-style SOAP, the envelope is the body of an HTTP POST.The HTTP response message simply acknowledges receipt of HTTP request messsageFor RPC-style SOAP, the envelope containing the SOAP request is the body of an HTTP POST; the envelope containing the SOAP resp

45、onse (or fault) is the body of the corresponding HTTP response.49Embedding RPC-style SOAP in HTTPPOST /StockQuote HTTP/1.1Content-Type: text/xmlContent-Length: . IBM 50Embedding Soap in HTTP: GETIn some situations the client simply wants to retrieve an XML documentAn HTTP GET request message is sent

46、 with no data (no SOAP content)Document (actually a SOAP envelope) is returned as the data in the HTTP response51Web Services Description Language (WSDL)Version 1.152Goals of WSDLDescribes the formats and protocols of a Web Service in a standard wayThe operations the service supports The message(s)

47、needed to invoke the operationsThe binding of the messages to a communication protocolThe address to which messages should be sent53WSDL DescriptionA Web Service is described at both the abstract and concrete levelsAbstract Level (corresponds to portType Description Language)What are the operations

48、that are supported?What messages are needed to invoke the operations?Concrete LevelHow are the messages bound to a transport protocol?What is the Web address to which the messages should be sent?54WSDL Abstract Level At the abstract level, obtaining a service is like executing a method of an objectW

49、SDL defines the following elementsAn portType is like an object; it consists of a set of operationsAn operation is like a method; it is invoked by messagesA message is composed of partsA part is like a parameter and has an associated type55Example gs is the target namespace of the document containin

50、gthis declaration and the message declarations56PatternsThe messages exchanged when an operation is invoked conform to a patternWSDL 1.1 has defined two patterns:Request/responseInput sent by requestor, output produced by serviceRequestor might wait for response (e.g., RPC) or might notChoice is a f

51、unction of how operation is used and would be specified at a higher levelOne-wayInput sent by requestor, no response expected57 FaultsRequest/response pattern allows a fault message to replace the output message if server detects a faultOne-way pattern does not allow fault message58Example Message D

52、efinitions 59Parts of a MessageA message can have many partsEach part can be bound to a different position within the physical message sent by the transportWith SOAP parts can be distributed over body and header blocksEach part can have a simple or complex type defined in an XML schema60Example 61Co

53、ncrete LevelThe concrete level defines how portTypes and operations are bound to transports and addressesA given portType can be bound to several different transports and addressesA Web Service might support a portType using several different transportsFor example, the operations can be invoked usin

54、g SOAP over either HTTP or SMTPThe same portType might be supported by several different Web Services using the same or different transportsIn all of these cases, semantically identical service should be provided at each address62Concrete Level At the concrete level, WSDL defines the following eleme

55、ntsA binding describes how the messages of a portType are mapped to the messages of a particular transportAn port maps a binding to a Web addressA service is a collection of ports that host related portTypes63Example Service and port identifiesbinding64WSDL ExtensibilityA binding maps a portType to

56、a particular transportIt must be capable of targeting a variety of transportsEach transport has its own idiosynchrosiesWSDL is extended by introducing a different namespace for each transport introduce SOAP namespace65Example RPC/encoded SOAP Binding Continued on next slideidentifiesportTypeSOAPexte

57、nsionsrpc stylemsgencodeparametersencodingrulesfor tags used inmesssage66Binding Example - Continued 67RPC/encoded Message IBM 68EncodingProblem: Serializer serializes arguments (parts) in accordance with rules specified by encodingStyle attributeReceiver can deserialize arguments since style is spe

58、cified in the messageBut message has a declared typeHow can we be sure that the rules produce an instance of the type?In fact they might not!69Example Encoding StyleSuppose there are n arguments of the same type.Serializer might produce a message containing n instances of the type.But suppose in a p

59、articular invocation all arguments have same value.Serializer might produce a message containing n pointers to a single instance of the value.Then the value of each argument (a pointer) is not an instance of the type!70Encoded Vs. LiteralIf use=“encoded”, arguments are encoded in accordance with the

60、 specified encoding styleIf use=“literal”, arguments are instances of part types specified in the message declarationYields two distinct styles for invoking a remote procedure:rpc/encodedrpc/literal71Example RPC/literal SOAP Binding . identifiesportTyperpc stylemsgdont encodeparameters72RPC/literal

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论