SlideShare a Scribd company logo
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
SOA with C, C++, PHP and more
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

More Related Content

Viewers also liked (14)

PPTX
IIT JEE Crash Course
Alok Singh
 
PDF
Notes and Important Points on Electrochemistry - JEE Main 2015
Ednexa
 
PDF
Magical Short Tricks for JEE(Main).
Vijay Joglekar
 
PPTX
Top 9 golden tricks of cracking iit jee
Physics Galaxy
 
DOCX
Sap mm tutorial with screen shots
Pranith P
 
PDF
Sap mm quick_guide
GangaDher Mishra
 
PDF
Sap mm configuration document ramesh kamishetty
Ramesh Kamishetty
 
PDF
Sap configuration-guide
Govind Vikram Aggarwal
 
PDF
SAP MM Configuration Step by Step guide by Tata Mcgraw hill
Venet Dheer
 
PPTX
Mm module sap
Avinash default
 
PDF
SAP BUSINESS BLUE PRINT PRACTICE PROJECT
Venet Dheer
 
PDF
SAP MM Configuration - Real Project Documentation
sapdocs. info
 
DOCX
SAP MM Standard Business Processes
Subhrajyoti (Subhra) Bhattacharjee
 
DOC
Sap MM-configuration-step-by-step-guide
Venet Dheer
 
IIT JEE Crash Course
Alok Singh
 
Notes and Important Points on Electrochemistry - JEE Main 2015
Ednexa
 
Magical Short Tricks for JEE(Main).
Vijay Joglekar
 
Top 9 golden tricks of cracking iit jee
Physics Galaxy
 
Sap mm tutorial with screen shots
Pranith P
 
Sap mm quick_guide
GangaDher Mishra
 
Sap mm configuration document ramesh kamishetty
Ramesh Kamishetty
 
Sap configuration-guide
Govind Vikram Aggarwal
 
SAP MM Configuration Step by Step guide by Tata Mcgraw hill
Venet Dheer
 
Mm module sap
Avinash default
 
SAP BUSINESS BLUE PRINT PRACTICE PROJECT
Venet Dheer
 
SAP MM Configuration - Real Project Documentation
sapdocs. info
 
SAP MM Standard Business Processes
Subhrajyoti (Subhra) Bhattacharjee
 
Sap MM-configuration-step-by-step-guide
Venet Dheer
 

Similar to SOA with C, C++, PHP and more (20)

PDF
WSF PHP 2 Webinar Sep 2008
WSO2
 
PPT
Php Asp Net Interoperability Rc Jao
jedt
 
PPTX
OWASP_Top_Ten_Proactive_Controls version 2
ssuser18349f1
 
PPTX
OWASP_Top_Ten_Proactive_Controls_v2.pptx
azida3
 
PPTX
OWASP_Top_Ten_Proactive_Controls_v2.pptx
johnpragasam1
 
ODP
Interoperable Web Services with JAX-WS and WSIT
Carol McDonald
 
KEY
HTML5 vs Silverlight
Matt Casto
 
PDF
Webservices in SalesForce (part 1)
Mindfire Solutions
 
PPTX
OWASP_Top_Ten_Proactive_Controls_v2.pptx
cgt38842
 
PDF
OWASP Portland - OWASP Top 10 For JavaScript Developers
Lewis Ardern
 
PDF
Building apps with tuscany
Luciano Resende
 
PPTX
OWASP_Top_Ten_Proactive_Controls_v32.pptx
nmk42194
 
PDF
Osiąganie mądrej architektury z Symfony2
3camp
 
PPTX
NodeJS
Alok Guha
 
PDF
RAHUL_Updated( (2)
Rahul Singh
 
PDF
Divide and Conquer – Microservices with Node.js
Sebastian Springer
 
PDF
Stateful SOAP Webservices
Mayflower GmbH
 
PPTX
Web API or WCF - An Architectural Comparison
Adnan Masood
 
PDF
Mazda siv - web services
Olivier Lépine
 
PPTX
The Windows Runtime and the Web
Jeremy Likness
 
WSF PHP 2 Webinar Sep 2008
WSO2
 
Php Asp Net Interoperability Rc Jao
jedt
 
OWASP_Top_Ten_Proactive_Controls version 2
ssuser18349f1
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
azida3
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
johnpragasam1
 
Interoperable Web Services with JAX-WS and WSIT
Carol McDonald
 
HTML5 vs Silverlight
Matt Casto
 
Webservices in SalesForce (part 1)
Mindfire Solutions
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
cgt38842
 
OWASP Portland - OWASP Top 10 For JavaScript Developers
Lewis Ardern
 
Building apps with tuscany
Luciano Resende
 
OWASP_Top_Ten_Proactive_Controls_v32.pptx
nmk42194
 
Osiąganie mądrej architektury z Symfony2
3camp
 
NodeJS
Alok Guha
 
RAHUL_Updated( (2)
Rahul Singh
 
Divide and Conquer – Microservices with Node.js
Sebastian Springer
 
Stateful SOAP Webservices
Mayflower GmbH
 
Web API or WCF - An Architectural Comparison
Adnan Masood
 
Mazda siv - web services
Olivier Lépine
 
The Windows Runtime and the Web
Jeremy Likness
 
Ad

More from WSO2 (20)

PDF
Quantum Threats Are Closer Than You Think – Act Now to Stay Secure
WSO2
 
PDF
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
WSO2
 
PDF
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
WSO2
 
PDF
Build Smarter, Deliver Faster with Choreo - An AI Native Internal Developer P...
WSO2
 
PDF
Platformless Modernization with Choreo.pdf
WSO2
 
PDF
Application Modernization with Choreo for the BFSI Sector
WSO2
 
PDF
Choreo - The AI-Native Internal Developer Platform as a Service: Overview
WSO2
 
PDF
[Roundtable] Choreo - The AI-Native Internal Developer Platform as a Service
WSO2
 
PPTX
WSO2Con 2025 - Building AI Applications in the Enterprise (Part 1)
WSO2
 
PPTX
WSO2Con 2025 - Building Secure Business Customer and Partner Experience (B2B)...
WSO2
 
PPTX
WSO2Con 2025 - Building Secure Customer Experience Apps
WSO2
 
PPTX
WSO2Con 2025 - AI-Driven API Design, Development, and Consumption with Enhanc...
WSO2
 
PPTX
WSO2Con 2025 - AI-Driven API Design, Development, and Consumption with Enhanc...
WSO2
 
PPTX
WSO2Con 2025 - Unified Management of Ingress and Egress Across Multiple API G...
WSO2
 
PPTX
WSO2Con 2025 - How an Internal Developer Platform Lets Developers Focus on Code
WSO2
 
PPTX
WSO2Con 2025 - Architecting Cloud-Native Applications
WSO2
 
PDF
Mastering Intelligent Digital Experiences with Platformless Modernization
WSO2
 
PDF
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
PDF
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
 
PDF
architecting-ai-in-the-enterprise-apis-and-applications.pdf
WSO2
 
Quantum Threats Are Closer Than You Think – Act Now to Stay Secure
WSO2
 
Modern Platform Engineering with Choreo - The AI-Native Internal Developer Pl...
WSO2
 
Application Modernization with Choreo - The AI-Native Internal Developer Plat...
WSO2
 
Build Smarter, Deliver Faster with Choreo - An AI Native Internal Developer P...
WSO2
 
Platformless Modernization with Choreo.pdf
WSO2
 
Application Modernization with Choreo for the BFSI Sector
WSO2
 
Choreo - The AI-Native Internal Developer Platform as a Service: Overview
WSO2
 
[Roundtable] Choreo - The AI-Native Internal Developer Platform as a Service
WSO2
 
WSO2Con 2025 - Building AI Applications in the Enterprise (Part 1)
WSO2
 
WSO2Con 2025 - Building Secure Business Customer and Partner Experience (B2B)...
WSO2
 
WSO2Con 2025 - Building Secure Customer Experience Apps
WSO2
 
WSO2Con 2025 - AI-Driven API Design, Development, and Consumption with Enhanc...
WSO2
 
WSO2Con 2025 - AI-Driven API Design, Development, and Consumption with Enhanc...
WSO2
 
WSO2Con 2025 - Unified Management of Ingress and Egress Across Multiple API G...
WSO2
 
WSO2Con 2025 - How an Internal Developer Platform Lets Developers Focus on Code
WSO2
 
WSO2Con 2025 - Architecting Cloud-Native Applications
WSO2
 
Mastering Intelligent Digital Experiences with Platformless Modernization
WSO2
 
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2
 
architecting-ai-in-the-enterprise-apis-and-applications.pdf
WSO2
 
Ad

Recently uploaded (20)

PDF
Building Resilience with Digital Twins : Lessons from Korea
SANGHEE SHIN
 
PDF
July Patch Tuesday
Ivanti
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
PDF
CloudStack GPU Integration - Rohit Yadav
ShapeBlue
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Persuasive AI: risks and opportunities in the age of digital debate
Speck&Tech
 
PDF
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
PDF
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PPTX
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
Building Resilience with Digital Twins : Lessons from Korea
SANGHEE SHIN
 
July Patch Tuesday
Ivanti
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
CloudStack GPU Integration - Rohit Yadav
ShapeBlue
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Persuasive AI: risks and opportunities in the age of digital debate
Speck&Tech
 
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
Meetup Kickoff & Welcome - Rohit Yadav, CSIUG Chairman
ShapeBlue
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 

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
  • 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