Presentation is loading. Please wait.

Presentation is loading. Please wait.

Beginning 자바 웹 서비스 SOAP 강미란 Cyber-Infrastructure Research Lab Konkuk University.

Similar presentations


Presentation on theme: "Beginning 자바 웹 서비스 SOAP 강미란 Cyber-Infrastructure Research Lab Konkuk University."— Presentation transcript:

1 Beginning 자바 웹 서비스 SOAP 강미란 (meelankang@gmail.com)meelankang@gmail.com Cyber-Infrastructure Research Lab Konkuk University

2 목차 1. SOAP 이란 ? 2. SOAP 의 용도 ? 3. 장점 & 단점 4. SOAP 메시지 교환 모델 5. SOAP 메시지 구조

3 SOAP SOAP is a protocol for exchanging XML-based messages over computer networks –Normally using HTTP/HTTPS –Stands for 'Simple Object Access Protocol' SOAP is a simple XML based protocol to let applications exchange information over HTTP We will learn what SOAP is, and how it uses XML to exchange information between applications Before you study SOAP you should have a basic understanding of XML and XML Namespaces

4 What is SOAP? SOAP is a communication protocol SOAP is for communication between applications SOAP is a format for sending messages SOAP is designed to communicate via Internet SOAP is platform independent SOAP is language independent SOAP is based on XML SOAP is simple and extensible SOAP allows you to get around firewalls SOAP will be developed as a W3C standard

5 Where we are using SOAP?

6  It is important for application development to allow Internet communication between programs  Today's applications communicate using Remote Procedure Calls (RPC) between objects like DCOM and CORBA, but HTTP was not designed for this  RPC represents a compatibility and security problem; firewalls and proxy servers will normally block this kind of traffic  A better way to communicate between applications is over HTTP, because HTTP is supported by all Internet browsers and servers  SOAP was created to accomplish this  SOAP provides a way to communicate between applications running on different operating systems, with different technologies and programming languages 6 Why SOAP?

7 Advantages  Easier communication behind proxies and firewalls ◦ Using HTTP protocol  Allow different transport protocols. ◦ JMS,SMTP,RSS etc..  SOAP is platform independent.  SOAP is language independent.  SOAP is lightweight protocol. ◦ Text-based message  SOAP is simple and extensible. ◦ Structured by XML  SOAP is vender-neutral. ◦ Sun, IBM, Microsoft

8 Disadvantages  XML format is considered slower than traditional object app. ◦ When we transfer small size messages, it is fine. ◦ To improve performance: Message Transmission Optimization M echanism  Compatibility among different SOAP Toolkit ◦ Different SOAP implementation have compatibility problems. ◦ Ex. SUN vs Microsoft  Lack of Security Mechanism ◦ SOAP doesn’t have authentication procedure before processing Message ◦ SOAP doesn’t have any encryption mechanism. ◦ SOAP cannot guarantee successful message transmission.  Ex. System crash happens.  Lack of support for Publish/Subscribe Model ◦ SOAP client have to send request directly to servers.

9 4.SOAP message exchange model Simple message transfer model

10 4.SOAP message exchange model  Message Chain topologies ◦ Request/Response Model ◦ Recursive Model ◦ Broadcast Model Sender Endpoint C Endpoint B Endpoint A Sender Endpoint C Endpoint B Endpoint A SenderEndpoint(A) Request SOAP Message Response SOAP Message

11 SOAP Message Structure sblim@konkuk.ac.kr 임 상 범 11

12 SOAP message Structure A SOAP message is an ordinary XML document containing the following elements –A required Envelope element that identifies the XML document as a SOAP message –An optional Header element that contains header information –A required Body element that contains call and response information –An optional Fault element that provides information about errors that occurred while processing the message

13 All the elements above are declared in the default namespace for the SOAP envelope: –http://www.w3.org/2001/12/soap-envelope and the default namespace for SOAP encoding and data types is: –http://www.w3.org/2001/12/soap-encoding 13 SOAP message Structure

14 5. SOAP message Structure Skeleton SOAP Message

15 5. SOAP message Structure Syntax Rules –A SOAP message MUST be encoded using XML use the SOAP Envelope namespace use the SOAP Encoding namespace –A SOAP message must NOT contain a DTD reference contain XML Processing Instructions

16 SOAP Envelop Element sblim@konkuk.ac.kr 임 상 범 16

17 SOAP Envelop Element I  The SOAP Envelope Element ◦ Definition  Envelope element is the root element of a SOAP message.  Defines the XML document as a SOAP message. ◦ The xmlns:soap Namespace  must always have an Envelope element associated with the "ht tp://www.w3.org/2001/12/soap-envelope" namespace.  If a different namespace is used, the application must generate an error and discard the message ◦ The encodingStyle Attribute  Define the data types used in the document.  May appear on any SOAP element,  Apply to that element's contents and all child elements.  A SOAP message has no default encoding.

18 <soap:Envelope xmlns:soap= “ http://www.w3.org/2001/12/soap-envelope ” soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">... Message information goes here... 18 SOAP Envelop Element II

19 SOAP Header Element sblim@konkuk.ac.kr 임 상 범 19

20 SOAP Header Element I  The SOAP Header Element ◦ Optional ◦ contains application specific information  Ex. authentication, payment, etc. ◦ If the Header element is present  it must be the first child element of the Envelope element.  Three attributes in the default namespace ◦ Actor  Tell the endpoint which processes the message. ◦ mustUnderstand  If 1, the receiver must recognize the element, or return fail.  Default value is 0 ◦ encodingStyle

21 <soap:Envelope xmlns:soap= “ http://www.w3.org/2001/12/soap- envelope ” soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <m:Trans xmlns:m= “ http://www.w3schools.com/transaction/ ” soap:mustUnderstand="1">234... 21 SOAP Header Element II

22 SOAP Header Element III The example above contains a header with a "Trans" element, a "mustUnderstand" attribute value of "1", and a value of 234 SOAP defines three attributes in the default namespace ("http://www.w3.org/2001/12/soap- envelope") These attributes are: actor, mustUnderstand, and encodingStyle The attributes defined in the SOAP Header defines how a recipient should process the SOAP message

23 The actor Attribute I A SOAP message may travel from a sender to a receiver by passing different endpoints along the message path Not all parts of the SOAP message may be intended for the ultimate endpoint of the SOAP message but, instead, may be intended for one or more of the endpoints on the message path The SOAP actor attribute may be used to address the Header element to a particular endpoint soap:actor="URI"

24 The actor Attribute II <soap:Envelope xmlns:soap= “ http://www.w3.org/2001/12/soap-envelope ” soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <m:Trans xmlns:m= “ http://www.w3schools.com/transaction/ ” soap:actor="http://www.w3schools.com/appml/"> 234...

25 The mustUnderstand Attribute I The SOAP mustUnderstand attribute can be used to indicate whether a header entry is mandatory or optional for the recipient to process If you add "mustUnderstand="1" to a child element of the Header element it indicates that the receiver processing the Header must recognize the element If the receiver does not recognize the element it must fail when processing the Header soap:mustUnderstand="0|1"

26 The mustUnderstand Attribute II <soap:Envelope xmlns:soap= “ http://www.w3.org/2001/12/soap-envelope ” soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <m:Trans xmlns:m="http://www.w3schools.com/transaction/ “ soap:mustUnderstand="1"> 234...

27 SOAP Body Element sblim@konkuk.ac.kr 임 상 범 27

28  The mandatory SOAP Body element contains the actual SOAP message  The required SOAP Body element contains the actual SOAP message intended for the ultimate endpoint of the message  Immediate child elements of the SOAP Body element may be namespace- qualified  SOAP defines one element inside the Body element in the default namespace ("http://www.w3.org/2001/12/soap- envelope") 28 The SOAP Body Element I

29 The SOAP Body Element II <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope “ soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> Apples

30 The SOAP Body Element III The example above requests the price of apples Note that the m:GetPrice and the Item elements above are application-specific elements They are not a part of the SOAP standard. A SOAP response could look something like

31 The SOAP Body Element VI <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope “ soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> 1.90

32 The SOAP Fault Element I An error message from a SOAP message is carried inside a Fault element. If a Fault element is present, it must appear as a child element of the Body element A Fault element can only appear once in a SOAP message

33 The SOAP Fault Element II The SOAP Fault element has the following sub elements Sub Element Description A code for identifying the fault A human readable explanation of the fault Information about who caused the fault to happen Holds application specific error information related to the Body element

34 SOAP Fault Codes The faultcode values defined below must be used in the faultcode element when describing faults ErrorDescription VersionMismatchFound an invalid namespace for the SOAP Envelope element MustUnderstandAn immediate child element of the Header element, with the mustUnderstand attribute set to "1", was not understood ClientThe message was incorrectly formed or contained incorrect information ServerThere was a problem with the server so the message could not proceed

35 6. Summary –1.What is SOAP? Lightweight protocol for exchanging Message via internet –2.Why SOAP? can be easily implemented upon internet Have good compatibility –3.Advantages & Disadvantages –4.SOAP message exchange model –5.SOAP message Structure


Download ppt "Beginning 자바 웹 서비스 SOAP 강미란 Cyber-Infrastructure Research Lab Konkuk University."

Similar presentations


Ads by Google