WSO2 SOA with C and C++
 

WSO2 SOA with C and C++

on

  • 2,059 views

 

Statistics

Views

Total Views
2,059
Views on SlideShare
2,057
Embed Views
2

Actions

Likes
0
Downloads
30
Comments
0

1 Embed 2

http://www.slideshare.net 2

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    WSO2 SOA with C and C++ WSO2 SOA with C and C++ Presentation Transcript

    • 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