How To Create A C++ Web Service

Similar documents
A standards-based approach to application integration

Increasing IT flexibility with IBM WebSphere ESB software.

Increasing IT flexibility with IBM WebSphere ESB software.

Beeple, B-Pel, Beepul? Understanding BPEL and Its Role in SOA

The Enterprise Service Bus

1 What Are Web Services?

SCA & SDO Implementations Open Source and Vendor Products

Oracle BPEL Nuts and Bolts

Service Mediation. The Role of an Enterprise Service Bus in an SOA

What You Need to Know About Transitioning to SOA

Oracle Service Bus. Situation. Oracle Service Bus Primer. Product History and Evolution. Positioning. Usage Scenario

Motivation Definitions EAI Architectures Elements Integration Technologies. Part I. EAI: Foundations, Concepts, and Architectures

Introduction to WebSphere Process Server and WebSphere Enterprise Service Bus

SCA-based Enterprise Service Bus WebSphere ESB

1 What Are Web Services?

Enterprise Service Bus: Five Keys for Taking a Ride

Service Oriented Architecture

Orchestrating Web Services: The Case for a BPEL Server. An Oracle White Paper June 2004

Service-Oriented Architecture and its Implications for Software Life Cycle Activities

Technical Track Session Service-Oriented Architecture

AquaLogic Service Bus

Analyses on functional capabilities of BizTalk Server, Oracle BPEL Process Manger and WebSphere Process Server for applications in Grid middleware

WEB SERVICES. Revised 9/29/2015

What Is the Java TM 2 Platform, Enterprise Edition?

A Unified Messaging-Based Architectural Pattern for Building Scalable Enterprise Service Bus

Open Source SOA with Service Component Architecture and Apache Tuscany. Jean-Sebastien Delfino Mario Antollini Raymond Feng

IBM WebSphere MQ File Transfer Edition, Version 7.0

Getting Started with Service- Oriented Architecture (SOA) Terminology

Oracle WebLogic Foundation of Oracle Fusion Middleware. Lawrence Manickam Toyork Systems Inc

Introduction into Web Services (WS)

An introduction to SOA and the HP NonStop server environment

A Quick Introduction to SOA

SOA and ESB. Mark Jeynes IBM Software, Asia Pacific

ActiveVOS Server Architecture. March 2009

JSLEE and SIP-Servlets Interoperability with Mobicents Communication Platform

EVALUATING INTEGRATION SOFTWARE

IBM WebSphere Enterprise Service Bus, Version 6.0.1

Designing an Enterprise Application Framework for Service-Oriented Architecture 1

ITS. Java WebService. ITS Data-Solutions Pvt Ltd BENEFITS OF ATTENDANCE:

T Network Application Frameworks and XML Web Services and WSDL Tancred Lindholm

ENTERPRISE SERVICES. By Paul Fremantle, Sanjiva Weerawarana, and Rania Khalaf

Service Oriented Architecture Case: IBM SOA Reference Architecture

So You Want an SOA: Best Practices for Migrating to SOA in the Enterprise. Eric Newcomer, CTO

IBM Rational Rapid Developer Components & Web Services

IBM WebSphere ESB V6.0.1 Technical Product Overview

Service Computing: Basics Monica Scannapieco

Developing Java Web Services

The Evolution from EAI to ESB

The webmethods ESB. The Foundation of your SOA. Jean-Michel Ghyoot, Principal Solution Architect, March 28, 2013

Contents. Client-server and multi-tier architectures. The Java 2 Enterprise Edition (J2EE) platform

David Pilling Director of Applications and Development

Delivering a platform-independent based ESB for universal connectivity and transformation in heterogeneous IT environments.

SOA Fundamentals For Java Developers. Alexander Ulanov, System Architect Odessa, 30 September 2008

Oracle SOA Suite 11g: Essential Concepts Student Guide

TIBCO ActiveMatrix SOA Concepts. Software Release November 2012 BPM

Case Studies of Running the Platform. NetBeans UML Servlet JSP GlassFish EJB

Oracle SOA Reference Architecture

IBM WebSphere application integration software: A faster way to respond to new business-driven opportunities.

SOA Best Practices (from monolithic to service-oriented)

Enterprise IT Architectures SOA Part 2

Service Component Architecture, Apache Tuscany & WebSphere SOA Feature Pack Beta

Introduction to Enterprise Service Bus

E-Business Suite Oracle SOA Suite Integration Options

2012 LABVANTAGE Solutions, Inc. All Rights Reserved.

Oracle Service Bus Examples and Tutorials

e-gov Architecture Service Interface Guidelines

Service Governance and Virtualization For SOA

Service-Oriented Architectures

ebay : How is it a hit

IBM Rational Web Developer for WebSphere Software Version 6.0

Integrating Siebel CRM 8 with Oracle Applications

The Challenges in Real Life ESB Deployments

Jitterbit Technical Overview : Microsoft Dynamics CRM

OASIS Implementation - Version 1.1.1

An Oracle White Paper October Maximize the Benefits of Oracle SOA Suite 11g with Oracle Service Bus

Middleware and the Internet. Example: Shopping Service. What could be possible? Service Oriented Architecture

JBOSS ENTERPRISE SOA PLATFORM AND JBOSS ENTERPRISE DATA SERVICES PLATFORM VALUE PROPOSITION AND DIFFERENTIATION

Objectif. Participant. Prérequis. Pédagogie. Oracle SOA Suite 11g - Build Composite Applications. 5 Jours [35 Heures]

What is the NXTware Evolution Server Peter Marquez, Product Marketing ecube Systems

JBoss enterprise soa platform

Contents. Overview 1 SENTINET

IBM CICS Transaction Gateway for Multiplatforms, Version 7.0

Emerging Technologies Shaping the Future of Data Warehouses & Business Intelligence

Combining Service-Oriented Architecture and Event-Driven Architecture using an Enterprise Service Bus

EAI OVERVIEW OF ENTERPRISE APPLICATION INTEGRATION CONCEPTS AND ARCHITECTURES. Enterprise Application Integration. Peter R. Egli INDIGOO.

Rapid application development for JEE using Adobe ColdFusion 9

CICS Modernization & Integration

Leveraging Service Oriented Architecture (SOA) to integrate Oracle Applications with SalesForce.com

An Oracle White Paper March Guide to Implementing Application Integration Architecture on Oracle Service Bus

FUSE-ESB4 An open-source OSGi based platform for EAI and SOA

Building and Deploying Enterprise M2M Applications with Axeda Platform

An empirical study of messaging systems and migration to service-oriented architecture

GETTING STARTED GUIDE

TIBCO ActiveMatrix Service Bus Getting Started. Software Release 2.3 February 2010

Overview: Siebel Enterprise Application Integration. Siebel Innovation Pack 2013 Version 8.1/8.2 September 2013

An Oracle White Paper June Integration Technologies for Primavera Solutions

WebSphere ESB Best Practices

SOA Myth or Reality??

LinuxWorld Conference & Expo Server Farms and XML Web Services

Developing SOA solutions using IBM SOA Foundation

Transcription:

A Guide to Creating C++ Web Services WHITE PAPER

Abstract This whitepaper provides an introduction to creating C++ Web services and focuses on:» Challenges involved in integrating C++ applications with Web services» Benefits of using C++ Web services» An example showing step by step how to create and implement a C++ Web service» Advanced Web services features Introduction This paper describes how to develop and host high performance C++ Web services, including using advanced XML, SOAP, and WSDL productivity tools for transforming new and existing C++ applications for use in Service Oriented Architectures (SOA). The focus is on HydraExpress, part of the Rogue Wave Hydra Suite, which also includes the HydraSDO data components that implement the Service Data Object (SDO) specification, and HydraSCA, the first product available for deploying high-performance SOA applications based on the Service Component Architecture (SCA) specification. The SDO and SCA specifications are multi-language industry SOA specifications available in both Java and C++. Challenges of Integrating C++ with Web Services Over the years, many organizations have made significant investments in C++ and now need to leverage the business logic locked in these applications. However, web service technologies are focused in Java and Microsoft.NET, making it difficult to address systems created outside of these environments. Integrating C++ applications using Web services is a formidable challenge because:» Web services require foundation pieces not supplied by C++ platform/libraries, including critical protocol implementations such as HTTP requests and responses.» Since C++ is a compile time language it is difficult to map it with dynamic systems like Web services.» C++ is a very high-performance language, but writing scalable, threaded infrastructure code can be very complicated. Often, new message bus middleware is purchased to address this challenge. Message bus products provide a C++ API and may require significant changes to the existing application. The middleware then uses costly bridges to communicate with the rest of the enterprise, thereby providing access to the C++ application. The WHITE PAPER PAGE 2

use of middleware creates a tightly coupled system by tying the C++ application to only that message bus and its ability to provide compatibility with the rest of the enterprise. This is not only time consuming and error prone, but reduces flexibility compared to Web services which, once exposed from the C++ application, can be easily linked to the rest of the enterprise. Building C++ Web Services Using a lightweight framework such as HydraExpress provides an alternative to heavyweight middleware like CORBA. By providing an intuitive and powerful framework based on standards such as HTTP, SOAP, WSDL, and XML, development costs are reduced and it is possible to rapidly modify applications as business needs change. Developers can quickly transform a monolithic application into C++ Web Services that can natively interact with all other parts of the technology infrastructure. Code generation technology provides a customized, service-specific programmatic interface built upon a robust framework for communicating with other processes. The high-level interface generated by HydraExpress interacts with the underlying framework, which in turn handles the details of various networking, XML, and Web Services standards. This approach separates the business logic code from the underlying communication framework, ensuring long-term flexibility and compatibility. Web services fabrication products like HydraExpress support the SOA approach by making it easy to create Web services from both new and existing business processes. Once exposed through a Web service, these processes can interact with other WebsServices anywhere on the network, regardless of the technology that underlies these services. Message formats in HydraExpress are based on the SOAP protocol, a widely accepted, easy-to-use mechanism for transferring messages over a network. As shown below, to use HydraExpress, developers supply a standard Web Services Description Language (WSDL) file. HydraExpress automatically generates a skeleton service that handles the details of protocols, standards and networking to ensure interoperability. Developers then drop in new or existing C++ business logic to create a ready-to-deploy service that can be used in many types of SOA applications. SOA Application HydraSCA WSDL FEEDS INTO HydraExpress PRODUCES C ++ Service/ Web Service DEPLOYS TO DEPLOYS TO SOA Application Custom or 3rd party WHITE PAPER PAGE 3

Accelerating C++ Web Services Development There are several advantages to using a framework to develop C++ Web services. These include:» Application quality. The reliable technology of a well-established framework such as HydraExpress delivers proven scalability and performance, freeing you to focus on your business logic rather than the infrastructure of your service-oriented application.» Efficient evolution. The modular design of HydraExpress enables you to quickly adapt the application as your business needs change, allowing you to modify only the areas that require adjustment.» Faster time-to-market. HydraExpress improves developer productivity so you can deliver effective service-oriented applications on schedule and on budget.» Cost savings. With HydraExpress, you can achieve the flexibility of service-oriented applications while leveraging your existing investments where it makes sense, drastically reducing the need to rewrite, test and optimize proven application logic. HydraExpress features:» A high-performance XML parser» A robust container for hosting C++ Web Services and Servlet servers» Automatic generation of C++ server skeletons built to run inside the HydraExpress container» Automatic generation of Web service clients from WSDL files» Easy-to-use XML-to-C++ data binding utility» Extensive native-code cross-platform networking foundation» Pluggable transport that supports Websphere MQ and Tibco Rendezvous» Seamless upgrade to HydraSCA A Simple Step-by-Step Example This example takes you through the process of creating a C++ Web service, a WSDL file that defines the Web service, and a SOAP-based client. The basic steps involved in creating and deploying a C++ Web service and client are as follows: 1. Install the HydraExpress software WHITE PAPER PAGE 4

2. Set up the environment 3. Invoke the generator by passing it the WSDL file 4. Implement the service and client 5. Compile the service and client 6. Deploy the service 7. Run the service and client The WSDL file used in the example describes a Greeting Service that has a single operation (sayhello) which takes a string as input and returns a string as output. The WSDL file can be found in the HelloWorld tutorial that is available with the HydraExpress evaluation. Now to look at the steps in more detail: 1. Install the HydraExpress evaluation. Download the HydraExpress evaluation for Windows or Linux from http://www.roguewave.com/download-center/ and follow the setup instructions. 2. Set up the environment i. Ensure that your C++ compiler is set up in your environment and available in the PATH environment variable ii. Set the JAVA_HOME environment variable to your JDK installation iii. On UNIX/Linux set the RWSF_HOME environment variable to the HydraExpress root directory iv. Run the script rwsfvars located in the HydraExpress root directory Further information on configuring the environment is available in Section 2.3 of the HydraExpress User s Guide which is provided with the HydraExpress evaluation. 3. Invoke the HydraExpress code generator by passing it the WSDL file i. Using a command prompt setup as described above, invoke rwsfgen passing it the name of the project to be created and the WSDL file name: WHITE PAPER PAGE 5

Figure1 Alternatively you can save the project settings in an xml project file, and pass this as the sole argument to rwsfgen. A sample project file is provided with the HelloWorld tutorial. Figure2 WHITE PAPER PAGE 6

4. Implement the service and client a) Implement the service Open the file HelloWorldExample\app\server\GreetingPortTypeImp.cpp. Edit the sayhello method so that it returns Hello + the string passed from the client. std::string GreetingPortTypeImp::sayHello(rwsf::CallInfo& callinfo, const std::string& hellorequest_in) { return std::string( Hello + hellorequest_in); } b) Implement the client Open the file HelloWorldExample\app\client\GreetingPortClient.cpp. Edit the invoke_sayhello method so that it calls the proxy s sayhello method with a fixed input string of World! void invoke_sayhello(greetingbindingproxy& proxy) { std::string hellorequest_in( World! ); std::string return_ret; rwsf::callinfo callinfo; try { return_ret = proxy.sayhello(callinfo, hellorequest_in); std::cout << Server Response: << return_ret << std::endl; } catch(const rwsf::soapfaultexception& e) { std::cout << Fault Code: << e.getfault().getfaultcode().asstring() << std::endl; std::cout << Fault String: << e.getfault().getfaultstring() << std::endl; } } 5. Compile the service and client Change to the HelloWorldExample directory and run nmake (Windows) or make (Unix/Linux) at the command prompt. This builds the HelloWorld client and service. 6. Deploy the service Run nmake deploy (Windows) or make deploy (Unix/Linux) to deploy the service. WHITE PAPER PAGE 7

7. Run the service and the client a) Start the HydraExpress agent using rwsfserver start Figure3 A new command window appears showing the helloworld service has been loaded and is running (Loading context: /helloworld/) Figure 4 WHITE PAPER PAGE 8

b) Start the client GreetingPortClient from the HelloWorldExample\bin directory. The server responds. Figure 5 More Advanced Examples This paper provides a very simple example involving creating a C++ Web service, a WSDL file that defines the Web Service, and a SOAP-based client. The evaluation version of HydraExpress available for download (http://www.roguewave.com/downloadcenter/) contains a wide range of tutorials that cover advanced functionality such as asynchronous Web services, WSDL defined fault handling, one-way and notification message patterns, message handlers for processing SOAP messages, the use of SOAP headers, MIME attachments, and XML binding for complex types. Advanced C++ Web Services Features The example shown in this whitepaper is intentionally basic in terms of functionality in order to easily demonstrate the underlying concepts without adding unnecessary complexity. HydraExpress has many features that allow developers to create enterprise ready Web Services. Some of these advanced features are summarized below: Support for message patterns. HydraExpress supports the four basic message patterns defined in the WSDL specification: request-response, the pattern most often used by Web services, one-way, notification, and solicitresponse. The message patterns can be combined to create anything from applications based on well-defined models such as publish/subscribe to arbitrarily complex, choreographed SOA applications. WHITE PAPER PAGE 9

Asynchronous messages. Any message pattern can be used either synchronously or asynchronously. This choice can be made at runtime by selecting either the synchronous or asynchronous service operation method. Support for sessions and other state-dependent processes. HydraExpress has built-in support for session management. In addition, the generalized support for metadata in headers can be adapted to support sessions, transactions, and other processes that depend on state. Support for XML binding. The HydraExpress code generator automatically compiles XML Schemas into C++ datatypes, whether the schema is embedded in the WSDL file, or the WSDL references an outside schema. Support for SOAP attachments. HydraExpress creates code to support MIME bindings that are defined in WSDL. Support for WSDL-defined faults. HydraExpress generates classes that encapsulate fault messages defined in the WSDL, and server code for capturing and returning fault messages to the client. An HTTPS transport. Accessible from the command line or built into the client, this transport provides for a secure client that uses HTTPS. Generated documentation. The code generator creates full, detailed documentation for all generated datatypes. Evolution: From Web Services to SOA Building C++ Web Services is the first and most fundamental step toward moving C++ applications toward a SOA. The next and larger challenge is to deliver SOA applications that are technologically agnostic and language independent. To forward this effort, the OASIS Open CSA finalized the first full version of the SCA specification in C++ and Java in 2007, with the support of dozens of application development tool vendors including Rogue Wave Software, IBM, BEA Systems, Sun Microsystems Inc., SAP, and Oracle. The key elements of the SCA specification offer the possibility of creating composite SOA applications using reusable SOA components in any technology:» Decoupling of application logic from the details of its invoked service calls» Multiple language support, including C++ and Java, as well as related programming standards such as BPEL, XLST» Support for One-Way, Asynchronous, Call-Return, and Notification communications» Binding services via SOAP-based Web Services, EJB, JMS, JCA, RMI, and more» Data defined via Service Data Objects (SDO). The SDO API is available in both C++ and Java WHITE PAPER PAGE 10

For more information, visit http://www.oasis-opencsa.org/committees. Summary This paper details the benefits of C++ Web Services development and takes the reader step by step through a simple example. It also highlights the challenges faced when developing Web Services in C++ generally and illustrates how developers can save considerable development time and effort, while producing code that is robust and easily maintainable. Lastly, some advanced C++ Web Services features are discussed. WHITE PAPER PAGE 11 USA 1-800-487-3217 FRANCE +33 (0)1 30 09 78 78 GERMANY +49 (0)6103 59340 UK +44 (0)118 9360710 www.roguewave.com Copyright 2008, Rogue Wave Software, Inc. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.