1 / 32

SOAP

SOAP. Simple Object Access Protocol. Apakah SOAP?. Saat ini web adalah komunikasi antara manusia dan aplikasi. SOAP adalah komunikasi aplikasi ke aplikasi SOAP adalah lightweight protocol untuk pertukaran informasi yg terstruktur dalam lingkungan desentralisasi dan terdistribusi.

zulema
Download Presentation

SOAP

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SOAP Simple Object Access Protocol

  2. Apakah SOAP? • Saat ini web adalah komunikasi antara manusia dan aplikasi. • SOAP adalah komunikasi aplikasi ke aplikasi • SOAP adalah lightweight protocol untuk pertukaran informasi yg terstruktur dalam lingkungan desentralisasi dan terdistribusi. • SOAP menggunakan XML technologies dalam mendefinisikan framework messagingnya • framework ini dirancang independen terhadap berbagai model programming

  3. SOAP adalahcommunication protocol • SOAP adalah a format untuksending messages • SOAP dirancang untuk komunikasivia Internet • SOAP adalahplatform independent • SOAP adalahlanguage independent • SOAP adalahsimple and extensible • SOAP bisa melewati firewalls • SOAP adalahW3C standard

  4. SOAP Architecture • Spesifikasi SOAP terdiri dari 4 bagian: • SOAP envelope: menjelaskan format dari SOAPmessage. • SOAP encoding: menggambarkan dari representasi data yang dikirim dalam sebuah pesan. • SOAP RPC: mendefinisikan bagaimana SOAP message dapat mengeksekusi remote procedure calls (RPCs). • SOAP binding framework: mendefinisikan protocol yang digunakan SOAP messages yang dikirim oleh aplikasi.

  5. One way message

  6. Request response

  7. SOAP format • SOAP message terdiri dari tiga bagian: • SOAP Envelope • SOAP Header (optional) • SOAP Body

  8. Contoh apache 4 Apache SOAPservice:HelloService.java sayHello(“Yuhong”,”Yan) “Yuhong Yan, Welcome to SOAP…” 3 Apache SOAP client: HelloClient.java Apache SOAP rpcrouter servlet 1 SOAP request:Service name: urn:HelloWorldMethod name: sayHelloParameter: firstName=“Yuhong” lastName=“Yan 2 Jakarta Tomcat server 5 SOAP response: Return value: “Yuhong Yan, welcome to SOAP” Http POST Http GET

  9. SOAP Envelope • SOAP Envelope mendefinisikan keseluruhan framework untuk menjawab • apa yang didalam message dan • siapayang terlibat • Envelope adalah top element dari XML document yang perepresentasikan message. • Envelope element selalu menjadi root element dari SOAP message. • Envelope element terdiri dari • optional Header element • Dan mandatory Body element.

  10. SOAP Envelope Code <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <!-- optional --> <!-- header blocks go here... --> </soap:Header> <soap:Body> <!-- payload or Fault element goes here... --> </soap:Body> </soap:Envelope>

  11. Envelope element penggunaan xmlns:soap namespace selalu menggunakan http://www.w3.org/2001/12/soap-envelope

  12. EncodingStyle • SOAP encodingStyle attribute digunakan untuk mendefinisikan type data yang digunakan dalam dokumen. • attribute ini bisa muncul pada setiap SOAP element, dan berpengaruh hanya pada elemen tersebut dan childnya • SOAP message tidak mempunyai default encoding.

  13. SOAP Header • Header element adalah generic container untuk informasi kontrol • Bisa berupabeberapa elements dari beberapa namespace • Header berisi informasiproses dari message • Header adalah optional

  14. SOAP Header <soap:Header> <!-- security credentials --> <s:credentials xmlns:s="urn:examples-org:security"> <username>dave</username> <password>evad</password> </s:credentials> </soap:Header>

  15. Body • Elemen body menjelaskan messagenya <soap:Body> <x:TransferFunds xmlns:x="urn:examples-org:banking"> <from>22-342439</from> <to>98-283843</to> <amount>100.00</amount> </x:TransferFunds> </soap:Body>

  16. Contoh request SOAP Message Embedded in HTTP Request: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"  SOAPENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body>       <m:GetLastTradePrice xmlns:m="Some-URI">           <symbol>DIS</symbol>       </m:GetLastTradePrice>   </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  17. Contoh response SOAP Message Embedded in HTTP Response: <SOAP-ENV:Envelope  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>   <SOAP-ENV:Body>       <m:GetLastTradePriceResponse xmlns:m="Some-URI">           <Price>34.5</Price>       </m:GetLastTradePriceResponse>   </SOAP-ENV:Body> </SOAP-ENV:Envelope>

  18. SOAP Security • SOAP specification tidak mendefinisikan encryption untukk XML Web Services. • Diserahkan kepada implementer dari SOAP protocol. • Encryption tergantung dari transport protocol • apakah transport protocol tersebut support secure communication? • cost dari enkripsi semua data dibandingan dengan sebagian data?

  19. Contoh <%@ WebService Language="C#" Class="CreditCardService" %> using System.Web.Services; public class CreditCardService { [WebMethod] [EncryptionExtension(Encrypt=EncryptMode.Response)] public string GetCreditCardNumber() { return "MC: 4111-1111-1111-1111"; } }

  20. Request yg dienkripsi <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <GetCreditCardNumber xmlns="http://tempuri.org/" /> </soap:Body> </soap:Envelope>

  21. Response yg dienkripsi <soap:Body> <GetCreditCardNumber xmlns="http://tempuri.org/"> <GetCreditCardNumberResult>83 151 243 32 53 95 86 13 190 134 188 241 198 209 72 114 122 38 180 34 194 138 16 97 221 195 239 86 26 152 94 27 </GetCreditCardNumberResult> </GetCreditCardNumber> </soap:Body>

  22. SOAP Fault Element • Error mesage dari SOAP mesage dimasukkan kedalam Fault element. • (optional) jika Fault element ada, maka harus muncul sebagai elemen child pada Body element. • Fault element hanya muncul sekali dalam SOAPmessage.

  23. SOAP Fault Element SOAP Fault element mempunyai sub elements: • <faultcode > A code for identifying the fault • <faultstring > A human readable explanation of the fault • <faultactor > information about who caused the fault to happen URI value identifying the source • <detail> error information related only to the Body element. if not present then indicates that the fault is not related to the Body element.

  24. faultcode

  25. Contoh

  26. HTTP • HTTP communicates over TCP/IP. • An HTTP client connects to an HTTP server usingTCP. • After establishing a connection, the client can send anHTTP request message to the server: POST /item HTTP/1.1 Host: 189.123.345.239 Content-Type: text/plain Content-Length: 200

  27. HTTP • The server then processes the request and sends anHTTP response back to the client. • The response contains a status code that indicates thestatus of the request:

  28. SOAP HTTP Binding • A SOAP method is an HTTP request/response thatcomplies with the SOAP encoding rules. HTTP + XML = SOAP • A SOAP request could be an HTTP POST or anHTTP GET request. • POST -- Send • GET -- Retrieve

  29. SOAP request and response • The Content-Type header for a SOAP request andresponse defines • the MIME type for the message and • the character encoding (optional) • used for the XML body of the request orresponse.

  30. SOAP request and response • The Content-Length header for a SOAPrequest and response specifies the number ofbytes in the body of the request or response.

  31. Contoh • GetStockPrice request is sent to a server. The request has a StockNameparameter, and a Price parameter will be returned in the response. Thenamespace for the function is defined in http://www.example.org/stockaddress. • The SOAP request:

More Related