Your SlideShare is downloading. ×
0
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Simple Object Access Protocol
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Simple Object Access Protocol

3,880

Published on

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,880
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
379
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Simple Object Access Protocol (SOAP)
    Enterprise Modeling
    3/16/2009
    1
  • 2. Team Members
    V. Dinusha
    S. Saatviga
    S.Y.Y.D. Wickramasinghe
    D. Wijethilake
    3/16/2009
    2
  • 3. Contents
    3/16/2009
    3
    Introduction
    SOAP
    SOAP Elements
    SOAP Syntax
    SOAP Envelope
    SOAP Header
    SOAP Body
    SOAP Fault
    SOAP Http Binding
    Example
    Conclusion
    Reference
  • 4. Introduction
    3/16/2009
    4
    SOAP is a communication protocol
    Lets applications exchange information over HTTP.
    Communication between applications via internet
    Format for sending messages
    Independence
    Platform
    Language
    Based on XML, yet simple and extensible
    Today’s Apps Communicate using RPC (DCOM , CORBA)
    RPC represents a compatibility and security problem. firewalls and proxy servers will normally block this kind of traffic.
    Better way is to communicate through HTTP that is supported by all Internet browsers and servers.
  • 5. SOAP Elements
    3/16/2009
    5
    A SOAP message is an ordinary XML Document
    Envelope - Identifies the XML document as a SOAP message
    Header - Contains header information
    Body - Contains call and response information
    Fault - Contains errors and status information
  • 6. SOAP Syntax
    3/16/2009
    6
    A SOAP message MUST
    Be encoded using XML
    Use the SOAP Envelope namespace
    Use the SOAP Encoding namespace
    Not contain a DTD reference
    NOT contain XML Processing Instructions
    Skeleton SOAP Message
    <?xml version="1.0"?>
    <soap:Envelope
    xmlns:soap=http://www.w3.org/2001/12/soap-envelope soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
    <soap:Header> ….. </soap:Header>
    <soap:Body>
    <soap:Fault> ... ... </soap:Fault>
    </soap:Body>
    </soap:Envelope>
  • 7. SOAP Envelope
    3/16/2009
    7
    The root element of a SOAP message
    Defines the XML document as a SOAP message
    xmlns:soap Namespace
    Defines the Envelope as a SOAP Envelope.
    Different namespace
    The application generates an error
    Discards the message
    encodingStyle Attribute
    Defines the data types used in the document.
    May appear on any SOAP element
    Will apply to element's contents and all child elements
    A SOAP message has No default encoding
    <?xml version="1.0"?>
    <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 ...
    </soap:Envelope>
  • 8. SOAP Header
    3/16/2009
    8
    Optional & If present - Must be the first child element of the Envelope
    Application-specific information of the SOAP Message
    Authentication, Payment, etc.
    All immediate child elements of Header must be namespace-qualified
    Attributes – Defines how a recipient should process the SOAP message
    mustUnderstand Attribute
    Is Header entry Mandatory/Optional for the recipient to process?
    <?xml version="1.0"?>
    <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
    <soap:Header>
    <m:Trans xmlns:m="http://www.w3schools.com/transaction/" soap:mustUnderstand="1“ >234
    </m:Trans>
    </soap:Header>
    ... ...
    </soap:Envelope>
  • 9. SOAP Header cont.
    3/16/2009
    9
    actorAttribute
    Addresses the Header element to a specific endpoint
    encodingStyleAttribute
    Defines data types used in the document
    May appear on any SOAP element
    Will apply to that element's contents and all child elements
    A SOAP message has no default encoding
    <?xml version="1.0"?>
    <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
    <soap:Header>
    <m:Trans xmlns:m="http://www.w3schools.com/transaction/" soap:actor="http://www.w3schools.com/appml/" >234
    </m:Trans>
    </soap:Header>
    ... ...
    </soap:Envelope>
  • 10. SOAP Header cont.
    3/16/2009
    10
    actorAttribute
    Addresses the Header element to a specific endpoint
    encodingStyleAttribute
    Defines data types used in the document
    May appear on any SOAP element
    Will apply to that element's contents and all child elements
    A SOAP message has no default encoding
    soap:encodingStyle="URI"
    <?xml version="1.0"?>
    <soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
    <soap:Header>
    <m:Trans xmlns:m="http://www.w3schools.com/transaction/" soap:actor="http://www.w3schools.com/appml/" >234
    </m:Trans>
    </soap:Header>
    ... ...
    </soap:Envelope>
  • 11. SOAP Body
    3/16/2009
    11
    The actual SOAP message for the ultimate endpoint of the message
    Immediate child elements may be namespace-qualified
    Request
    Response
    <?xml version="1.0"?>
    <soap:Envelope
    xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
    <soap:Body>
    <m:GetPrice xmlns:m="http://www.w3schools.com/prices"> <m:Item>Apples</m:Item>
    </m:GetPrice>
    </soap:Body>
    </soap:Envelope>
    <?xml version="1.0"?>
    <soap:Envelope
    xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
    <soap:Body>
    <m:GetPriceResponse xmlns:m="http://www.w3schools.com/prices">
    <m:Price>1.90</m:Price>
    </m:GetPriceResponse>
    </soap:Body>
    </soap:Envelope>
  • 12. SOAP Fault
    3/16/2009
    12
    Optional yet indicates Error Messages
    Must appear as a child element of the Body
    Can only appear once in a SOAP message
    Sub elements:
    <faultcode>  Code for identifying the fault
    VersionMismatchFound  An invalid namespace for the SOAP Envelope
    MustUnderstand Immediate Header child element not understood (mustUnderstand -"1")
    Client Message was incorrectly formed /contained incorrect info
    Server Message not proceed due to server error
    <faultstring>  A human readable explanation of the fault
    <faultactor> Who caused the fault
    <detail>  Application specific error information related to the Body
  • 13. SOAP Http Binding
    3/16/2009
    13
    Http
    HTTP communicates over TCP/IP
    An HTTP client connects to an HTTP server using TCP
    After establishing a connection, client can send an HTTP request to server
    The server then processes the request and sends an HTTP response back to the client.
    The response contains a status code that indicates the status of the request
    If the server could not decode the request, it could have returned an error message
    POST /item HTTP/1.1
    Host: 189.123.345.239
    Content-Type: text/plain
    Content-Length: 200
    200 OK Content-Type: text/plain Content-Length: 200
    400 Bad Request Content-Length: 0
  • 14. SOAP Http Binding cont.
    3/16/2009
    14
    SOAP = HTTP + XML
    A SOAP method
    HTTP request/response
    Complies with the SOAP encoding rules
    A SOAP request
    HTTP POST (Specifies at least two HTTP headers [Type, Length])
    HTTP GET
    Content-Type
    Optional
    MIME type for the message
    Character encoding (used for the XML body of the request/response)
    Content-Length
    The number of bytes in the body of the request/response
    POST /item HTTP/1.1
    Content-Type: application/soap+xml; charset=utf-8 Content-Length: 250
  • 15. SOAP Http Binding cont.
    3/16/2009
    15
    SOAP = HTTP + XML
    A SOAP method
    HTTP request/response
    Complies with the SOAP encoding rules
    A SOAP request
    HTTP POST (Specifies at least two HTTP headers [Type, Length])
    HTTP GET
    Content-Type
    Optional
    MIME type for the message
    Character encoding (used for the XML body of the request/response)
    Content-Length
    The number of bytes in the body of the request/response
    POST /item HTTP/1.1
    Content-Type: application/soap+xml; charset=utf-8 Content-Length: 250
  • 16. Example
    import java.util.Calendar;
    import java.util.GregorianCalendar;
    import javax.jws.WebService;
    @WebService(name = "GetDatesWS", serviceName = "GetDatesWS")
    public class GetDates {
    public GetDates() {
    }
    public Calendar getDate()
    {
    return Calendar.getInstance();
    }
    public Calendar getDateHence( intdaysHence)
    {
    GregorianCalendarmyCalendar = new GregorianCalendar();
    myCalendar.add(GregorianCalendar.DATE, daysHence);
    return myCalendar;
    }
    }
  • 17. SOAP Binding
  • 18. GetDate()
    <soap:Envelopexmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body xmlns:ns1="http://datespackage/"> <ns1:getDate/>
    </soap:Body>
    </soap:Envelope>
  • 19. Invoke GetDate()
    <env:Envelope  xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"  xmlns:xsd="http://www.w3.org/2001/XMLSchema"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:ns0="http://datespackage/"> <env:Body>  <ns0:getDateResponse>   <ns0:return>2009-03-16T20:05:24.578+05:30</ns0:return>  </ns0:getDateResponse> </env:Body>
    </env:Envelope> 
  • 20. GetDateHence(intnoOfDays)
    <soap:Envelopexmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body xmlns:ns1="http://datespackage/"> <ns1:getDateHence>
    <ns1:daysHence> 5 </ns1:daysHence> </ns1:getDateHence>
    </soap:Body>
    </soap:Envelope>
  • 21. Invoke GetDateHence(intnoOfDays)
    <env:Envelope  xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"  xmlns:xsd="http://www.w3.org/2001/XMLSchema"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:ns0="http://datespackage/"> <env:Body>  <ns0:getDateHenceResponse>   <ns0:return>2009-03-21T20:09:41.531+05:30</ns0:return>  </ns0:getDateHenceResponse> </env:Body>
    </env:Envelope>
  • 22. Conclusion
    3/16/2009
    22
    SOAP is a communication protocol
    SOAP = Http + XML
    Platform & Language Independent
    Able to penetrate firewalls
    Elements:
    Envelope
    Header
    Body
    Fault
  • 23. Reference
    3/16/2009
    23
    http://www.w3schools.com/soap/default.asp
    http://www.onjava.com/pub/a/onjava/2002/02/27/tomcat.html?page=1
    http://www.scottnichol.com/apachesoapinstall.htm
    http://www.oracle.com/technology/obe/obe1013jdev/ws/wsandascontrol.htm
  • 24. Thank You !
    3/16/2009
    24

×