Example: bankruptcy

A Guide to Creating C++ Web Services - ATOMKI

A Guide to Creating C++ Web Services WHITE PAPERA bstractThis 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 featuresIntroductionThis 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.

Abstract This whitepaper provides an introduction to creating C++ Web services and focuses on: » Challenges involved in integrating C++ applications with Web services

Tags:

  Services, Applications, Creating, Integrating, To creating c web services

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of A Guide to Creating C++ Web Services - ATOMKI

1 A Guide to Creating C++ Web Services WHITE PAPERA bstractThis 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 featuresIntroductionThis 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.

2 The SDO and SCA specifications are multi-language industry SOA specifications available in both Java and C++.Challenges of integrating C++ with Web ServicesOver 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 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 , new message bus middleware is purchased to address this challenge.

3 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 PAPERPAGE 2use 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 C++ Web ServicesUsing 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.

4 Developers can quickly transform a monolithic application into C++ Web Services that can natively interact with all other parts of the technology 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 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 formats in HydraExpress are based on the SOAP protocol, a widely accepted, easy-to-use mechanism for transferring messages over a network.

5 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 . WHITE PAPERPAGE 3 WSDLC++Service/Web ServiceSOA ApplicationHydraSCASOA ApplicationCustom or 3rdpartyHydraExpressPRODUCESFEEDS INTODEPLOYS TODEPLOYS TOAccelerating 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.

6 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 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 ExampleThis example takes you through the process of Creating a C++ Web service, a WSDL file that defines the Web service, and a SOAP-based basic steps involved in Creating and deploying a C++ Web service and client are as follows:1.

7 Install the HydraExpress softwareWHITE PAPERPAGE 42. Set up the environment3. Invoke the generator by passing it the WSDL file 4. Implement the service and client5. Compile the service and client6. Deploy the service 7. Run the service and clientThe 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 to look at the steps in more detail:1. Install the HydraExpress evaluation. Download the HydraExpress evaluation for Windows or Linux from and follow the setup Set up the environmenti. Ensure that your C++ compiler is set up in your environment and available in the PATH environment variableii. Set the JAVA_HOME environment variable to your JDK installationiii.

8 On UNIX/Linux set the RWSF_HOME environment variable to the HydraExpress root directoryiv. Run the script rwsfvars located in the HydraExpress root directoryFurther information on configuring the environment is available in Section of the HydraExpress User s Guide which is provided with the HydraExpress Invoke the HydraExpress code generator by passing it the WSDL filei. 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 PAPERPAGE 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 PAPERPAGE 64. Implement the service and clienta) Implement the service Open the file HelloWorldExample\app\server\ the sayHello method so that it returns Hello + the string passed from the ::string GreetingPortTypeImp::sayHello(rwsf::Call Info& callInfo, const std::string& hellorequest_in){ return std::string( Hello + hellorequest_in);}b) Implement the clientOpen the file HelloWorldExample\app\client\ the invoke_sayHello method so that it calls the proxy s sayHello method with a fixed input string of World !

9 Void invoke_sayHello(GreetingBindingProxy& proxy){ std::string hellorequest_in( World! ); std::string return_ret; rwsf::CallInfo callInfo; try { return_ret = (callInfo, hellorequest_in); std::cout << Server Response: << return_ret << std::endl; } catch(const rwsf::SoapFaultException& e) { std::cout << Fault Code: << ().getFaultcode().asString() << std::endl; std::cout << Fault String: << ().getFaultstring() << std::endl; }}5. Compile the service and clientChange to the HelloWorldExample directory and run nmake (Windows) or make (Unix/Linux) at the command prompt. This builds the HelloWorld client and Deploy the service Run nmake deploy (Windows) or make deploy (Unix/Linux) to deploy the service. WHITE PAPERPAGE 77. Run the service and the clienta) Start the HydraExpress agent using rwsfserver startFigure3A new command window appears showing the helloworld service has been loaded and is running (Loading context: /helloworld/)Figure 4 PAGE 8 WHITE PAPERPAGE 9b) Start the client GreetingPortClient from the HelloWorldExample\bin directory.

10 The server 5 More Advanced ExamplesThis paper provides a very simple example involving Creating a C++ Web service, a WSDL file that defines the Web Service, and a SOAP-based evaluation version of HydraExpress available for download ( ) 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 FeaturesThe 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 .


Related search queries