SOAP
SOAP (Simple Object Access Protocol) is a lightweight platform and language neutral communication protocol that allows programs to communicate via standard Internet HTTP. SOAP is standardized by the W3C.[1]
Contents
Specifications
SOAP 1.1
- Simple Object Access Protocol (SOAP) 1.1: http://www.w3.org/TR/2000/NOTE-SOAP-20000508/
SOAP 1.2
- SOAP Version 1.2 Part0: Primer: http://www.w3.org/TR/soap12-part0/
- SOAP Version 1.2 Part1: Messaging Framework: http://www.w3.org/TR/soap12-part1/
- SOAP Version 1.2 Part2: Adjuncts: http://www.w3.org/TR/soap12-part2/
- SOAP Version 1.2 Specification Assertions and Test Collection: http://www.w3.org/TR/soap12-testcollection/
- SOAP over Java Message Service 1.0: http://www.w3.org/TR/soapjms/
Format
SOAP 1.1
Fictional Web Service call to a "Stock lookup" Web Service using SOAP 1.1 (must occur via POST with URL-escaped SOAP as message body):
REQUEST:
POST /StockQuote HTTP/1.1 Host: www.stockquoteserver.com Content-Type: text/xml; charset="utf-8" Content-Length: nnnn SOAPAction: "Some-URI"
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <STOCKS:GetLastTradePrice xmlns:STOCKS="http://www.webservicex.net/stocks.dtd"> <STOCKS:symbol>DIS</STOCKS:symbol> </STOCKS:GetLastTradePrice> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
RESPONSE
HTTP/1.1 200 OK Content-Type: text/xml; charset="utf-8" Content-Length: nnnn
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <SOAP-ENV:Body> <STOCKS:GetLastTradePriceResponse xmlns:STOCKS="http://www.webservicex.net/stocks.dtd"> <STOCKS:Price>34.5</STOCKS:Price> </STOCKS:GetLastTradePriceResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
NOTE: SOAP1.1 in most cases accepts POST requests only, must send SOAP XML inside Body of request message or it will fail and produce an error since it forces validation.
SOAP 1.2
Fictional Web Service call to a "Recommendation Engine" Web Service using SOAP 1.2 (could be done over GET or POST, as long as authentication/configuration permits it):
REQUEST:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.openrecommender.org/"> <soapenv:Header/> <soapenv:Body> <ws:GetRecommendations> <ws:lastViewed>Video #1</ws:lastViewed> <ws:nowViewing>Video #11203</ws:nowViewing> <ws:type>org.openrecommender.Video</ws:type> </ws:GetRecommendations> </soapenv:Body> </soapenv:Envelope>
RESPONSE
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://openrecommender.org/schema/" xmlns:openrec="http://openrecommender.org/schema/recommendations.xsd"> <soap:Body> <ws:getRecommendationsResponse> <openrec:recommendations> <openrec:recommendation> <openrec:title>Video #345</video:title> <openrec:image>http://example.com/images/345.jpg</video:image> <openrec:link>http://example.com/video/345</video:link> <openrec:description>Awesome video which is similar to #11203</video:description> </openrec:recommendation> </openrec:recommendations> </ws:getRecommendationsResponse> </soap:Body> </soap:Envelope>
NOTE: SOAP1.2 endpoints can be invoked more similar to REST Web Services, via parameters in the URL (i.e. HTTP Request testing tool or even Web Browser address bar)
What is SOAP?
The basic Web services platform is XML plus HTTP.
* SOAP stands for Simple Object Access Protocol * 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
This diagram shows a system-level flow diagram for an example SOAP Request/Response:
EXAMPLES
There aren't many valid, up-to-date and properly maintained WSDLs or SOAP endpoints left, and with the failure of UDDI to provide a single repository of Web Services, it has left a vaccuum sensation similar to the end of a shower when the rest of your SOAP (and water) gets sucked down the drain.
Still, for historical purposes and for testing if ever having the misfortune of needing to use SOAP exclusively, here I will collect the last few commercial or enterprise-grade SOAP Web Service Endpoints for preservation's sake (since the leading aggregator Seekda has gone down[3]).
- StrikeIRON - SOAP Web Services directory: http://strikeiron.com/
- Programmable Web SOAP API http://www.programmableweb.com/apis/directory/1?protocol=SOAP
- Service Repository: http://www.service-repository.com/
- Chalk Gaming -- Sports API - Web Services: http://www.getchalk.com/solutions/
- Gracenote -- Sports API site: http://api.demo.infostradasports.com/asp/documentation.asp
- Hotels2Go: https://smtpi.siteminder.com/siteconnect/services/siteconnect.wsdl
- LateRooms: http://affiliates.laterooms.com/en/SignUp.mvc
- Amazon Web Services: http://aws.amazon.com | Product Advertising API - WSDL
- What's Showing - Mobie Listings Web Service: https://www.ignyte.com/webservices/commercial/WhatsShowingWebservice1.0/MovieInformationService.svc?wsdl
- cdyne - Weather: http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL
- Calculator WebService: http://www.dneonline.com/calculator.asmx?WSDL
- WebServiceX - StockQuote Service: http://www.webservicex.net/stockquote.asmx?op=GetQuote | WSDL | EXAMPLE
- Caculator Test Service: http://soaptest.parasoft.com/calculator.wsdl
- Rock-Paper-Scissors Test Service: http://bcmoney-mobiletv.com/api/soap/RockPaperScissors/?wsdl
- IP2Geo Web Service: http://ws.cdyne.com/ip2geo/ip2geo.asmx?op=ResolveIP
- Phone Verification: http://ws.cdyne.com/phoneverify/phoneverify.asmx?op=CheckPhoneNumber
- US Census Data: http://ws.cdyne.com/DemographixWS/DemographixQuery.asmx?op=GetLocationInformationByAddress
- PeopleAsk - Trending Searches: peopleask.ooz.ie/soap.wsdl?
- JIRA Issues SOAP Web Service: https://jira.atlassian.com/rpc/soap/jirasoapservice-v2?wsdl[4]
- Demo Web Service: http://www.guru4.net/articoli/javascript-soap-client/demo/webservicedemo.asmx?WSDL
Tools
- soapUI -- the leading tool for Web Service Testing: http://www.soapui.org/
- SOAP Message Builder: http://www.soapclient.com/SoapMsg.html
- SOAP Web Service request/response tester: http://soapclient.com/soaptest.html
- FireFox -- SOA-Client plugin: https://addons.mozilla.org/en-US/firefox/addon/soa-client/ (similar to HTTP Headers but with SOAP-specific fields)
JAVA
- Apache CXF -- An Open Source Service Framework (merged Celtix and XFire projects)[5]: http://cxf.apache.org/
- Apache Axis (leading alternative to CXF): http://ws.apache.org/axis/[6][7]
- JAVA Sun Developer Network -- Overview of SOAP: http://java.sun.com/developer/technicalArticles/xml/webservices/
- Using SOAP with JAVA: http://javaboutique.internet.com/tutorials/SOAP/
JavaScript
- Apache CXF - JavaScript Client generator (wsdl2js & java2js): https://cwiki.apache.org/CXF20DOC/javascript-clients.html*
- JavaScript SOAP Client: http://www.guru4.net/articoli/javascript-soap-client/en/[8]
- Calling Web Services From JavaScript - Using SOAP Client: http://www.codeproject.com/KB/webservices/Using_SOAP_Client.aspx
- AJAX calls to SharePoint (SOAP) Web Services using jQuery: http://sharepoint-snippets.com/ajax-calls-sharepoint-web-services-using-jquery/
- How to Create a Dictionary in SharePoint: https://dougieflash.wordpress.com/2013/06/01/how-to-create-a-dictionary-in-sharepoint/
- XML JS Objectifier: http://www.terracoder.com/index.php/xml-objectifier
- Implementing a SOAP client in Javascript: http://www.mathertel.de/AJAX/JavaScriptSOAPClient.aspx
PHP
- SOAP Functions (NATIVE): http://www.php.net/manual/en/ref.soap.php[10]
- PEAR::SOAP package - SOAP Client/Server for PHP: http://pear.php.net/package-info.php?pacid=87
- PHP Soap Toolkit: http://sourceforge.net/projects/phpsoaptoolkit/
- nuSOAP: http://sourceforge.net/projects/nusoap/
Python
- SUDS - a lightweight SOAP python client for consuming Web Services: https://fedorahosted.org/suds/
- SOAP Py: http://freshmeat.net/projects/soappy/
Objective-C/Swift
- How to access SOAP services from iPhone: https://stackoverflow.com/questions/204465/how-to-access-soap-services-from-iphone?rq=1
Resources
- SOAP Basics: http://www.javapassion.com/webservices/SOAPBasics.pdf
- SOAP presentation: http://www.sosnoski.com/presents/ws-arch.html
- WSDL - Quick Guide: https://www.tutorialspoint.com/wsdl/wsdl_quick_guide.htm
Tutorials
- Web Services with NetBeans: http://blogs.sun.com/joaosavio/entry/web_services_with_netbeans
- Using SOAP with Java – part1: http://javaboutique.internet.com/tutorials/SOAP/
- Using SOAP with Java - Part 2: http://javaboutique.internet.com/tutorials/SOAP/index2.html
- Using SOAP with Java – part 3: http://javaboutique.internet.com/tutorials/SOAP/index3.html
- (pains of) Server-Side SOAP: http://www.soapuser.com/server1.html
- SOAP -- Understanding web services specifications, Part 1: https://www.ibm.com/developerworks/webservices/tutorials/ws-understand-web-services1/ws-understand-web-services1.html
- A simple SOAP client -- A general-purpose Java SOAP client: http://www.ibm.com/developerworks/xml/library/x-soapcl/
- Simplifying your Java SOAP Client: http://www.soapuser.com/ngx_22jul01.html
- How To -- A Simple Generic (AXIS) SOAP Test Client written in Java: http://anshu-manymoods.blogspot.com/2009/10/how-to-simple-generic-soap-test-client.html
- How to log SOAP Request and response XML in log file : http://javakafunda.blogspot.ca/2012/04/how-to-log-soap-request-and-response.html[15][16]
- JAX-WS Tutorial: https://www.journaldev.com/9123/jax-ws-tutorial
- 10 Tips for the SoapUI Beginner: http://www.soapui.org/Getting-Started/10-tips-for-the-soapui-beginner/All-Pages.html
- soapUI Tips and Tricks -- 10 Tests of a Web Service Login you should always do: http://www.soapui.org/SOAP-and-WSDL/web-service-hacking.html
- Load Testing REST Web Services with SoapUI: http://community.qualitylogic.com/blogs/web-site-testing/archive/2009/08/30/load-testing-rest-web-services-with-soapui.aspx
- load testing with SOAP request having variable parameter(s): http://groovyinsoapui.wordpress.com/2008/09/30/load-testing-with-soap-request-having-variable-parameters/
- Capturing and playing back web service calls with Wireshark and SoapUI: http://mikehadlow.blogspot.com/2009/01/capturing-and-playing-back-web-service.html
- soapUI Tips n Tricks – Part 2: http://onebyteatatime.wordpress.com/2009/04/18/soapui-tips-n-tricks-part-2/
- Calling SharePoint Web Services From Javascript: http://sharepointkb.org/Calling_SharePoint_Web_Services_From_Javascript
- Consuming an Asp.NET web service using SOAP protocol from JavaScript: http://nishantrana.wordpress.com/2008/08/13/consuming-an-aspnet-web-service-using-soap-protocol-from-javascript/
- Simple PHP SOAP example: http://www.vankouteren.eu/blog/2009/03/simple-php-soap-example/
- DevZone - PHP SOAP Extension client/server examples: http://devzone.zend.com/25/php-soap-extension/
- SOAP Servers in PHP: http://www.datanom.net/foredrag/php/soap/server/Servers-lecture.pdf
- PHP Soap – A Simple PHP Web Service Example: http://www.joelhainley.com/index.php/tag/php-soap-example/
- PHP Cookbook -- A PHP Web Services Client: http://www.onlamp.com/pub/a/php/2003/07/03/php_amazon_soap.html
- Google Search Web Services - An XML Web Service using PHP and Soap: http://www.flash-db.com/Google/FloogleMX.html
- Consume SOAP web service from Javascript and PHP: http://techblog.floorplanner.com/2008/04/02/consume-soap-web-service-from-javascript/
- SOAP Server with PHP5 (3 parts): http://jimmyzimmerman.com/blog/2007/02/soap-server-with-php5-part3-the-glue-code.html
- HelloServer.php - First SOAP Server Application: http://www.herongyang.com/Web-Services/PHP-SOAP-Server-Example-HelloServer.html
- How to create php SOAP Server functions using WSDL?: https://stackoverflow.com/questions/37901960/how-to-create-php-soap-server-functions-using-wsdl
- How to write and use SOAP services in PHP and AJAX: http://bisqwit.iki.fi/story/howto/phpajaxsoap/
- PHP – Send a SOAP Request by cURL: http://eureka.ykyuen.info/2011/05/05/php-send-a-soap-request-by-curl/
- WebService SOAP in PHP & MySQL: http://stackoverflow.com/questions/13681938/webservice-soap-in-php-mysql
- IBM - Call SOAP Web services with Ajax -- Building a WS AJAX client (part 1 of 2): http://www.ibm.com/developerworks/webservices/library/ws-wsajax/
- IBM - Call SOAP Web services with Ajax -- Extending WS AJAX (part 2 of 2): http://www.ibm.com/developerworks/webservices/library/ws-wsajax2/
- Call SOAP based web services through JavaScript: http://ejvyas.blogspot.com/2009/04/call-soap-based-web-services-through.html
- Calling SOAP Servers from JS in Mozilla: http://onlamp.com/pub/a/onlamp/2005/06/23/mozsoap.html
- JSON - JavaScript Object Notation: http://www.xul.fr/ajax-javascript-json.html
- Ajax Tutorial (Asynchronous Javascript + XML): http://www.xul.fr/en-xml-ajax.html
- Activating SOAP using Ajax: http://www.ajaxwith.com/Activating-SOAP-using-Ajax.html
- Calling SOAP Servers from JS in Mozilla: http://onlamp.com/pub/a/onlamp/2005/06/23/mozsoap.html
- AJAX Proxy and SOAP: http://boards.developerforce.com/t5/AJAX-Toolkit-S-Controls/AJAX-Proxy-and-SOAP/td-p/68676
- Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]: http://www.slideshare.net/shreeraj/hacking-web-20-defending-ajax-and-web-services-hitb-2007-dubai
- Flex 3 docs - Using WebService components: http://livedocs.adobe.com/flex/3/html/help.html?content=data_access_3.html
- Building web service clients with Flex Builder 3 : http://www.adobe.com/devnet/flex/articles/flex_ws.html
- Web Service in Flash AS3 (no Flex libs), Release 1.0: http://alducente.wordpress.com/2007/10/27/web-service-in-as3-release-10/
- Getting Acrobat Javascript working with SOAP and WSDL: http://efreedom.com/Question/1-1049634/Getting-Acrobat-Javascript-Working-SOAP-WSDL
- How to use SOAP web services with Java and Flex (part 2 of 2): http://www.blackpepper.co.uk/black-pepper-blog/How-to-use-SOAP-web-services-with-Java-and-Flex-Part-2-of-2.html
- The New flex_ws_api and SOAP 1.2 Example: http://jastraub.blogspot.com/2008/11/new-flexwsapi-and-soap-12-example.html
- Develop web services clients with Macromedia Flex: http://www.ibm.com/developerworks/webservices/library/ws-macroflex/
- Calling a simple web service from Flex using the new WebService class: http://blog.flexexamples.com/2008/04/14/calling-a-simple-web-service-from-flex-using-the-webservice-class/
- What's a "JavaScript SOAP Client"?: http://javascriptsoapclient.codeplex.com/ | DEMO[18]
- Simplest possible JavaScript SOAP example: http://stackoverflow.com/questions/124269/simplest-soap-example/11404133#11404133
- Implementing a SOAP client in Javascript: http://www.mathertel.de/AJAX/JavaScriptSOAPClient.aspx
- Call SOAP Web services with Ajax, Part 1: Build the Web services client: https://www.ibm.com/developerworks/webservices/library/ws-wsajax/[19]
- Joomla VirtueMart DataManager -- Javascript SOAP Client example: http://www.virtuemart-datamanager.com/index.php?option=com_content&view=article&id=54:javascript-soap-client-&catid=27:new-to-joomla&Itemid=44
- JS SOAP Proxy: https://code.google.com/p/js-soap-proxy/ (HTTP SOAP web service client in JavaScript )
- jQuery SOAP plugin: http://plugins.jquery.com/soap/
- Call SOAP-XML Web Services With jQuery AJAX (without any plugin): http://openlandscape.net/2009/09/25/call-soap-xm-web-services-with-jquery-ajax/
- MSDN Walkthrough - Use the SOAP Endpoint for Web Resources with JavaScript: http://msdn.microsoft.com/en-us/library/gg594434.aspx
- Calling An ASMX Web Service From Different Languages: http://www.geekswithblogs.net/THines01/archive/2010/03/07/callws.aspx (C#, VB, Java, Ruby, PHP, Perl)
- Call custom WCF Soap Service from Javascript: http://mkonrad.blogspot.ca/2013/02/call-custom-wcf-soap-service-from.html
- Calling WCF Web Services from JavaScript: http://weblogs.asp.net/ricardoperes/archive/2011/03/29/calling-wcf-web-services-from-javascript.aspx
- Using JavaScript to consume a WCF Web Service: http://nishantrana.wordpress.com/2010/11/18/using-javascript-to-consume-a-wcf-service/
- Consuming any service (SOAP / WCF / ASMX / REST) using JQuery: http://www.c-sharpcorner.com/uploadfile/sridhar_subra/consuming-wcf-asmx-rest-service-using-jquery/[20]
- Quick Note - SSL with SOAP and SOAPUI: http://java.dzone.com/articles/quick-note-ssl-soap-and-soapui
- How to Use XSD in WSDL: http://www.ehow.com/how_7662842_use-xsd-wsdl.html
- Import XSD into WSDL: http://www.ehow.com/how_7691573_import-xsd-wsdl.html
- Repurposing CGI applications with SOAP: http://www.ibm.com/developerworks/library/ws-cgia/
- Creating a Flickr App (for iPhone) Using NSXMLParser, UITableView and SOAP Tutorial: http://kristiansenogames.blogspot.ca/2011/06/creating-flickr-app-using-nsxmlparser.html
- Web Service Sample Project: http://www.soapui.org/Getting-Started/web-service-sample-project.html
- Capturing and playing back web service calls with Wireshark and SoapUI: http://mikehadlow.blogspot.ca/2009/01/capturing-and-playing-back-web-service.html
- How to enable SOAP from cPanel: http://forums.cpanel.net/f5/how-enable-soap-71740.html
- SOAP with mutual SSL - how to send over credentials?: https://stackoverflow.com/questions/11904620/soap-with-mutual-ssl-how-to-send-over-credentials
External Links
- wikipedia: Simple Object Access Protocol
- The S stands for Simple: https://web.archive.org/web/20070206112323/http://wanderingbarque.com/nonintersecting/2006/11/15/the-s-stands-for-simple/
- Introduction to Web Services Technologies -- SOA, SOAP, WSDL and UDDI: http://www.informit.com/articles/article.aspx?p=336265
- Unraveling the Mystery of SOAPAction: http://www.oreillynet.com/xml/blog/2002/11/unraveling_the_mystery_of_soap.html
- What's New in SOAP 1.2: http://hadleynet.org/marc/whatsnew.html
- Axis, Axis2 and CXF - Surveying the WS Landscape: http://www.theserverside.com/news/1363958/Axis-Axis2-and-CXF-Surveying-the-WS-Landscape
- XML Web Service Caching Strategies: http://msdn.microsoft.com/en-us/library/aa480499.aspx
- Performance testing SOAP-based applications: http://www.ibm.com/developerworks/webservices/library/ws-testsoap/
- Caching web services to improve the performance: http://www.ibm.com/developerworks/webservices/library/ws-caching/
- Taking a look at the new Sencha SOAP Data Proxy: http://www.sencha.com/blog/taking-a-look-at-the-new-sencha-soap-data-proxy/
- W3schools - SOAP overview: https://www.w3schools.com/XML/xml_soap.asp
- Public SOAP Web Services: https://stackoverflow.com/questions/1958048/public-soap-web-services
References
- ↑ What are Web Services http://w3schools.com/ngws/ngws_webservices.asp
- ↑ W3Schools on Web Services and SOAP: http://w3schools.com/webservices/ws_platform.asp
- ↑ Seekda - Public SOAP Web Service (UDDI) directory and search engine: http://webservices.seekda.com/browse
- ↑ JIRA SOAP Lib: https://bobswift.atlassian.net/wiki/display/JSOAPLIB/JIRA+SOAP+Library
- ↑ Apache CXF: Interview with Dan Diephouse and Paul Brown: http://www.oreillynet.com/onjava/blog/2007/07/apache_cxf_interview_with_dan.html
- ↑ Difference between Apache CXF and Axis: http://stackoverflow.com/questions/1243247/difference-between-apache-cxf-and-axis
- ↑ http://www.slideshare.net/itemis/axis2-vs-cxf-high-noon-apache-presentation
- ↑ Simplest SOAP example using Javascript: http://stackoverflow.com/questions/124269/simplest-soap-example-using-javascript
- ↑ Easily consume SOAP Web services with JavaScript: http://www.techrepublic.com/article/easily-consume-soap-web-services-with-javascript/5887775
- ↑ Check if SOAP is enabled in PHP and if not enable it: http://stackoverflow.com/a/29694015/335867
- ↑ How to fix Fatal error: Class 'SoapClient' not found error (install SOAP client/server in "php.ini", separate from base "SOAP" lib): https://stackoverflow.com/questions/11391442/fatal-error-class-soapclient-not-found
- ↑ SoapServer returns Internal Server Error (no log) in Laravel 5.2: https://github.com/laravel/framework/issues/13672
- ↑ The SoapServer class: https://www.php.net/manual/en/class.soapserver.php
- ↑ The SoapClient class: https://www.php.net/manual/en/class.soapclient.php
- ↑ Convert SOAP response to SOAP XmL string using JAX-WS : https://coderanch.com/t/549539/java/Convert-SOAP-response-SOAP-XmL
- ↑ Troubleshooting JAX-WS applications with the WebSphere Application Server V6.1 Feature Pack for Web Services: https://www.ibm.com/developerworks/websphere/library/techarticles/0803_adams/0803_adams.html
- ↑ Web Services and PHP – SOAP vs XML-RPC vs REST: http://roshanbh.com.np/2008/07/web-services-php-soap-vs-xml-rpc-vs-rest.html
- ↑ JavaScript SOAP Client tutorial: www.codeproject.com/Articles/12816/JavaScript-SOAP-Client
- ↑ Clean up your wire protocol with SOAP, Part 1: http://www.javaworld.com/article/2075167/soa/clean-up-your-wire-protocol-with-soap--part-1.html
- ↑ Binding WCF to jQuery: http://channel9.msdn.com/Shows/Devs4Devs/WCF-and-jQuery-A-Perfect-Couple