SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Mandakini Kumari
    June 15th 2012
Who am I
 Have 9 + years of experience in open source specially
  PHP, Drupal & Web Services.
 Active crusader to improve effectiveness and reach of
  Free & Open Source Software(FOSS).
 Impart industrial consultancy for best use of software
  application.
 Frequently conduct training for students and
  industrial experts.
What am I going to talk about ?
 Use of Web Services ?
 What is Web Services
 Different Ways: SOAP & REST
 SOAP Vs REST
 How am I going to use REST
 Example: Twitter, Paypal
Use of Web Services(WS)
 Payment Gateway integration for E-commerce site.
 Google Map for a Real Estate Site.
 Product detail for a price comparison website
 Weather forecast for a news or blog site
 Mashup: Combine data from one or more source and
 integrate application
Payment Gateway integration




        http://paypal.com
Why WS for Payment getaway
 Very Fast
 Very Reliable
 Secure
 User don’t know what getway used by the site
 User don’t need to register on payment site e.g. paypal
 Website Administration is very easy e.g. IRCT with
 netbanking ICICI
Google Map Web services for your website
Top APIs for Mashups




        http://programmableweb.com/apis
What is Web Services(WS)
 WS serves as an interface to software
  developers.
 Using WS as an API you can convert
  applications into web-applications.
 WS is the vision of ‘Future Internet’
 The basic Web services platform is XML +
  HTTP.
 WS is future for Mobile application
What is SOAP
 SOAP is a simple XML-based protocol to let
  applications exchange information over HTTP
 Businesses can register their WS on UDDI(Universal
  Description, Discovery and Integration) and provide
  documentation with WSDL (Web Services Description
  Language).
 SOAP is mostly used for Enterprise applications to
  integrate wide types and another trend is to integrate
  with legacy systems
SOAP Architecture
SOAP Building Blocks
Paypal SOAP Building Blocks
A 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:Envelope>
SOAP Header Element
 <SOAP-ENV:Header>
 <RequesterCredentials xmlns=”urn:ebay:api:PayPalAPI”
 xsi:type=”ebl:CustomSecurityHeaderType”>
 <Credentials xmlns=”urn:ebay:apis:eBLBaseComponents”
 xsi:type=”ebl:UserIdPasswordType”>
 <Username>api_username</Username>
 <Password>api_password</Password>
 <Signature>api_signature</Signature>
 <Subject>authorizing_account_emailaddress</Subject>
 </Credentials>
 </RequesterCredentials>
 </SOAP-ENV:Header>
SOAP Body Request Element
 <soap:Body>
  <m:GetPrice mlns:m="http://www.example.com/prices">
   <m:Item>Laptop</m:Item>
  </m:GetPrice>
 </soap:Body>
A SOAP Response
 HTTP/1.1 200 OK
  Content-Type: application/soap+xml; charset=utf-8
  Content-Length: nnn
  <?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.example.com/prices">
    <m:Price>$900</m:Price>
   </m:GetPriceResponse>
  </soap:Body>
  </soap:Envelope>
PHP SOAP Server Example
$server = new SoapServer("Library.wsdl",array("classmap"=>$classmap));
$server->addFunction("searchAuthors");
$server->addFunction("searchBooks");
$server->handle();
PHP SOAP Client Example
$client=new SoapClient("http://localhost/Library.wsdl",array("trace" => 1));
try
{
 //$response = $client->searchAuthors("Beh");
 $response = $client->searchBooks("te");
var_dump($response);
echo htmlspecialchars($client->__getLastRequest())."";
echo htmlspecialchars($client->__getLastResponse())."";
}catch(Exception $e){
 var_dump($e);
 echo $client->__getLastRequest();
echo $client->__getLastResponse();
}
RESTful Web services
 Representational State Transfer (REST) has gained
  widespread acceptance across the Web
 REST permits many different data formats
 HTTP consists in URIs, methods, status codes …
 REST is great for clean, simple, robust services
 REST is a software architecture style used in
  developing stateless web services
 REST is an acronym standing for Representational
  State Transfer.
Architecture of REST
RESTful Web Service HTTP methods
    HTTP     CRUD       SQL

    POST      Create   INSERT

     GET      Read     SELECT

     PUT      Update   UPDATE

    DELETE    Delete   DELETE
Data Format Supported By REST
 xml – almost any programming language can read
  XML
 json – useful for JavaScript and increasingly PHP apps.
 csv – open with spreadsheet programs
 html – a simple HTML table
 php – Representation of PHP code that can be
  eval()’ed
 serialize – Serialized data that can be unserialized in
  PHP
Different Methods to Interact with REST
    file_get_contents()
    cURL
    SimpleXml
1) File_get_contents()
<?php
$result = file_get_contents('http:// twitter
   .com/users/show/screenname');
var_dump($result);

HTTP Basic authentication you can use the following syntax to get data
  from your password protected RESTful AP
$user = json_decode(
  file_get_contents('http://admin:1234@example.com/index.php/api/use
  r/id/1/format/json')
);
echo $user->name;
REST from PHP: GET(CURL)
<?php
$ch = curl_init('http://twitter.com/users');
curl_exec($ch);
REST from PHP: DELETE
<?php
$ch = curl_init('http://example.com/users/ginny');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,
  'DELETE');
curl_exec($ch);
Soap Vs Rest
Why REST /1
 Creating clients, developing APIs, and understanding
  documentation is much easier in REST than SOAP
 REST permits many different data formats where as
  SOAP only permits XML
 JSON is a better fit for data and parses very faster
 REST allows better support for browser clients due to
  it’s support for JSON
 REST reads can be cached, SOAP based reads cannot
  be cached.
 REST has better performance and scalability.
Why SOAP /2
 WS-Security: SOAP supports SSL (just like REST) it also
  supports WS-Security which adds some enterprise security
  features.
 WS-AtomicTransaction: Need ACID Transactions over a service
  then you need SOAP. While REST supports transactions, it isn’t
  as comprehensive and isn’t ACID compliant
 WS-ReliableMessaging: Rest doesn’t have a standard
  messaging system and expects clients to deal with
  communication failures by retrying. SOAP has successful/retry
  logic built in and provides end-to-end reliability even through
  SOAP intermediaries.
SOAP Vs REST /3
 In Summary, SOAP is clearly useful, and important.
 For instance, if I was writing an iPhone application to
 interface with my bank I would definitely need to use
 SOAP. All three features above are required for
 banking transactions. For example, if I was
 transferring money from one account to the other, I
 would need to be certain that it completed. Retrying it
 could be catastrophic if it succeed the first time, but
 the response failed.
Questions ???
Thankyou


Mandakini Kumari
https://www.facebook.com/mandakini.kumari
http://www.slideshare.net/mandakinikumari
http://www.linkedin.com/pub/mandakini-kumari/18/93/935

Weitere ähnliche Inhalte

Was ist angesagt? (20)

SOAP vs REST
SOAP vs RESTSOAP vs REST
SOAP vs REST
 
Soap web service
Soap web serviceSoap web service
Soap web service
 
SOAP-based Web Services
SOAP-based Web ServicesSOAP-based Web Services
SOAP-based Web Services
 
Web Services - A brief overview
Web Services -  A brief overviewWeb Services -  A brief overview
Web Services - A brief overview
 
Web service
Web serviceWeb service
Web service
 
Web Service
Web ServiceWeb Service
Web Service
 
Java web services
Java web servicesJava web services
Java web services
 
REST vs SOAP
REST vs SOAPREST vs SOAP
REST vs SOAP
 
Restful web services by Sreeni Inturi
Restful web services by Sreeni InturiRestful web services by Sreeni Inturi
Restful web services by Sreeni Inturi
 
SOAP--Simple Object Access Protocol
SOAP--Simple Object Access ProtocolSOAP--Simple Object Access Protocol
SOAP--Simple Object Access Protocol
 
Restful web services ppt
Restful web services pptRestful web services ppt
Restful web services ppt
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)
 
Simple Object Access Protocol (SOAP)
Simple Object Access Protocol (SOAP)Simple Object Access Protocol (SOAP)
Simple Object Access Protocol (SOAP)
 
Intro to web services
Intro to web servicesIntro to web services
Intro to web services
 
Web services - A Practical Approach
Web services - A Practical ApproachWeb services - A Practical Approach
Web services - A Practical Approach
 
Rest vs Soap
Rest vs SoapRest vs Soap
Rest vs Soap
 
Overview of java web services
Overview of java web servicesOverview of java web services
Overview of java web services
 
Rest and the hypermedia constraint
Rest and the hypermedia constraintRest and the hypermedia constraint
Rest and the hypermedia constraint
 
REST & RESTful Web Service
REST & RESTful Web ServiceREST & RESTful Web Service
REST & RESTful Web Service
 
Restful webservices
Restful webservicesRestful webservices
Restful webservices
 

Andere mochten auch

Restful Web Service
Restful Web ServiceRestful Web Service
Restful Web ServiceBin Cai
 
Modularizing RESTful Web Service Management with Aspect Oriented Programming
Modularizing RESTful Web Service Management with Aspect Oriented ProgrammingModularizing RESTful Web Service Management with Aspect Oriented Programming
Modularizing RESTful Web Service Management with Aspect Oriented ProgrammingWidhian Bramantya
 
Web of Science: REST or SOAP?
Web of Science: REST or SOAP?Web of Science: REST or SOAP?
Web of Science: REST or SOAP?Duncan Hull
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSam Brannen
 
Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web ServicesAngelin R
 
Microservices - Death of the Enterprise Service Bus (ESB)? (Update 2016)
Microservices - Death of the Enterprise Service Bus (ESB)? (Update 2016)Microservices - Death of the Enterprise Service Bus (ESB)? (Update 2016)
Microservices - Death of the Enterprise Service Bus (ESB)? (Update 2016)Kai Wähner
 
REST to RESTful Web Service
REST to RESTful Web ServiceREST to RESTful Web Service
REST to RESTful Web Service家弘 周
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP TutorialLorna Mitchell
 
PHP and Web Services
PHP and Web ServicesPHP and Web Services
PHP and Web ServicesBruno Pedro
 
Best topics for seminar
Best topics for seminarBest topics for seminar
Best topics for seminarshilpi nagpal
 

Andere mochten auch (16)

Restful Web Service
Restful Web ServiceRestful Web Service
Restful Web Service
 
OAuth: Trust Issues
OAuth: Trust IssuesOAuth: Trust Issues
OAuth: Trust Issues
 
Modularizing RESTful Web Service Management with Aspect Oriented Programming
Modularizing RESTful Web Service Management with Aspect Oriented ProgrammingModularizing RESTful Web Service Management with Aspect Oriented Programming
Modularizing RESTful Web Service Management with Aspect Oriented Programming
 
Web of Science: REST or SOAP?
Web of Science: REST or SOAP?Web of Science: REST or SOAP?
Web of Science: REST or SOAP?
 
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
 
10 Benefits of Automated Testing
10 Benefits of Automated Testing10 Benefits of Automated Testing
10 Benefits of Automated Testing
 
Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web Services
 
Microservices - Death of the Enterprise Service Bus (ESB)? (Update 2016)
Microservices - Death of the Enterprise Service Bus (ESB)? (Update 2016)Microservices - Death of the Enterprise Service Bus (ESB)? (Update 2016)
Microservices - Death of the Enterprise Service Bus (ESB)? (Update 2016)
 
REST to RESTful Web Service
REST to RESTful Web ServiceREST to RESTful Web Service
REST to RESTful Web Service
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP Tutorial
 
REST & RESTful Web Services
REST & RESTful Web ServicesREST & RESTful Web Services
REST & RESTful Web Services
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
RESTful API Design, Second Edition
RESTful API Design, Second EditionRESTful API Design, Second Edition
RESTful API Design, Second Edition
 
PHP and Web Services
PHP and Web ServicesPHP and Web Services
PHP and Web Services
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 
Best topics for seminar
Best topics for seminarBest topics for seminar
Best topics for seminar
 

Ähnlich wie Web services soap and rest by mandakini for TechGig

Day1 : web service basics
Day1 :  web service basics Day1 :  web service basics
Day1 : web service basics Testing World
 
REST: So What's It All About? (SAP TechEd 2011, MOB107)
REST: So What's It All About? (SAP TechEd 2011, MOB107)REST: So What's It All About? (SAP TechEd 2011, MOB107)
REST: So What's It All About? (SAP TechEd 2011, MOB107)Sascha Wenninger
 
REST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and LiesREST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and LiesPaul Fremantle
 
Service Oriented Architecture
Service Oriented ArchitectureService Oriented Architecture
Service Oriented ArchitectureLuqman Shareef
 
Exchange of data over internet using web service(e.g., soap and rest) in SAS ...
Exchange of data over internet using web service(e.g., soap and rest) in SAS ...Exchange of data over internet using web service(e.g., soap and rest) in SAS ...
Exchange of data over internet using web service(e.g., soap and rest) in SAS ...Kevin Lee
 
Restful web-services
Restful web-servicesRestful web-services
Restful web-servicesrporwal
 
Web services for developer
Web services for developerWeb services for developer
Web services for developerRafiq Ahmed
 
Web services and SOA
Web services and SOAWeb services and SOA
Web services and SOASubin Sugunan
 
Service Oriented Architecture Updated Luqman
Service Oriented Architecture Updated  LuqmanService Oriented Architecture Updated  Luqman
Service Oriented Architecture Updated Luqmanguesteb791b
 
Introduction to soapui and webservices
Introduction to soapui  and webservicesIntroduction to soapui  and webservices
Introduction to soapui and webservicesAnil Yadav
 
Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Mindfire Solutions
 
How APIs Can Be Secured in Mobile Environments
How APIs Can Be Secured in Mobile EnvironmentsHow APIs Can Be Secured in Mobile Environments
How APIs Can Be Secured in Mobile EnvironmentsWSO2
 
Time to REST: testing web services
Time to REST: testing web servicesTime to REST: testing web services
Time to REST: testing web servicesIurii Kutelmakh
 

Ähnlich wie Web services soap and rest by mandakini for TechGig (20)

Web Programming
Web ProgrammingWeb Programming
Web Programming
 
Day1 : web service basics
Day1 :  web service basics Day1 :  web service basics
Day1 : web service basics
 
REST: So What's It All About? (SAP TechEd 2011, MOB107)
REST: So What's It All About? (SAP TechEd 2011, MOB107)REST: So What's It All About? (SAP TechEd 2011, MOB107)
REST: So What's It All About? (SAP TechEd 2011, MOB107)
 
REST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and LiesREST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and Lies
 
Service Oriented Architecture
Service Oriented ArchitectureService Oriented Architecture
Service Oriented Architecture
 
Rest web service
Rest web serviceRest web service
Rest web service
 
Exchange of data over internet using web service(e.g., soap and rest) in SAS ...
Exchange of data over internet using web service(e.g., soap and rest) in SAS ...Exchange of data over internet using web service(e.g., soap and rest) in SAS ...
Exchange of data over internet using web service(e.g., soap and rest) in SAS ...
 
Restful web-services
Restful web-servicesRestful web-services
Restful web-services
 
Web services for developer
Web services for developerWeb services for developer
Web services for developer
 
Web services and SOA
Web services and SOAWeb services and SOA
Web services and SOA
 
Service Oriented Architecture Updated Luqman
Service Oriented Architecture Updated  LuqmanService Oriented Architecture Updated  Luqman
Service Oriented Architecture Updated Luqman
 
Web services - REST and SOAP
Web services - REST and SOAPWeb services - REST and SOAP
Web services - REST and SOAP
 
SOA and web services
SOA and web servicesSOA and web services
SOA and web services
 
Day03 api
Day03   apiDay03   api
Day03 api
 
Introduction to soapui and webservices
Introduction to soapui  and webservicesIntroduction to soapui  and webservices
Introduction to soapui and webservices
 
Introduction To REST
Introduction To RESTIntroduction To REST
Introduction To REST
 
REST full API Design
REST full API DesignREST full API Design
REST full API Design
 
Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)
 
How APIs Can Be Secured in Mobile Environments
How APIs Can Be Secured in Mobile EnvironmentsHow APIs Can Be Secured in Mobile Environments
How APIs Can Be Secured in Mobile Environments
 
Time to REST: testing web services
Time to REST: testing web servicesTime to REST: testing web services
Time to REST: testing web services
 

Mehr von Mandakini Kumari

Emerging Trends In Cloud Computing.pptx
Emerging Trends In Cloud Computing.pptxEmerging Trends In Cloud Computing.pptx
Emerging Trends In Cloud Computing.pptxMandakini Kumari
 
Building an Edge Computing Strategy - Distributed infrastructure.pptx
Building an Edge Computing Strategy - Distributed infrastructure.pptxBuilding an Edge Computing Strategy - Distributed infrastructure.pptx
Building an Edge Computing Strategy - Distributed infrastructure.pptxMandakini Kumari
 
Emerging Trends in Cloud Computing.pptx
Emerging Trends in Cloud Computing.pptxEmerging Trends in Cloud Computing.pptx
Emerging Trends in Cloud Computing.pptxMandakini Kumari
 
Women in IT & Inspirational Individual of the Year.pptx
Women in IT & Inspirational Individual of the Year.pptxWomen in IT & Inspirational Individual of the Year.pptx
Women in IT & Inspirational Individual of the Year.pptxMandakini Kumari
 
Big data with hadoop Setup on Ubuntu 12.04
Big data with hadoop Setup on Ubuntu 12.04Big data with hadoop Setup on Ubuntu 12.04
Big data with hadoop Setup on Ubuntu 12.04Mandakini Kumari
 
Html5 drupal7 with mandakini kumari(1)
Html5 drupal7 with mandakini kumari(1)Html5 drupal7 with mandakini kumari(1)
Html5 drupal7 with mandakini kumari(1)Mandakini Kumari
 
Php basic for vit university
Php basic for vit universityPhp basic for vit university
Php basic for vit universityMandakini Kumari
 
Drupal7 an introduction by ayushiinfotech
Drupal7 an introduction by ayushiinfotechDrupal7 an introduction by ayushiinfotech
Drupal7 an introduction by ayushiinfotechMandakini Kumari
 
Introduction of drupal7 by ayushi infotech
Introduction of drupal7 by ayushi infotechIntroduction of drupal7 by ayushi infotech
Introduction of drupal7 by ayushi infotechMandakini Kumari
 
Drupal 7 theme by ayushi infotech
Drupal 7 theme by ayushi infotechDrupal 7 theme by ayushi infotech
Drupal 7 theme by ayushi infotechMandakini Kumari
 

Mehr von Mandakini Kumari (10)

Emerging Trends In Cloud Computing.pptx
Emerging Trends In Cloud Computing.pptxEmerging Trends In Cloud Computing.pptx
Emerging Trends In Cloud Computing.pptx
 
Building an Edge Computing Strategy - Distributed infrastructure.pptx
Building an Edge Computing Strategy - Distributed infrastructure.pptxBuilding an Edge Computing Strategy - Distributed infrastructure.pptx
Building an Edge Computing Strategy - Distributed infrastructure.pptx
 
Emerging Trends in Cloud Computing.pptx
Emerging Trends in Cloud Computing.pptxEmerging Trends in Cloud Computing.pptx
Emerging Trends in Cloud Computing.pptx
 
Women in IT & Inspirational Individual of the Year.pptx
Women in IT & Inspirational Individual of the Year.pptxWomen in IT & Inspirational Individual of the Year.pptx
Women in IT & Inspirational Individual of the Year.pptx
 
Big data with hadoop Setup on Ubuntu 12.04
Big data with hadoop Setup on Ubuntu 12.04Big data with hadoop Setup on Ubuntu 12.04
Big data with hadoop Setup on Ubuntu 12.04
 
Html5 drupal7 with mandakini kumari(1)
Html5 drupal7 with mandakini kumari(1)Html5 drupal7 with mandakini kumari(1)
Html5 drupal7 with mandakini kumari(1)
 
Php basic for vit university
Php basic for vit universityPhp basic for vit university
Php basic for vit university
 
Drupal7 an introduction by ayushiinfotech
Drupal7 an introduction by ayushiinfotechDrupal7 an introduction by ayushiinfotech
Drupal7 an introduction by ayushiinfotech
 
Introduction of drupal7 by ayushi infotech
Introduction of drupal7 by ayushi infotechIntroduction of drupal7 by ayushi infotech
Introduction of drupal7 by ayushi infotech
 
Drupal 7 theme by ayushi infotech
Drupal 7 theme by ayushi infotechDrupal 7 theme by ayushi infotech
Drupal 7 theme by ayushi infotech
 

Kürzlich hochgeladen

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 

Kürzlich hochgeladen (20)

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 

Web services soap and rest by mandakini for TechGig

  • 1. Mandakini Kumari June 15th 2012
  • 2. Who am I  Have 9 + years of experience in open source specially PHP, Drupal & Web Services.  Active crusader to improve effectiveness and reach of Free & Open Source Software(FOSS).  Impart industrial consultancy for best use of software application.  Frequently conduct training for students and industrial experts.
  • 3. What am I going to talk about ?  Use of Web Services ?  What is Web Services  Different Ways: SOAP & REST  SOAP Vs REST  How am I going to use REST  Example: Twitter, Paypal
  • 4. Use of Web Services(WS)  Payment Gateway integration for E-commerce site.  Google Map for a Real Estate Site.  Product detail for a price comparison website  Weather forecast for a news or blog site  Mashup: Combine data from one or more source and integrate application
  • 5. Payment Gateway integration http://paypal.com
  • 6. Why WS for Payment getaway  Very Fast  Very Reliable  Secure  User don’t know what getway used by the site  User don’t need to register on payment site e.g. paypal  Website Administration is very easy e.g. IRCT with netbanking ICICI
  • 7. Google Map Web services for your website
  • 8. Top APIs for Mashups http://programmableweb.com/apis
  • 9. What is Web Services(WS)  WS serves as an interface to software developers.  Using WS as an API you can convert applications into web-applications.  WS is the vision of ‘Future Internet’  The basic Web services platform is XML + HTTP.  WS is future for Mobile application
  • 10.
  • 11. What is SOAP  SOAP is a simple XML-based protocol to let applications exchange information over HTTP  Businesses can register their WS on UDDI(Universal Description, Discovery and Integration) and provide documentation with WSDL (Web Services Description Language).  SOAP is mostly used for Enterprise applications to integrate wide types and another trend is to integrate with legacy systems
  • 15. A 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:Envelope>
  • 16. SOAP Header Element  <SOAP-ENV:Header> <RequesterCredentials xmlns=”urn:ebay:api:PayPalAPI” xsi:type=”ebl:CustomSecurityHeaderType”> <Credentials xmlns=”urn:ebay:apis:eBLBaseComponents” xsi:type=”ebl:UserIdPasswordType”> <Username>api_username</Username> <Password>api_password</Password> <Signature>api_signature</Signature> <Subject>authorizing_account_emailaddress</Subject> </Credentials> </RequesterCredentials> </SOAP-ENV:Header>
  • 17. SOAP Body Request Element  <soap:Body> <m:GetPrice mlns:m="http://www.example.com/prices"> <m:Item>Laptop</m:Item> </m:GetPrice> </soap:Body>
  • 18. A SOAP Response  HTTP/1.1 200 OK Content-Type: application/soap+xml; charset=utf-8 Content-Length: nnn <?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.example.com/prices"> <m:Price>$900</m:Price> </m:GetPriceResponse> </soap:Body> </soap:Envelope>
  • 19. PHP SOAP Server Example $server = new SoapServer("Library.wsdl",array("classmap"=>$classmap)); $server->addFunction("searchAuthors"); $server->addFunction("searchBooks"); $server->handle();
  • 20. PHP SOAP Client Example $client=new SoapClient("http://localhost/Library.wsdl",array("trace" => 1)); try { //$response = $client->searchAuthors("Beh"); $response = $client->searchBooks("te"); var_dump($response); echo htmlspecialchars($client->__getLastRequest()).""; echo htmlspecialchars($client->__getLastResponse()).""; }catch(Exception $e){ var_dump($e); echo $client->__getLastRequest(); echo $client->__getLastResponse(); }
  • 21. RESTful Web services  Representational State Transfer (REST) has gained widespread acceptance across the Web  REST permits many different data formats  HTTP consists in URIs, methods, status codes …  REST is great for clean, simple, robust services  REST is a software architecture style used in developing stateless web services  REST is an acronym standing for Representational State Transfer.
  • 23. RESTful Web Service HTTP methods HTTP CRUD SQL POST Create INSERT GET Read SELECT PUT Update UPDATE DELETE Delete DELETE
  • 24. Data Format Supported By REST  xml – almost any programming language can read XML  json – useful for JavaScript and increasingly PHP apps.  csv – open with spreadsheet programs  html – a simple HTML table  php – Representation of PHP code that can be eval()’ed  serialize – Serialized data that can be unserialized in PHP
  • 25. Different Methods to Interact with REST  file_get_contents()  cURL  SimpleXml
  • 26. 1) File_get_contents() <?php $result = file_get_contents('http:// twitter .com/users/show/screenname'); var_dump($result); HTTP Basic authentication you can use the following syntax to get data from your password protected RESTful AP $user = json_decode( file_get_contents('http://admin:1234@example.com/index.php/api/use r/id/1/format/json') ); echo $user->name;
  • 27. REST from PHP: GET(CURL) <?php $ch = curl_init('http://twitter.com/users'); curl_exec($ch);
  • 28. REST from PHP: DELETE <?php $ch = curl_init('http://example.com/users/ginny'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); curl_exec($ch);
  • 30. Why REST /1  Creating clients, developing APIs, and understanding documentation is much easier in REST than SOAP  REST permits many different data formats where as SOAP only permits XML  JSON is a better fit for data and parses very faster  REST allows better support for browser clients due to it’s support for JSON  REST reads can be cached, SOAP based reads cannot be cached.  REST has better performance and scalability.
  • 31. Why SOAP /2  WS-Security: SOAP supports SSL (just like REST) it also supports WS-Security which adds some enterprise security features.  WS-AtomicTransaction: Need ACID Transactions over a service then you need SOAP. While REST supports transactions, it isn’t as comprehensive and isn’t ACID compliant  WS-ReliableMessaging: Rest doesn’t have a standard messaging system and expects clients to deal with communication failures by retrying. SOAP has successful/retry logic built in and provides end-to-end reliability even through SOAP intermediaries.
  • 32. SOAP Vs REST /3  In Summary, SOAP is clearly useful, and important. For instance, if I was writing an iPhone application to interface with my bank I would definitely need to use SOAP. All three features above are required for banking transactions. For example, if I was transferring money from one account to the other, I would need to be certain that it completed. Retrying it could be catastrophic if it succeed the first time, but the response failed.