SlideShare una empresa de Scribd logo
1 de 24
Descargar para leer sin conexión
SOA WITH C, C++, PHP …
  Supun Kamburugamuva
  supun@wso2.com
SOA Workshop
                                        Santa Clara


Language of your choice
   You must have Freedom to choose
   You must have Reasons to choose
SOA Workshop
                                                   Santa Clara


Why C?
   Most portable
   Less memory
   Faster
   Many interesting applications written in C
     HTTPD

     Ruby

     MySQL

     PHP
SOA Workshop
                                                      Santa Clara


Why C++?
   Widely used (and some legacy)
     Financial,   Banking, Telco, DBMS, Embedded
   Performance, Flexibility, Control
SOA Workshop
                                                  Santa Clara


Why PHP?
   Installed on over 20 million websites
   1 million web servers
   Easiest way to write services and clients
SOA Workshop
                                 Santa Clara


SOA in a Heterogeneous World
SOA Workshop
                           Santa Clara


Expectations
   Tooling for WSDL
   Security
   Interoperability
   Binary attachments
   Reliability
   Support
SOA Workshop
                                                                       Santa Clara


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          Ye s        Ye s
SOA Workshop
                                                  Santa Clara




 Framework that improves PHP user’s ability to
  provide and consume Web services
 Capable of dealing with secure and reliable

  messaging even with binary data, the only PHP
  software package to offer those features
 The framework is inter-operable with non-PHP

  implementations, allowing it to be integrated with
  enterprise applications seamlessly
SOA Workshop
  Santa Clara
SOA Workshop
                                                                                            Santa Clara


     PHP Example – Secure Service
1.    function echoFunction($inMessage) {
2.         $returnMessage = new WSMessage($inMessage->str);
3.         return $returnMessage;
4.     }


1.     $pub_key = ws_get_cert_from_file("../keys/alice_cert.cert");
2.     $pvt_key = ws_get_key_from_file("../keys/bob_key.pem");


1.     $operations = array("echoString" => "echoFunction");


1.     $sec_array = array("encrypt" => TRUE, "algorithmSuite" => "Basic256Rsa15",
2.                          "securityTokenReference" => "IssuerSerial");


1.     $actions = array("http://php.axis2.org/samples/echoString" => "echoString");


1.     $policy = new WSPolicy(array("security"=>$sec_array));
2.     $sec_token = new WSSecurityToken(array("privateKey" => $pvt_key,
3.                                              "receiverCertificate" =>$pub_key));


1.     $service = new WSService(array("actions" => $actions,
2.                                "operations" => $operations,
3.                                "policy" => $policy, "securityToken" => $sec_token));


1.     $service->reply();
SOA Workshop
                                                                                 Santa Clara


     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");

1.   $reqMessage = new WSMessage($reqPayloadString, array("to"=>
2.       "http://localhost/samples/security/encryption/encrypt_service.php",
3.       "action" => "http://php.axis2.org/samples/echoString"));

1.   $sec_array = array("encrypt"=>TRUE, "algorithmSuite" => "Basic256Rsa15",
2.                          "securityTokenReference" => "IssuerSerial");

1.   $policy = new WSPolicy(array("security"=>$sec_array));
2.   $sec_token = new WSSecurityToken(array("privateKey" => $pvt_key,
3.                                          "receiverCertificate" => $rec_cert));

1.   $client = new WSClient(array("useWSA" => TRUE, "policy" => $policy,
2.                                "securityToken" => $sec_token));

1.   $resMessage = $client->request($reqMessage);

1.   printf("Response = %s n", $resMessage->str);
SOA Workshop

How to adapt a C++ Application as Santa Clara




Web Services
SOA Workshop
                                                           Santa Clara


C/C++ Web Services Frameworks


   Package      WSDL      Security   Attachments   Reliability


 HydraExpress   Partial     No         Partial        No


   gSOAP         Yes      Partial       Yes           No


 WSO2 WSF/C     Partial     Ye s        Yes           Yes


WSO2 WSF/C++    Partial     Ye s        Yes           Yes
SOA Workshop
                                                      Santa Clara




   Designed for embedding within C or C++ software
    stacks to enable Web services
   All-in-one solution for the building and deploying of
    Web services
   Widest range of WS-* specifications
    implementations
   WS-Addressing, WS-Policy, WS-Security, WS-
    SecurityPolicy, WS-Reliable Messaging, MTOM and
    WS-eventing
SOA Workshop
                                                                                           Santa Clara


 C++ Example - Service
1.    #include <ServiceSkeleton.h>


1.    using namespace wso2wsf;


1.    class Echo: public ServiceSkeleton
2.    {
3.         public:
4.             WSF_EXTERN WSF_CALL Echo(){};


1.             OMElement* WSF_CALL invoke(OMElement *message, MessageContext *msgCtx);


1.             OMElement* WSF_CALL onFault(OMElement *message);


1.             void WSF_CALL init(){};
2.    };


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.   }
SOA Workshop
                                                                                                     Santa Clara


     C++ Example - Client
1.    ServiceClient serviceClient(client_repo, end_point);


1.    OMNamespace * ns = new OMNamespace("http://ws.apache.org/rampart/c/samples",       "ns1");
2.    OMElement * payload = new OMElement(NULL, "echoIn", ns);
3.    OMElement * child = new OMElement(payload, "message", NULL);
4.    child->setText("Hello Service!");


1.    try
2.    {
3.          OMElement* response = serviceClient.request(payload,
4.                       "http://example.com/ws/2004/09/policy/Test/EchoRequest");
5.          if (response)
6.          {
7.                 cout << endl << "Response: " << response << endl;
8.          }
9.    }
10.   catch (AxisFault & e)
11.   {
12.         if (serviceClient.getLastSOAPFault())
13.         {
14.                cout << endl << "Fault: " << serviceClient.getLastSOAPFault() << endl;
15.         }
16.         else
17.         {
18.                   cout << endl << "Error: " << e << endl;
19.         }
20.   }
21.   delete payload;
SOA Workshop
                          Santa Clara


Web Services are Fast
SOA Workshop
                            Santa Clara


Web Services are Faster
SOA Workshop
                                                       Santa Clara


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
SOA Workshop
                                                                            Santa Clara


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
SOA Workshop
                                                                                           Santa Clara


WSF/C++ Features
   WS-Policy and WS-Security Policy
       Enables using industry standard XML to confgure security

   SSL Enabled Transport Layer
   Reliable Messaging 1.0, 1.1 and WS-RMPolicy
       Enables reliability between platforms including message resending, duplicate detection 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
SOA Workshop
                                                Santa Clara


References
   Various Web Services Frameworks
    http://wso2.org/projects/wsf
   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/
SOA Workshop
               Santa Clara


Thank You!
   Q&A

Más contenido relacionado

Destacado

Destacado (7)

Usage Note of Apache Thrift for C++ Java PHP Languages
Usage Note of Apache Thrift for C++ Java PHP LanguagesUsage Note of Apache Thrift for C++ Java PHP Languages
Usage Note of Apache Thrift for C++ Java PHP Languages
 
How to master C++
How to master C++How to master C++
How to master C++
 
Detecção de Fraudes em Licitações Usando Batch Analytics com WSO2
Detecção de Fraudes em Licitações Usando Batch Analytics com WSO2Detecção de Fraudes em Licitações Usando Batch Analytics com WSO2
Detecção de Fraudes em Licitações Usando Batch Analytics com WSO2
 
Solution Architecture Patterns for Digital Transformation
Solution Architecture Patterns for Digital TransformationSolution Architecture Patterns for Digital Transformation
Solution Architecture Patterns for Digital Transformation
 
Dealing with Common Data Requirements in Your Enterprise
Dealing with Common Data Requirements in Your EnterpriseDealing with Common Data Requirements in Your Enterprise
Dealing with Common Data Requirements in Your Enterprise
 
Soluciones para Mejorar la Toma de Decisiones, la Analítica en Tiempo Real y ...
Soluciones para Mejorar la Toma de Decisiones, la Analítica en Tiempo Real y ...Soluciones para Mejorar la Toma de Decisiones, la Analítica en Tiempo Real y ...
Soluciones para Mejorar la Toma de Decisiones, la Analítica en Tiempo Real y ...
 
2016 Year End Webinar - Are You Ready for Digital Transformation?
2016 Year End Webinar - Are You Ready for Digital Transformation?2016 Year End Webinar - Are You Ready for Digital Transformation?
2016 Year End Webinar - Are You Ready for Digital Transformation?
 

Similar a WSO2 SOA with C and C++

WSF PHP 2 Webinar Sep 2008
WSF PHP 2 Webinar Sep 2008WSF PHP 2 Webinar Sep 2008
WSF PHP 2 Webinar Sep 2008
WSO2
 
Stateful SOAP Webservices
Stateful SOAP WebservicesStateful SOAP Webservices
Stateful SOAP Webservices
Mayflower GmbH
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
Tom Croucher
 

Similar a WSO2 SOA with C and C++ (20)

WSF PHP 2 Webinar Sep 2008
WSF PHP 2 Webinar Sep 2008WSF PHP 2 Webinar Sep 2008
WSF PHP 2 Webinar Sep 2008
 
Building apps with tuscany
Building apps with tuscanyBuilding apps with tuscany
Building apps with tuscany
 
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 202010 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
10 Excellent Ways to Secure Spring Boot Applications - Okta Webinar 2020
 
Kraken Front-Trends
Kraken Front-TrendsKraken Front-Trends
Kraken Front-Trends
 
AWS Lambda with Serverless Framework and Java
AWS Lambda with Serverless Framework and JavaAWS Lambda with Serverless Framework and Java
AWS Lambda with Serverless Framework and Java
 
Stateful SOAP Webservices
Stateful SOAP WebservicesStateful SOAP Webservices
Stateful SOAP Webservices
 
Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2Top Ten Java Defense for Web Applications v2
Top Ten Java Defense for Web Applications v2
 
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...Maxim Salnikov - Service Worker: taking the best from the past experience for...
Maxim Salnikov - Service Worker: taking the best from the past experience for...
 
Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?
Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?
Connect2017 DEV-1550 Why Java 8? Or, What's a Lambda?
 
DEV-1550: Why Java 8? Or, What's a Lambda? – IBM Connect 2017
DEV-1550: Why Java 8? Or, What's a Lambda? – IBM Connect 2017DEV-1550: Why Java 8? Or, What's a Lambda? – IBM Connect 2017
DEV-1550: Why Java 8? Or, What's a Lambda? – IBM Connect 2017
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Real World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS ApplicationReal World Lessons on the Pain Points of Node.JS Application
Real World Lessons on the Pain Points of Node.JS Application
 
Scaling asp.net websites to millions of users
Scaling asp.net websites to millions of usersScaling asp.net websites to millions of users
Scaling asp.net websites to millions of users
 
8 Minutes On Rack
8 Minutes On Rack8 Minutes On Rack
8 Minutes On Rack
 
Introduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comIntroduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.com
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
NodeJS "Web en tiempo real"
NodeJS "Web en tiempo real"NodeJS "Web en tiempo real"
NodeJS "Web en tiempo real"
 
Future Decoded - Node.js per sviluppatori .NET
Future Decoded - Node.js per sviluppatori .NETFuture Decoded - Node.js per sviluppatori .NET
Future Decoded - Node.js per sviluppatori .NET
 
JavaFX Pitfalls
JavaFX PitfallsJavaFX Pitfalls
JavaFX Pitfalls
 
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
 

Más de WSO2

Más 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

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
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
 
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
Victor Rentea
 

Último (20)

Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
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...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
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
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
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 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 - 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 New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
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, ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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
 
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 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 

WSO2 SOA with C and C++

  • 1. SOA WITH C, C++, PHP … Supun Kamburugamuva supun@wso2.com
  • 2. SOA Workshop Santa Clara Language of your choice  You must have Freedom to choose  You must have Reasons to choose
  • 3. SOA Workshop Santa Clara Why C?  Most portable  Less memory  Faster  Many interesting applications written in C  HTTPD  Ruby  MySQL  PHP
  • 4. SOA Workshop Santa Clara Why C++?  Widely used (and some legacy)  Financial, Banking, Telco, DBMS, Embedded  Performance, Flexibility, Control
  • 5. SOA Workshop Santa Clara Why PHP?  Installed on over 20 million websites  1 million web servers  Easiest way to write services and clients
  • 6. SOA Workshop Santa Clara SOA in a Heterogeneous World
  • 7. SOA Workshop Santa Clara Expectations  Tooling for WSDL  Security  Interoperability  Binary attachments  Reliability  Support
  • 8. SOA Workshop Santa Clara 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 Ye s Ye s
  • 9. SOA Workshop Santa Clara  Framework that improves PHP user’s ability to provide and consume Web services  Capable of dealing with secure and reliable messaging even with binary data, the only PHP software package to offer those features  The framework is inter-operable with non-PHP implementations, allowing it to be integrated with enterprise applications seamlessly
  • 10. SOA Workshop Santa Clara
  • 11. SOA Workshop Santa Clara PHP Example – Secure Service 1. function echoFunction($inMessage) { 2. $returnMessage = new WSMessage($inMessage->str); 3. return $returnMessage; 4. } 1. $pub_key = ws_get_cert_from_file("../keys/alice_cert.cert"); 2. $pvt_key = ws_get_key_from_file("../keys/bob_key.pem"); 1. $operations = array("echoString" => "echoFunction"); 1. $sec_array = array("encrypt" => TRUE, "algorithmSuite" => "Basic256Rsa15", 2. "securityTokenReference" => "IssuerSerial"); 1. $actions = array("http://php.axis2.org/samples/echoString" => "echoString"); 1. $policy = new WSPolicy(array("security"=>$sec_array)); 2. $sec_token = new WSSecurityToken(array("privateKey" => $pvt_key, 3. "receiverCertificate" =>$pub_key)); 1. $service = new WSService(array("actions" => $actions, 2. "operations" => $operations, 3. "policy" => $policy, "securityToken" => $sec_token)); 1. $service->reply();
  • 12. SOA Workshop Santa Clara 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"); 1. $reqMessage = new WSMessage($reqPayloadString, array("to"=> 2. "http://localhost/samples/security/encryption/encrypt_service.php", 3. "action" => "http://php.axis2.org/samples/echoString")); 1. $sec_array = array("encrypt"=>TRUE, "algorithmSuite" => "Basic256Rsa15", 2. "securityTokenReference" => "IssuerSerial"); 1. $policy = new WSPolicy(array("security"=>$sec_array)); 2. $sec_token = new WSSecurityToken(array("privateKey" => $pvt_key, 3. "receiverCertificate" => $rec_cert)); 1. $client = new WSClient(array("useWSA" => TRUE, "policy" => $policy, 2. "securityToken" => $sec_token)); 1. $resMessage = $client->request($reqMessage); 1. printf("Response = %s n", $resMessage->str);
  • 13. SOA Workshop How to adapt a C++ Application as Santa Clara Web Services
  • 14. SOA Workshop Santa Clara C/C++ Web Services Frameworks Package WSDL Security Attachments Reliability HydraExpress Partial No Partial No gSOAP Yes Partial Yes No WSO2 WSF/C Partial Ye s Yes Yes WSO2 WSF/C++ Partial Ye s Yes Yes
  • 15. SOA Workshop Santa Clara  Designed for embedding within C or C++ software stacks to enable Web services  All-in-one solution for the building and deploying of Web services  Widest range of WS-* specifications implementations  WS-Addressing, WS-Policy, WS-Security, WS- SecurityPolicy, WS-Reliable Messaging, MTOM and WS-eventing
  • 16. SOA Workshop Santa Clara C++ Example - Service 1. #include <ServiceSkeleton.h> 1. using namespace wso2wsf; 1. class Echo: public ServiceSkeleton 2. { 3. public: 4. WSF_EXTERN WSF_CALL Echo(){}; 1. OMElement* WSF_CALL invoke(OMElement *message, MessageContext *msgCtx); 1. OMElement* WSF_CALL onFault(OMElement *message); 1. void WSF_CALL init(){}; 2. }; 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. }
  • 17. SOA Workshop Santa Clara C++ Example - Client 1. ServiceClient serviceClient(client_repo, end_point); 1. OMNamespace * ns = new OMNamespace("http://ws.apache.org/rampart/c/samples", "ns1"); 2. OMElement * payload = new OMElement(NULL, "echoIn", ns); 3. OMElement * child = new OMElement(payload, "message", NULL); 4. child->setText("Hello Service!"); 1. try 2. { 3. OMElement* response = serviceClient.request(payload, 4. "http://example.com/ws/2004/09/policy/Test/EchoRequest"); 5. if (response) 6. { 7. cout << endl << "Response: " << response << endl; 8. } 9. } 10. catch (AxisFault & e) 11. { 12. if (serviceClient.getLastSOAPFault()) 13. { 14. cout << endl << "Fault: " << serviceClient.getLastSOAPFault() << endl; 15. } 16. else 17. { 18. cout << endl << "Error: " << e << endl; 19. } 20. } 21. delete payload;
  • 18. SOA Workshop Santa Clara Web Services are Fast
  • 19. SOA Workshop Santa Clara Web Services are Faster
  • 20. SOA Workshop Santa Clara 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
  • 21. SOA Workshop Santa Clara 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
  • 22. SOA Workshop Santa Clara WSF/C++ Features  WS-Policy and WS-Security Policy  Enables using industry standard XML to confgure security  SSL Enabled Transport Layer  Reliable Messaging 1.0, 1.1 and WS-RMPolicy  Enables reliability between platforms including message resending, duplicate detection 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
  • 23. SOA Workshop Santa Clara References  Various Web Services Frameworks http://wso2.org/projects/wsf  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/
  • 24. SOA Workshop Santa Clara Thank You!  Q&A