Web Service Development Guide
PART I Getting Started
Introduction
Welcome
HydraExpress Features
Organization of This Manual
Building Web Services with HydraExpress
Overview
Supporting a Dynamic System
Configurable Transports and Message Handlers
Message Patterns and Asynchronous Messaging
Support for Named Objects
Dynamic Switching at Runtime
Handling of Complex Datatypes
Web Services and Service-Oriented Architecture (SOA)
Summary
Creating a Web Service
Overview
Service Description
Invoking the Generator
The Generated Application Samples
The Client Proxy
Using the Client Proxy and the Client Implementation
The Service Implementation
Compiling and Running the Application
Compiling the Application
Compiling Using the Makefile
Compiling Using MSVC
Deploying the Service
Deploying with the makefile
Deploying Services Compiled with MSVC Project Files
Testing the Service
Next Steps
Extending Your Web Service
Overview
Add a Secure Transport
Add a Special SOAP Header
Add the SOAP Header to the Generated Client
Edit the Server-Side Code to Return a Response Based on the Header
Compile, Deploy, and Run the Service
Next Steps
Code Generator Basics
Overview
Invoking the Code Generator
Common Generator Options
Generated Files
Next Steps
Working with Data
Overview
Simple Data
Messages with No Parts
Messages with a Single Part
Messages with Multiple Parts
Complex Data
The WSDL and Schema
The Generated Data Classes
Working with the Generated Data Classes in the Client and Server Implementations
The Data “main” Sample Application
PART II Client and Server Options
Developing Clients
Overview
Developing and Running the Example
Service Description
Invoking the Generator
Generated Files
Using the Client Proxy
Looking at the Code
Using the Client Proxy
Compiling and Deploying the Client
Further Options
The Asynchronous Client API
Multithreading
Transports
Client Security
Authorization
HTTPS Support
Error Reporting and Faults
Client-Side Logging
Turning off Text Escaping to Improve Performance
Customizing the Client Configuration Files
Handlers Configuration File: client-handlers.xml
Next Steps
Developing Services
Overview
Developing and Running the Example
Invoking the Generator
Using the Server Implementation
The Generated Abstract Base Class
The Generated Sample Implementation
The Provided Sample Implementation
Compiling the Service
Compiling Using the Makefile
Compiling Using MSVC
Deploying the Service
Deploying with the Makefile
Deploying Services Compiled with MSVC
Testing the Service
Further Options
Multithreading
A Note on Allocating Objects in Multithreaded Applications
Service Security
Error Reporting and WSDL-Defined Faults
Implementing a Standalone Server
Server-Side Logging
Session Management
Using a Different Implementation Name
Wrapped Style Operations
Developing a WSDL to Support the Wrapped Style
Generating Code with the -wrapped Option
Looking at the Generated Code
Turning off Text Escaping to Improve Performance
Accessing the Request URL
Customizing the Service Configuration Files
Transport Configuration File: transports.xml
Servlet Configuration File: web.xml
Service Chains Configuration File: handlers.xml
Named Objects Configuration File: objects.xml
Next Steps
PART III Working with Message Patterns
Introduction to Message Patterns
Overview
Message Patterns in WSDL
Weather Summary Service Description
The Request-Response Pattern
The One Way Pattern
The Notification Pattern
The Solicit-Response Pattern
Message Patterns and Asynchronous Messaging
Architecture of the Notification Classes
Next Steps
Solicit-Response and Notification Services
Overview
Generating Code
Code Generation Outputs
Implementing the Service
The Request-Response Operation
The Solicit-Response and Notification Operations
The Notification Proxy
Implementing the Call to the Notification Endpoint
The Solicit-Response Operation Call
Implementing the Client
Setting up a Listener
The Request-Response Service Operation Call
The One Way Operation Call
Implementing the Client-Side Notification and Solicit-Response Endpoints
Transport Configuration File Supporting Notification
Running the Service
Summary
PART IV Extending your Applications
Custom Transports and Listeners
Overview
Transport and Listener Configuration Files
Transport and Listener Properties
Using an Autoconfigured Listener
Making Transports and Listeners Dynamic
Selectable Transports and Listeners
Interchangeable Transports and Listeners
Creating a Transport
A Note on Multithread Safety
Creating a Listener
Request Handling and Threading
Implementing the Virtual Methods
Configuring the Listener
Web Service Logging
Overview
Web Service Logger Levels
Logging in Client Code
Configuring and Using a Client Logger
Logging in a Standalone Service
Logging in Service Code
Using the Global Agent Logger in Service Code
Server-side Logging through the Web Services Logger
Asynchronous Messaging
Overview
The Asynchronous API
Using the Asynchronous API
The Async Example
Implementing the Request-Response Method Asynchronously
Implementing the One-Way Method Asynchronously
Running the Async Example
Asynchronous Method Naming Conflicts
SOAP Message Handlers
Overview
Types of SOAP Handlers
Transport Handlers
Request Handlers
Response Handlers
Fault Handlers
The Message Handler API
Creating Your Own Handlers
Generate Code
Write the Handler Implementation
Creating a Request Handler
Creating a Transport Handler
Aborting Handler Processing
Add the Handlers to the Proxy
Register the Handlers
Configure the Handlers
Compile and Deploy the Service
Chaining Handlers
Chaining Handlers on the Client
Chaining Handlers on the Server
The handlers.xml Configuration File
Editing the handlers.xml File
Adding Initialization Parameters to Handlers
SOAP and Transport Headers
Overview
How Headers Work
Defining and Using Headers through the rwsf::CallInfo Interface
SOAP Headers Example
Client-Side Code
Server-Side Code
Viewing the Results
Uses for Header Support
Summary
Named Objects
Overview
How HydraExpress Uses Named Objects
Creating and Using Custom Objects
Creating the String Object
Creating an Entry Point to the Object
Configuring the Named Object
Using the Named Object
Summary
SOAP with Attachments
Overview
The SOAP with Attachments Specification
Working with Attachments
Example Service Description
Define the Attachment in WSDL
Define the Schema Type
Define the WSDL Message Parts and Operation
Define the MIME Bindings
Generate Code and Manipulate the Attachment
Sending a Referenced Attachment
Retrieving an Unreferenced Attachment
Retrieving a Referenced Attachment
Build and Run the Example
Summary
Sessions and State
Overview
Session Management in the Agent’s Servlet Container
Manipulating a Service’s Session Data
Configuring Session Timeouts
Customizing the Session ID
Custom Session ID Generator Example
Internationalizing Your Services
Overview
How HydraExpress Performs Character Conversions for Non-UTF-8 Encodings
Character Encoding in XML Schemas and WSDLs
Character Encoding in Generated Classes
Automatic Character Conversion through a Customized Mapping
Create a Customized Mapping
Add the Mapping to a HydraExpress Project File and Generate Code
Adding the mappings to an existing HydraExpress Project File
Creating a New HydraExpress Project File Containing the Mappings
A Look at the Generated Converter
XML and Character Encodings Concepts
What is a Character Encoding?
Character Encoding in an XML Prolog
PART V HydraExpress Reference
The HydraExpress Code Generator
Overview
Invoking the Generator
Introduction to the HydraExpress Project File
Using the HydraExpress Project File to Set Options
Invoking the Generator with an XML Schema
Architecture of the Generated Classes
Generated Files
HTML Documentation
Sample Application Files
C++ Makefiles
MSVC Project Files
Issues with Large Complex Schemas
Invoking the Generator with a WSDL File
Architecture of the Generated Classes
Server Classes
Client Classes
Generated Files
HTML Documentation
Sample Application Files
C++ Makefiles
MSVC Project Files
Generating Code with Multiple Schemas or WSDLs
A Note on Namespace Collisions
Generator Options
Adding Options and Customized Mappings to the HydraExpress Project File
Providing Customized Type Mappings to the Code Generator
Adding Outside Libraries, Includes or Compiler Properties to a Project
Conflicting Options and Property Precedence
Platform Properties and Startup Properties Files
The HydraExpress Project File
Command Line Options
Overwrite Protection
Validation Provided during Code Generation
WSDL Validation
Schema Validation
SOAP Message Validation
The Project File and Directory Structure
Overview
The Project File
A Sample Project File
Adding Options to a Project File Vs. Adding them to the Command Line
Creating a Customized Project File for Special Generation Options
The Generated Project Directory
The Top-Level Code Generation Directory
The SubDirectories
The App Directory
The Bin Directory
The Codegen Directory
The Conf Directory
The Docs Directory
The Include Directory
The Lib Directory
Options for Compiling
Overview
The Default Generated Makefiles
Makefile Options
The -noserver, -noclient, and -nosample Options
The -nomake Option
Customizing the Name of a Makefile
Adding Third Party Includes to Makefiles
Customizing Systems Properties
Using the Debug Makefiles
Procedure for Building with the Makefiles
Building just a Client or Server
Location of Generated Libraries and Binary Files
Using your own Makefile
Using MSVC Project Files
Next Steps
Options for Deploying Services
Overview
Deploying to the Agent
Starting and Stopping the Agent
Agent Ports
Deploying your Service with the Makefile
Deploying your Service Using MSVC Files
Agent Options
Standalone Server Implementations
Standalone Server Options
Standalone Server Ports
Shutting down a Standalone Server
About Configuring a Multithreaded Standalone Server or Listener
About the Servlet Used by the Service
PART VI Appendices
Appendix A, Code Generation Details
Overview
File Generation Conventions
Naming Conventions
Client-Side Classes
Server-Side Classes
Notification Classes
Methods and Parameters
Configuration Files
Makefile Naming Conventions
Simple Type Mappings
Complex Types
SOAP Encoding
SOAP-Encoded Arrays
SOAP-Encoded Built-in Types and References
Recursive Arrays
SOAP Headers
XML Binding Development Guide
PART I XML Binding Basics
Introduction
Welcome
Dependency on the Core Library
Using HydraExpress with SourcePro C++
Where to Find Additional Information
Organization of this Manual
XML Binding Concepts
Overview
Using XML Binding Classes in a Web Service
XML Binding Basics
XML Schema
Validation
Schema Document Validation
Instance Document Validation
Internationalization
PART II Code Generation Examples
Basic Purchase Order Example
Purpose
Types Concepts
XML Document for Purchase Order Example
XML Schema for Purchase Order Example
Generating Code from Schema
Execute the Code Generator
Code Generator Output
Generated Files
Implementing your Application
Building and Compiling
Command Line Procedure
MSVC Procedure
The Example Code
Unmarshaling
Manipulating XML Content in C++
Validating the Instance Document
Marshaling
Working Without Top-Level Element Classes
Summary
Purchase Order Example & Namespace Qualification
Purpose and Overview
The XML Schema
The XML Document
Generating Code from Schema
Generator Output
Building and Compiling
The Example Code
C++ Namespaces
Unmarshaling
Manipulating XML Content in C++
Marshaling
Summary
SOAP Example
Purpose and Overview
The SOAP XML Document
Customizing Mappings Using the Project File
Generate Code
Generator Output
The SOAP Parsing Example
The Trade Parsing Example
Building and Compiling
Summary
complexContent Example
Purpose and Overview
The International Purchase Order Schema
An International Purchase Order Instance Document
Generate Code
Building and Compiling
Accessing the Address
Summary
PART III Advanced Topics
Advanced Tasks
Purpose and Overview
Designing a Schema for Extensibility
Working With Large Documents
Custom Formatting
Working with Unsupported Complex Types
Working with the Handle/Body Classes
Working with Shallow and Deep Copies
Making a Shallow Copy
Making a Deep Copy
Managing Circular References
Summary
Mapping XML Schema to C++
Purpose and Overview
Names and Identifiers
Static Data Members
The DefaultElementName Data Member
Contained Element Name and Attribute Data Members
Namespaces
Accessing the Fully Qualified XML Name of a Complex Type
Mapping XML Namespaces to C++ Namespaces
Differentiating Same-Named Items
Adding a Namespace to a Root Element
File Naming
Simple Types
Default Values
anyType and anySimpleType
Validation of simpleType Data
Data Binding Parsing Errors
Complex Types
Accessors and Mutators
Marshal and Unmarshal
Marshal methods
Unmarshal methods
Types Derived By Restriction or Extension
Specific Support for Types Derived by Restriction
any Element and anyAttribute
Optional Elements and Attributes
nillable Elements
Collections
Lists
Substitution Groups
Unions
Key and Keyref Elements
Content Model Groups
Single occurrence all or sequence elements
Single occurrence or optional choice element
Multiple occurrence or optional all and sequence, multiple occurrence choice
Top-level groups
Attribute Groups
Default Values
Creating Customized Mappings
Customizing Names and Identifiers
Flexible Type Mapping
Namespace Mapping
String Mapping
Servlet Development Guide
PART I Introduction
Introduction
Welcome
Organization of this Manual
Where to Find Additional Information
The Servlet Container and Servlet Concepts
The Servlet Approach
The Servlet Container and Web Applications
Network Connection
Contexts
Servlets
Request and Response
Maintaining State
Filters
Listeners and Events
Named Objects
Introduction to Servlet Programming
Introduction
Servlet Initialization and Destruction
Deriving from rwsf::HttpServlet
Defining the Servlet
Implementing Request Handlers
Compiling the Servlet
Installing the Compiled Object Files
Adding the Servlet to the web.xml file
Stopping and Starting the Agent, and Executing the Servlet
Debugging a Servlet
Next Steps
PART II Administration
Configuring Objects in the Servlet Container
Introduction
Procedure for Adding a Context
Procedure for Adding a Servlet
Procedure for Adding a Filter
Procedure for Adding a Listener
Configuration File Example
Character Set
Servlet and Filter Initialization Parameters
URL Patterns
URL Pattern Syntax
Servlet Matching Procedure
Default Servlet
Deploy the Compiled Object Files
Create a Context Directory
Set Context Parameters
Define and Map Servlets
Defining the Servlet Instance
Mapping Servlets to URLs
Single-thread Access
Define and Map Filters
Defining the Filter Instance
Mapping Filters to URLs
Define Listeners
Configure Error Pages
Configure Sessions
Forward Requests From a Web Server
Troubleshooting
Introduction
Agent Starts, No Contexts Load
Servlet Does Not Load
Context Does Not Load
Browser Displays HTML Code from Servlet
PART III Programming
The Servlet API
Introduction
Using rwsf::Enumeration
Using rwsf::Attribute
Defining Filters, Servlets, and Listeners
Implementing a Filter
Implementing a Listener
Reading Initialization Parameters
Reading Context Parameters
Working With Requests
Introduction
Understanding Request Routing
Inspecting HTTP Headers
Reading Parameters From a Form
Recovering Session State
Managing State on the Client with Cookies
Creating Responses
Introduction
Saving Session State
Creating HTTP Headers
Creating an HTTP Response
Using Java-Like Output Functions
Setting the Response from a String
Returning the URL of a Servlet
Returning an Error
Redirecting the Client
Forwarding a Request
Creating Servlets
Introduction
Designing the Servlet Class
Implementing the Servlet Class
Compiling Servlets
Deploying Servlets
Changing the Default Deployment Directories
PART IV Appendices
Appendix A, Resources
Books and Articles
Web Sites
Appendix B, Configuration Quick Reference
Conventions
Global web.xml
Context web.xml
Appendix C, Library Loading Reference
Environment Variables
Library Name Format
Web Service Development Guide
Library Name Format