SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
SOA with C, C++, PHP …
Samisa Abeysinghe
Director, Engineering
WSO2, Inc
SOA is about


            Architectural Design



                    And

We need implementation techniques & tools to
                 build it
Language of your Choice


    You should have freedom to choose
   You might also have reasons to choose
Why C?



      Because it is the most portable

        And bunch of other reasons
                    like
  Many interesting applications written in C
         httpd, PHP, Ruby, MySQL
Why C++?




       Widely used (and some legacy)
 Financial, Banking, Telco, DBMS, Embedded

            And like C it offers:
      Performance, Flexibility, Control
Why PHP?




    Installed on over 20 million websites
                      and
             1 million web servers
             http://www.php.net/usage.php
Chances




Your other application (legacy or green-field) can
           be C, C++, PHP or the like

         Can we get them on the SOA?
SOA in a Heterogeneous World
Expectations



               Tooling for WSDL
                    Security
                Interoperability

           Binary Attachments
               Reliability
Interoperability - PHP
PHP Web Services Frameworks



      Package         Written in   WSDL      Security   Attachments   Reliability


   PHP5 SOAP Ext          C        Partial     No           No           No


      NuSOAP            PHP         Yes        No           No           No


  SCA with PHP(IBM)     PHP         Yes        No           No           No


   WSO2 WSF/PHP           C         Yes        Yes         Yes           Yes
Framework that improves PHP user’s ability to provide
            and consume Web services

 Capable of dealing with secure and relabel messaging
even with binary data, the only PHP software package to
                  offer those features

 The framework is inter-operable with non-PHP imple-
 mentations, allowing it to be integrated with enterprise
              applications seamlessly
PHP Example – Secure Service


1.    function echoFunction($inMessage) {
2.         $returnMessage = new WSMessage($inMessage->str);
3.         return $returnMessage;
4.     }
5.
6.    $pub_key = ws_get_cert_from_file("../keys/alice_cert.cert");
7.    $pvt_key = ws_get_key_from_file("../keys/bob_key.pem");
8.
9.    $operations = array("echoString" => "echoFunction");
10.
11.    $sec_array = array("encrypt" => TRUE, "algorithmSuite" => "Basic256Rsa15",
12.                       "securityTokenReference" => "IssuerSerial");
13.
14.    $actions = array("http://php.axis2.org/samples/echoString" => "echoString");
15.
16.    $policy = new WSPolicy(array("security"=>$sec_array));
17.    $sec_token = new WSSecurityToken(array("privateKey" => $pvt_key,
18.                                           "receiverCertificate" =>$pub_key));
19.
20.    $service = new WSService(array("actions" => $actions,
21.                             "operations" => $operations,
22.                             "policy" => $policy, "securityToken" => $sec_token));
23.
24.    $service->reply();
PHP Example – Secure Client


1.$rec_cert = ws_get_cert_from_file("../keys/bob_cert.cert");
2.$pvt_key = ws_get_key_from_file("../keys/alice_key.pem");
3.
4.$reqMessage = new WSMessage($reqPayloadString, array("to"=>
5.    "http://localhost/samples/security/encryption/encrypt_service.php",
6.    "action" => "http://php.axis2.org/samples/echoString"));
7.
8.$sec_array = array("encrypt"=>TRUE, "algorithmSuite" => "Basic256Rsa15",
9.                       "securityTokenReference" => "IssuerSerial");
10.
11.$policy = new WSPolicy(array("security"=>$sec_array));
12.$sec_token = new WSSecurityToken(array("privateKey" => $pvt_key,
13.                                       "receiverCertificate" => $rec_cert));
14.
15.$client = new WSClient(array("useWSA" => TRUE, "policy" => $policy,
16.                             "securityToken" => $sec_token));
17.
18.$resMessage = $client->request($reqMessage);
19.
20.printf("Response = %s n", $resMessage->str);
How to adapt a C++ Application as Web
Services
C/C++ Web Services Frame-
works



    Package      WSDL      Security   Attachments   Reliability


  HydraExpress   Partial     No         Partial        No


    gSOAP         Yes      Partial       Yes           No


  WSO2 WSF/C     Partial     Yes         Yes           Yes


 WSO2 WSF/C++    Partial     Yes         Yes           Yes
Designed for embedding within C or C++ soft-
    ware stacks to enable Web services

All-in-one solution for the building and deploy-
              ing of Web services

  Widest range of WS-* specifications imple-
                   mentations
WS-Addressing, WS-Policy, WS-Security, WS-
SecurityPolicy, WS-Reliable Messaging, MTOM
                and WS-eventing
C++ Example - Service
1.#include <ServiceSkeleton.h>
2.
3.using namespace wso2wsf;
4.
5.class Echo: public ServiceSkeleton
6.{
7.    public:
8.        WSF_EXTERN WSF_CALL Echo(){};
9.
10.        OMElement* WSF_CALL invoke(OMElement *message, MessageContext *msgCtx);
11.
12.        OMElement* WSF_CALL onFault(OMElement *message);
13.
14.        void WSF_CALL init(){};
15.};

1.OMElement* Echo::invoke(OMElement *element, MessageContext *msgCtx)
2.{
3.    OMElement *echoElement = new OMElement(element->getLocalname(),
4.        new OMNamespace(element->getNamespace(false)->getURI(),
5.                        element->getNamespace(false)->getPrefix()));
6.    OMElement *textElement = new OMElement("messsage");
7.    echoElement->addChild(textElement);
8.    textElement->setText("Hello World");
9.    return echoElement;
10.}
C++ Example - Client
1.ServiceClient serviceClient(client_repo, end_point);
2.
3.OMNamespace * ns = new OMNamespace("http://ws.apache.org/rampart/c/samples", "ns1");
4.OMElement * payload = new OMElement(NULL, "echoIn", ns);
5.OMElement * child = new OMElement(payload, "message", NULL);
6.child->setText("Hello Service!");
7.
8.try
9.{
10.    OMElement* response = serviceClient.request(payload,
11.                "http://example.com/ws/2004/09/policy/Test/EchoRequest");
12.    if (response)
13.    {
14.         cout << endl << "Response: " << response << endl;
15.    }
16.}
17.catch (AxisFault & e)
18.{
19.    if (serviceClient.getLastSOAPFault())
20.    {
21.         cout << endl << "Fault: " << serviceClient.getLastSOAPFault() << endl;
22.    }
23.    else
24.    {
25.             cout << endl << "Error: " << e << endl;
26.    }
27.}
28.delete payload;
Web Services are Fast
Web Services are Faster
Web Services are Still Faster



             For secure services

10K messages C implementation x10 – x15 times
              faster than Java

100k messages C implementation x6 – x8 times
             faster than Java
WSF/C++ Features
   SOAP 1.1 and SOAP 1.2
   WS-Addressing
    1.0
    submission
   MTOM and SwA
    Support for caching large attachments
   WS-Security
    Base security standards mean that messages can be protected
     using Encryption, Authentication and Signature
    Including WS-SecureConversation and WS-Trust
   WSDL2CPP Code Generation tool
    Supports generating client stubs, service skeletons, build
     scripts and deployment scripts
WSF/C++ Features
   WS-Policy and WS-Security Policy
    Enables using industry standard XML to configure security
   SSL Enabled Transport Layer
   WS-Reliable Messaging 1.0, 1.1 and WS-RMPolicy
    Enables reliability between platforms including message resending, duplicate detec-
     tion and persistence
   Full REST support (GET, PUT, DELETE, POST)
    with custom URI Mapping
    Enables mapping a REST API easily and naturally
   Useful tools
    Tcpmon
    wsclient
References
Various   Web Services Frameworks
  http://wso2.org/projects/wsf
SharePoint Web Services
  http://msdn.microsoft.com/en-us/library/bb862916.a
Apache Axis2/C Web Services Performance
  http://wso2.org/library/3532
Example applications for SOA
  http://incubator.apache.org/stonehenge/
PHP Web Services Blog
  http://phpwebservices.blogspot.com/
Q&A

Mais conteúdo relacionado

Destaque

Destaque (14)

IIT JEE Crash Course
IIT JEE Crash Course IIT JEE Crash Course
IIT JEE Crash Course
 
Notes and Important Points on Electrochemistry - JEE Main 2015
Notes and Important Points on Electrochemistry - JEE Main 2015Notes and Important Points on Electrochemistry - JEE Main 2015
Notes and Important Points on Electrochemistry - JEE Main 2015
 
Magical Short Tricks for JEE(Main).
Magical Short Tricks for JEE(Main).Magical Short Tricks for JEE(Main).
Magical Short Tricks for JEE(Main).
 
Top 9 golden tricks of cracking iit jee
Top 9 golden tricks of cracking iit jeeTop 9 golden tricks of cracking iit jee
Top 9 golden tricks of cracking iit jee
 
Sap mm tutorial with screen shots
Sap mm tutorial with screen shotsSap mm tutorial with screen shots
Sap mm tutorial with screen shots
 
Sap mm quick_guide
Sap mm quick_guideSap mm quick_guide
Sap mm quick_guide
 
Sap mm configuration document ramesh kamishetty
Sap mm  configuration document ramesh kamishettySap mm  configuration document ramesh kamishetty
Sap mm configuration document ramesh kamishetty
 
Sap configuration-guide
Sap configuration-guideSap configuration-guide
Sap configuration-guide
 
SAP MM Configuration Step by Step guide by Tata Mcgraw hill
SAP MM Configuration Step by Step guide by Tata Mcgraw hillSAP MM Configuration Step by Step guide by Tata Mcgraw hill
SAP MM Configuration Step by Step guide by Tata Mcgraw hill
 
Mm module sap
Mm module sapMm module sap
Mm module sap
 
SAP BUSINESS BLUE PRINT PRACTICE PROJECT
SAP BUSINESS BLUE PRINT PRACTICE PROJECTSAP BUSINESS BLUE PRINT PRACTICE PROJECT
SAP BUSINESS BLUE PRINT PRACTICE PROJECT
 
SAP MM Configuration - Real Project Documentation
SAP MM Configuration - Real Project DocumentationSAP MM Configuration - Real Project Documentation
SAP MM Configuration - Real Project Documentation
 
SAP MM Standard Business Processes
SAP MM Standard Business ProcessesSAP MM Standard Business Processes
SAP MM Standard Business Processes
 
Sap MM-configuration-step-by-step-guide
Sap MM-configuration-step-by-step-guideSap MM-configuration-step-by-step-guide
Sap MM-configuration-step-by-step-guide
 

Semelhante a SOA with C, C++, PHP and more

WSF PHP 2 Webinar Sep 2008
WSF PHP 2 Webinar Sep 2008WSF PHP 2 Webinar Sep 2008
WSF PHP 2 Webinar Sep 2008
WSO2
 
Php Asp Net Interoperability Rc Jao
Php Asp Net Interoperability Rc JaoPhp Asp Net Interoperability Rc Jao
Php Asp Net Interoperability Rc Jao
jedt
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
johnpragasam1
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
azida3
 
HTML5 vs Silverlight
HTML5 vs SilverlightHTML5 vs Silverlight
HTML5 vs Silverlight
Matt Casto
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
cgt38842
 
RAHUL_Updated( (2)
RAHUL_Updated( (2)RAHUL_Updated( (2)
RAHUL_Updated( (2)
Rahul Singh
 
Stateful SOAP Webservices
Stateful SOAP WebservicesStateful SOAP Webservices
Stateful SOAP Webservices
Mayflower GmbH
 

Semelhante a SOA with C, C++, PHP and more (20)

WSF PHP 2 Webinar Sep 2008
WSF PHP 2 Webinar Sep 2008WSF PHP 2 Webinar Sep 2008
WSF PHP 2 Webinar Sep 2008
 
Php Asp Net Interoperability Rc Jao
Php Asp Net Interoperability Rc JaoPhp Asp Net Interoperability Rc Jao
Php Asp Net Interoperability Rc Jao
 
OWASP_Top_Ten_Proactive_Controls version 2
OWASP_Top_Ten_Proactive_Controls version 2OWASP_Top_Ten_Proactive_Controls version 2
OWASP_Top_Ten_Proactive_Controls version 2
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
 
Interoperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSITInteroperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSIT
 
HTML5 vs Silverlight
HTML5 vs SilverlightHTML5 vs Silverlight
HTML5 vs Silverlight
 
Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
 
OWASP Portland - OWASP Top 10 For JavaScript Developers
OWASP Portland - OWASP Top 10 For JavaScript DevelopersOWASP Portland - OWASP Top 10 For JavaScript Developers
OWASP Portland - OWASP Top 10 For JavaScript Developers
 
Building apps with tuscany
Building apps with tuscanyBuilding apps with tuscany
Building apps with tuscany
 
OWASP_Top_Ten_Proactive_Controls_v32.pptx
OWASP_Top_Ten_Proactive_Controls_v32.pptxOWASP_Top_Ten_Proactive_Controls_v32.pptx
OWASP_Top_Ten_Proactive_Controls_v32.pptx
 
Osiąganie mądrej architektury z Symfony2
Osiąganie mądrej architektury z Symfony2 Osiąganie mądrej architektury z Symfony2
Osiąganie mądrej architektury z Symfony2
 
NodeJS
NodeJSNodeJS
NodeJS
 
RAHUL_Updated( (2)
RAHUL_Updated( (2)RAHUL_Updated( (2)
RAHUL_Updated( (2)
 
Divide and Conquer – Microservices with Node.js
Divide and Conquer – Microservices with Node.jsDivide and Conquer – Microservices with Node.js
Divide and Conquer – Microservices with Node.js
 
Stateful SOAP Webservices
Stateful SOAP WebservicesStateful SOAP Webservices
Stateful SOAP Webservices
 
Web API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural Comparison
 
Mazda siv - web services
Mazda   siv - web servicesMazda   siv - web services
Mazda siv - web services
 
The Windows Runtime and the Web
The Windows Runtime and the WebThe Windows Runtime and the Web
The Windows Runtime and the Web
 

Mais de WSO2

Mais de WSO2 (20)

Driving Innovation: Scania's API Revolution with WSO2
Driving Innovation: Scania's API Revolution with WSO2Driving Innovation: Scania's API Revolution with WSO2
Driving Innovation: Scania's API Revolution with WSO2
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
WSO2CON 2024 - Elevating the Integration Game to the Cloud
WSO2CON 2024 - Elevating the Integration Game to the CloudWSO2CON 2024 - Elevating the Integration Game to the Cloud
WSO2CON 2024 - Elevating the Integration Game to the Cloud
 
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & InnovationWSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
WSO2CON 2024 - OSU & WSO2: A Decade Journey in Integration & Innovation
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
 
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and ApplicationsWSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
WSO2CON 2024 - Architecting AI in the Enterprise: APIs and Applications
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
WSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital BusinessesWSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital Businesses
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of TransformationWSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
 
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 

Último

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
Safe Software
 

Último (20)

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
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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 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, ...
 

SOA with C, C++, PHP and more

  • 1. SOA with C, C++, PHP … Samisa Abeysinghe Director, Engineering WSO2, Inc
  • 2. SOA is about Architectural Design And We need implementation techniques & tools to build it
  • 3. Language of your Choice You should have freedom to choose You might also have reasons to choose
  • 4. Why C? Because it is the most portable And bunch of other reasons like Many interesting applications written in C httpd, PHP, Ruby, MySQL
  • 5. Why C++? Widely used (and some legacy) Financial, Banking, Telco, DBMS, Embedded And like C it offers: Performance, Flexibility, Control
  • 6. Why PHP? Installed on over 20 million websites and 1 million web servers http://www.php.net/usage.php
  • 7. Chances Your other application (legacy or green-field) can be C, C++, PHP or the like Can we get them on the SOA?
  • 8. SOA in a Heterogeneous World
  • 9. Expectations Tooling for WSDL Security Interoperability Binary Attachments Reliability
  • 11. PHP Web Services Frameworks Package Written in WSDL Security Attachments Reliability PHP5 SOAP Ext C Partial No No No NuSOAP PHP Yes No No No SCA with PHP(IBM) PHP Yes No No No WSO2 WSF/PHP C Yes Yes Yes Yes
  • 12. Framework that improves PHP user’s ability to provide and consume Web services Capable of dealing with secure and relabel messaging even with binary data, the only PHP software package to offer those features The framework is inter-operable with non-PHP imple- mentations, allowing it to be integrated with enterprise applications seamlessly
  • 13.
  • 14. PHP Example – Secure Service 1. function echoFunction($inMessage) { 2. $returnMessage = new WSMessage($inMessage->str); 3. return $returnMessage; 4. } 5. 6. $pub_key = ws_get_cert_from_file("../keys/alice_cert.cert"); 7. $pvt_key = ws_get_key_from_file("../keys/bob_key.pem"); 8. 9. $operations = array("echoString" => "echoFunction"); 10. 11. $sec_array = array("encrypt" => TRUE, "algorithmSuite" => "Basic256Rsa15", 12. "securityTokenReference" => "IssuerSerial"); 13. 14. $actions = array("http://php.axis2.org/samples/echoString" => "echoString"); 15. 16. $policy = new WSPolicy(array("security"=>$sec_array)); 17. $sec_token = new WSSecurityToken(array("privateKey" => $pvt_key, 18. "receiverCertificate" =>$pub_key)); 19. 20. $service = new WSService(array("actions" => $actions, 21. "operations" => $operations, 22. "policy" => $policy, "securityToken" => $sec_token)); 23. 24. $service->reply();
  • 15. PHP Example – Secure Client 1.$rec_cert = ws_get_cert_from_file("../keys/bob_cert.cert"); 2.$pvt_key = ws_get_key_from_file("../keys/alice_key.pem"); 3. 4.$reqMessage = new WSMessage($reqPayloadString, array("to"=> 5. "http://localhost/samples/security/encryption/encrypt_service.php", 6. "action" => "http://php.axis2.org/samples/echoString")); 7. 8.$sec_array = array("encrypt"=>TRUE, "algorithmSuite" => "Basic256Rsa15", 9. "securityTokenReference" => "IssuerSerial"); 10. 11.$policy = new WSPolicy(array("security"=>$sec_array)); 12.$sec_token = new WSSecurityToken(array("privateKey" => $pvt_key, 13. "receiverCertificate" => $rec_cert)); 14. 15.$client = new WSClient(array("useWSA" => TRUE, "policy" => $policy, 16. "securityToken" => $sec_token)); 17. 18.$resMessage = $client->request($reqMessage); 19. 20.printf("Response = %s n", $resMessage->str);
  • 16. How to adapt a C++ Application as Web Services
  • 17. C/C++ Web Services Frame- works Package WSDL Security Attachments Reliability HydraExpress Partial No Partial No gSOAP Yes Partial Yes No WSO2 WSF/C Partial Yes Yes Yes WSO2 WSF/C++ Partial Yes Yes Yes
  • 18. Designed for embedding within C or C++ soft- ware stacks to enable Web services All-in-one solution for the building and deploy- ing of Web services Widest range of WS-* specifications imple- mentations WS-Addressing, WS-Policy, WS-Security, WS- SecurityPolicy, WS-Reliable Messaging, MTOM and WS-eventing
  • 19. C++ Example - Service 1.#include <ServiceSkeleton.h> 2. 3.using namespace wso2wsf; 4. 5.class Echo: public ServiceSkeleton 6.{ 7. public: 8. WSF_EXTERN WSF_CALL Echo(){}; 9. 10. OMElement* WSF_CALL invoke(OMElement *message, MessageContext *msgCtx); 11. 12. OMElement* WSF_CALL onFault(OMElement *message); 13. 14. void WSF_CALL init(){}; 15.}; 1.OMElement* Echo::invoke(OMElement *element, MessageContext *msgCtx) 2.{ 3. OMElement *echoElement = new OMElement(element->getLocalname(), 4. new OMNamespace(element->getNamespace(false)->getURI(), 5. element->getNamespace(false)->getPrefix())); 6. OMElement *textElement = new OMElement("messsage"); 7. echoElement->addChild(textElement); 8. textElement->setText("Hello World"); 9. return echoElement; 10.}
  • 20. C++ Example - Client 1.ServiceClient serviceClient(client_repo, end_point); 2. 3.OMNamespace * ns = new OMNamespace("http://ws.apache.org/rampart/c/samples", "ns1"); 4.OMElement * payload = new OMElement(NULL, "echoIn", ns); 5.OMElement * child = new OMElement(payload, "message", NULL); 6.child->setText("Hello Service!"); 7. 8.try 9.{ 10. OMElement* response = serviceClient.request(payload, 11. "http://example.com/ws/2004/09/policy/Test/EchoRequest"); 12. if (response) 13. { 14. cout << endl << "Response: " << response << endl; 15. } 16.} 17.catch (AxisFault & e) 18.{ 19. if (serviceClient.getLastSOAPFault()) 20. { 21. cout << endl << "Fault: " << serviceClient.getLastSOAPFault() << endl; 22. } 23. else 24. { 25. cout << endl << "Error: " << e << endl; 26. } 27.} 28.delete payload;
  • 23. Web Services are Still Faster For secure services 10K messages C implementation x10 – x15 times faster than Java 100k messages C implementation x6 – x8 times faster than Java
  • 24. WSF/C++ Features  SOAP 1.1 and SOAP 1.2  WS-Addressing  1.0  submission  MTOM and SwA  Support for caching large attachments  WS-Security  Base security standards mean that messages can be protected using Encryption, Authentication and Signature  Including WS-SecureConversation and WS-Trust  WSDL2CPP Code Generation tool  Supports generating client stubs, service skeletons, build scripts and deployment scripts
  • 25. WSF/C++ Features  WS-Policy and WS-Security Policy  Enables using industry standard XML to configure security  SSL Enabled Transport Layer  WS-Reliable Messaging 1.0, 1.1 and WS-RMPolicy  Enables reliability between platforms including message resending, duplicate detec- tion and persistence  Full REST support (GET, PUT, DELETE, POST) with custom URI Mapping  Enables mapping a REST API easily and naturally  Useful tools  Tcpmon  wsclient
  • 26. References Various Web Services Frameworks http://wso2.org/projects/wsf SharePoint Web Services http://msdn.microsoft.com/en-us/library/bb862916.a Apache Axis2/C Web Services Performance http://wso2.org/library/3532 Example applications for SOA http://incubator.apache.org/stonehenge/ PHP Web Services Blog http://phpwebservices.blogspot.com/
  • 27. Q&A