SlideShare une entreprise Scribd logo
1  sur  20
Dec 7, 2007




Can you read this? If not, please sit closer. Thank you.
XML RPC (1998)
Early SOAP (2000) “section 5 encoding”
<?xml version="1.0"?>
<soap-env:envelope
    soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema"
    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
        <soap-env:header>
                ...
        </soap-env:header>
        <soap-env:body>
                <m:doSomeWork xmlns:m="http://www.lab49.com/">
                       <foo xsi:type="xsd:int">40</foo>
                       <bar>-12.53</bar>
                </m:doSomeWork>
        </soap-env:body>
</soap-env:envelope>


<?xml version="1.0"?>
<soap-env:Envelope
    soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema"
    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
        <soap-env:body>
                <m:doSomeWorkResponse xmlns:m="http://www.lab49.com/">
                       <soap-enc:array soap-enc:arrayType="xsd:ur-type[2]">
                              <baz xsi:type="xsd:int">12345</baz>
                              <quux xsi:type="xsd:string">Something here</quux>
                       </soap-enc:array>
                </m:doSomeWorkResponse>
        </soap-env:Body>
</soap-env:Envelope>
SOAP fancy encoding rules
References:
       <e:Book>
             <title>My Life and Work</title>
             <author href="#Person-1"/>
       </e:Book>

       <e:Person id="Person-1">
             <name>Henry Ford</name>
             <address href="#Address-2"/>
       </e:Person>

       <e:Address id="Address-2">
             <email>mailto:henryford@hotmail.com</email>
            <web>http://www.henryford.com</web>
       </e:Address>



Sparse arrays:
      <SOAP-ENC:Array SOAP-ENC:arrayType="xsd:string[,][4]">
           <SOAP-ENC:Array href="#array-1" SOAP-ENC:position="[2]"/>
      </SOAP-ENC:Array>

      <SOAP-ENC:Array id="array-1" SOAP-ENC:arrayType="xsd:string[10,10]">
           <item SOAP-ENC:position="[2,2]">Third row, third col</item>
           <item SOAP-ENC:position="[7,2]">Eighth row, third col</item>
      </SOAP-ENC:Array>
Document/literal (2003): Forget all the fancy encoding rules



<?xml version="1.0"?>
<soap-env:envelope
   soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
   xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
   xmlns:xsd="http://www.w3.org/1999/XMLSchema"
   xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
     <soap-env:header>
           ...
     </soap-env:header>
     <soap-env:body>
          … your XML Schema compliant document goes here …
     </soap-env:body>
</soap-env:envelope>
I want my, I want my RPC (rpc/literal)

    <?xml version="1.0"?>
    <soap-env:envelope
        soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
        xmlns:xsd="http://www.w3.org/1999/XMLSchema"
        xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
           <soap-env:header>
                  ...                                                        Namespace does not
           </soap-env:header>                                                have to be the same
           <soap-env:body>
                  <m:doSomething xmlns:m=“http://lab49.com/”>
                                                                             as the parameter values
                          <foo>
                                 … XML Schema compliant value…
                                 … XML Schema compliant value…
                                 …
                          </foo>                                             Argument elements don’t
                          <bar>                                              even have a namespace
                                 … XML Schema compliant value…
                                 …
                          </bar>
                  </m:doSomething>
           </soap-env:body>
    </soap-env:envelope>


Lets you model procedure calls, but can’t validate SOAP body with an XML Schema
SOAP encoding convention line-up circa 2003


1.   RPC/encoded (the original)

2.   Document/literal (based on XML Schema, but doesn’t model RPC)

3.   RPC/literal (adds RPC modeling, breaks XML Schema validation)




Can’t we model RPC without breaking Schema validation?
Wrapped document literal style (2005)

<?xml version="1.0"?>
<soap-env:envelope
    soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema"
    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
       <soap-env:header>
              ...
       </soap-env:header>
       <soap-env:body>
              <m:doSomething xmlns:m=“http://lab49.com/”>
                      <m:foo>
                             …                                  Entire body complies with an XML Schema
                      </m:foo>
                      <m:bar>
                                                                containing element doSomething containing
                             …                                  a sequence of elements foo and bar
                      </m:bar>
              </m:doSomething>
       </soap-env:body>
</soap-env:envelope>
Handy summary


   Scheme         Rating   Why?

 rpc/encoded               Because “encoded” means “section 5 encoding” and that hairy
                   BAD
    (1998)                 scheme has been displaced by XML Schemas
  doc/literal              Send an XML Schema compliant document, get one back.
                  BEST
    (2003)                 Awesome.
  rpc/literal
                   BAD     Failed attempt to reconcile document style with RPC.
    (2003)
wrapped/literal
                  GOOD     Successful attempt to reconcile document style with RPC.
    (2005)
Web Service Definition Language (WSDL 1.1)
                           Wrapped style. Notice the operation
                           has one message part called “parameters”
                           which is an XML sequence of the args
WSDL IS IMPORTANT
Code first / WSDL first decision algorithm
                                                                                          Write code first and
                                                                                          use doc/literal style.
              Will other projects                                                          i.e. Every method
                                             No           Are you in a               No
                be using these                                                              has one arg. Use
              services? i.e. is this                      great hurry?                    annotations to name
               part of an SOA?                                                               everything and
                                                                                                  review
                                                                                           WSDL afterward.

                                                            Yes
                  Yes
                                                        Write code first in
                                                   wrapped/literal style, i.e. Use
                                                  annotations to name everything
                                                   and review WSDL afterward.
           Write WSDL first.
 Think through interfaces carefully, plan
 for backward compatibility, write lots of
comments, and maintain in source control.
Goodies



• WS-Security (message integrity, confidentiality, and authentication)

• WS-ReliableMessaging

• WS-Routing (messaging patterns and routes)

• WS-Eventing (pub/sub)

• Many other incomprehensible extensions, collectively referred to as WS-*
The SOAP way of thinking
In the meantime…
Will SOAP collapse under its own weight?
Complexity

Low                              High




                          SOAP


                 ?
      REST
Comparison points
• WSDL is a good idea for both SOAP and REST
   (not a long-term differentiator)

• SOAP and REST both allow you to name resources with URIs
   (also not a long-term differentiator)

• REST adds value to the entire web
   (we don’t care)

• REST is easier to program
   (not for long)

• SOAP provides better support for async messaging

• SOAP is better if developers and network administrators don’t
  have a good relationship
In conclusion

For enterprise apps, default to SOAP.

But if (like Amazon.com) you
•are catering to people who are not making a large
         investment in connecting to your service
•have control over your network
•are trying to reach a broad audience

… then go with REST.

Expires: Mon, 31 Mar 2008 20:00:00 GMT
Questions?

Contenu connexe

En vedette (7)

Платформа интеграции в интересах развития
Платформа интеграции в интересах развитияПлатформа интеграции в интересах развития
Платформа интеграции в интересах развития
 
Старое Преображенское и его историческое наследие
Старое Преображенское и его историческое наследиеСтарое Преображенское и его историческое наследие
Старое Преображенское и его историческое наследие
 
Предложения по формированию долгосрочной программы развития российской час...
Предложения  по формированию  долгосрочной программы  развития российской час...Предложения  по формированию  долгосрочной программы  развития российской час...
Предложения по формированию долгосрочной программы развития российской час...
 
Протокол 15.01.15 1
Протокол 15.01.15 1Протокол 15.01.15 1
Протокол 15.01.15 1
 
Sersa Lear
Sersa LearSersa Lear
Sersa Lear
 
4 main final1
4 main final14 main final1
4 main final1
 
Peranan ibu bapa dalam pendidikan seks
Peranan ibu bapa dalam pendidikan seksPeranan ibu bapa dalam pendidikan seks
Peranan ibu bapa dalam pendidikan seks
 

Similaire à Soap vs-rest

XML Schema Patterns for Databinding
XML Schema Patterns for DatabindingXML Schema Patterns for Databinding
XML Schema Patterns for DatabindingPaul Downey
 
Solid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaSolid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaKazuhiro Sera
 
Solid and Sustainable Development in Scala
Solid and Sustainable Development in ScalaSolid and Sustainable Development in Scala
Solid and Sustainable Development in Scalascalaconfjp
 
Ruby on Rails: Coding Guideline
Ruby on Rails: Coding GuidelineRuby on Rails: Coding Guideline
Ruby on Rails: Coding GuidelineNascenia IT
 
Understanding and Developing Web Services - For DBAs and Developers (whitepaper)
Understanding and Developing Web Services - For DBAs and Developers (whitepaper)Understanding and Developing Web Services - For DBAs and Developers (whitepaper)
Understanding and Developing Web Services - For DBAs and Developers (whitepaper)Revelation Technologies
 
Web-Services!.pptx
Web-Services!.pptxWeb-Services!.pptx
Web-Services!.pptxssuserae0316
 
Java Web Services [2/5]: Introduction to SOAP
Java Web Services [2/5]: Introduction to SOAPJava Web Services [2/5]: Introduction to SOAP
Java Web Services [2/5]: Introduction to SOAPIMC Institute
 
Killing the Angle Bracket
Killing the Angle BracketKilling the Angle Bracket
Killing the Angle Bracketjnewmanux
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...bobmcwhirter
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)Serhii Kartashov
 
Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02sagaroceanic11
 

Similaire à Soap vs-rest (20)

XML Schema Patterns for Databinding
XML Schema Patterns for DatabindingXML Schema Patterns for Databinding
XML Schema Patterns for Databinding
 
Advanced soa and web services
Advanced soa and web servicesAdvanced soa and web services
Advanced soa and web services
 
Solid And Sustainable Development in Scala
Solid And Sustainable Development in ScalaSolid And Sustainable Development in Scala
Solid And Sustainable Development in Scala
 
Solid and Sustainable Development in Scala
Solid and Sustainable Development in ScalaSolid and Sustainable Development in Scala
Solid and Sustainable Development in Scala
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
SOAP WEB TECHNOLOGIES
SOAP WEB TECHNOLOGIESSOAP WEB TECHNOLOGIES
SOAP WEB TECHNOLOGIES
 
Ruby on Rails: Coding Guideline
Ruby on Rails: Coding GuidelineRuby on Rails: Coding Guideline
Ruby on Rails: Coding Guideline
 
Scalaxb preso
Scalaxb presoScalaxb preso
Scalaxb preso
 
Understanding and Developing Web Services - For DBAs and Developers (whitepaper)
Understanding and Developing Web Services - For DBAs and Developers (whitepaper)Understanding and Developing Web Services - For DBAs and Developers (whitepaper)
Understanding and Developing Web Services - For DBAs and Developers (whitepaper)
 
Web-Services!.pptx
Web-Services!.pptxWeb-Services!.pptx
Web-Services!.pptx
 
Java Web Services [2/5]: Introduction to SOAP
Java Web Services [2/5]: Introduction to SOAPJava Web Services [2/5]: Introduction to SOAP
Java Web Services [2/5]: Introduction to SOAP
 
Killing the Angle Bracket
Killing the Angle BracketKilling the Angle Bracket
Killing the Angle Bracket
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
 
eXtensible Markup Language (XML)
eXtensible Markup Language (XML)eXtensible Markup Language (XML)
eXtensible Markup Language (XML)
 
Unixscripting
UnixscriptingUnixscripting
Unixscripting
 
Unix shell scripting tutorial
Unix shell scripting tutorialUnix shell scripting tutorial
Unix shell scripting tutorial
 
Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02Rubyonrails 120409061835-phpapp02
Rubyonrails 120409061835-phpapp02
 
Ruby on rails
Ruby on railsRuby on rails
Ruby on rails
 
Soaosbcourse_content
Soaosbcourse_contentSoaosbcourse_content
Soaosbcourse_content
 
js.pptx
js.pptxjs.pptx
js.pptx
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 

Dernier (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

Soap vs-rest

  • 1. Dec 7, 2007 Can you read this? If not, please sit closer. Thank you.
  • 3. Early SOAP (2000) “section 5 encoding” <?xml version="1.0"?> <soap-env:envelope soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"> <soap-env:header> ... </soap-env:header> <soap-env:body> <m:doSomeWork xmlns:m="http://www.lab49.com/"> <foo xsi:type="xsd:int">40</foo> <bar>-12.53</bar> </m:doSomeWork> </soap-env:body> </soap-env:envelope> <?xml version="1.0"?> <soap-env:Envelope soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"> <soap-env:body> <m:doSomeWorkResponse xmlns:m="http://www.lab49.com/"> <soap-enc:array soap-enc:arrayType="xsd:ur-type[2]"> <baz xsi:type="xsd:int">12345</baz> <quux xsi:type="xsd:string">Something here</quux> </soap-enc:array> </m:doSomeWorkResponse> </soap-env:Body> </soap-env:Envelope>
  • 4. SOAP fancy encoding rules References: <e:Book> <title>My Life and Work</title> <author href="#Person-1"/> </e:Book> <e:Person id="Person-1"> <name>Henry Ford</name> <address href="#Address-2"/> </e:Person> <e:Address id="Address-2"> <email>mailto:henryford@hotmail.com</email> <web>http://www.henryford.com</web> </e:Address> Sparse arrays: <SOAP-ENC:Array SOAP-ENC:arrayType="xsd:string[,][4]"> <SOAP-ENC:Array href="#array-1" SOAP-ENC:position="[2]"/> </SOAP-ENC:Array> <SOAP-ENC:Array id="array-1" SOAP-ENC:arrayType="xsd:string[10,10]"> <item SOAP-ENC:position="[2,2]">Third row, third col</item> <item SOAP-ENC:position="[7,2]">Eighth row, third col</item> </SOAP-ENC:Array>
  • 5. Document/literal (2003): Forget all the fancy encoding rules <?xml version="1.0"?> <soap-env:envelope soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"> <soap-env:header> ... </soap-env:header> <soap-env:body> … your XML Schema compliant document goes here … </soap-env:body> </soap-env:envelope>
  • 6. I want my, I want my RPC (rpc/literal) <?xml version="1.0"?> <soap-env:envelope soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"> <soap-env:header> ... Namespace does not </soap-env:header> have to be the same <soap-env:body> <m:doSomething xmlns:m=“http://lab49.com/”> as the parameter values <foo> … XML Schema compliant value… … XML Schema compliant value… … </foo> Argument elements don’t <bar> even have a namespace … XML Schema compliant value… … </bar> </m:doSomething> </soap-env:body> </soap-env:envelope> Lets you model procedure calls, but can’t validate SOAP body with an XML Schema
  • 7. SOAP encoding convention line-up circa 2003 1. RPC/encoded (the original) 2. Document/literal (based on XML Schema, but doesn’t model RPC) 3. RPC/literal (adds RPC modeling, breaks XML Schema validation) Can’t we model RPC without breaking Schema validation?
  • 8. Wrapped document literal style (2005) <?xml version="1.0"?> <soap-env:envelope soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"> <soap-env:header> ... </soap-env:header> <soap-env:body> <m:doSomething xmlns:m=“http://lab49.com/”> <m:foo> … Entire body complies with an XML Schema </m:foo> <m:bar> containing element doSomething containing … a sequence of elements foo and bar </m:bar> </m:doSomething> </soap-env:body> </soap-env:envelope>
  • 9. Handy summary Scheme Rating Why? rpc/encoded Because “encoded” means “section 5 encoding” and that hairy BAD (1998) scheme has been displaced by XML Schemas doc/literal Send an XML Schema compliant document, get one back. BEST (2003) Awesome. rpc/literal BAD Failed attempt to reconcile document style with RPC. (2003) wrapped/literal GOOD Successful attempt to reconcile document style with RPC. (2005)
  • 10. Web Service Definition Language (WSDL 1.1) Wrapped style. Notice the operation has one message part called “parameters” which is an XML sequence of the args
  • 12. Code first / WSDL first decision algorithm Write code first and use doc/literal style. Will other projects i.e. Every method No Are you in a No be using these has one arg. Use services? i.e. is this great hurry? annotations to name part of an SOA? everything and review WSDL afterward. Yes Yes Write code first in wrapped/literal style, i.e. Use annotations to name everything and review WSDL afterward. Write WSDL first. Think through interfaces carefully, plan for backward compatibility, write lots of comments, and maintain in source control.
  • 13. Goodies • WS-Security (message integrity, confidentiality, and authentication) • WS-ReliableMessaging • WS-Routing (messaging patterns and routes) • WS-Eventing (pub/sub) • Many other incomprehensible extensions, collectively referred to as WS-*
  • 14. The SOAP way of thinking
  • 16. Will SOAP collapse under its own weight?
  • 17. Complexity Low High SOAP ? REST
  • 18. Comparison points • WSDL is a good idea for both SOAP and REST (not a long-term differentiator) • SOAP and REST both allow you to name resources with URIs (also not a long-term differentiator) • REST adds value to the entire web (we don’t care) • REST is easier to program (not for long) • SOAP provides better support for async messaging • SOAP is better if developers and network administrators don’t have a good relationship
  • 19. In conclusion For enterprise apps, default to SOAP. But if (like Amazon.com) you •are catering to people who are not making a large investment in connecting to your service •have control over your network •are trying to reach a broad audience … then go with REST. Expires: Mon, 31 Mar 2008 20:00:00 GMT