Oracle® Tuxedo Programming an Oracle Tuxedo ATMI Application Using C 10G Release 3 (10.3)
Total Page:16
File Type:pdf, Size:1020Kb
Oracle® Tuxedo Programming an Oracle Tuxedo ATMI Application Using C 10g Release 3 (10.3) January 2009 Tuxedo Programming an Oracle Tuxedo ATMI Application Using C, 10g Release 3 (10.3) Copyright © 1996, 2009, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this software or related documentation is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065. This software is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications which may create a risk of personal injury. If you use this software in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of this software. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software in dangerous applications. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. This software and documentation may provide access to or information on content, products and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services. Contents 1. Introduction to Oracle Tuxedo Programming Oracle Tuxedo Distributed Application Programming . 1-1 Communication Paradigms . 1-2 Oracle Tuxedo Clients. 1-4 Oracle Tuxedo Servers . 1-6 Basic Server Operation . 1-6 Servers as Requesters. 1-8 Oracle Tuxedo API: ATMI . 1-8 2. Programming Environment Updating the UBBCONFIG Configuration File . 2-1 Setting Environment Variables . 2-5 Including the Required Header Files. 2-9 Starting and Stopping the Application . 2-9 3. Managing Typed Buffers Overview of Typed Buffers . 3-1 Allocating a Typed Buffer . 3-7 Putting Data in a Buffer . 3-10 Resizing a Typed Buffer . 3-12 Checking for Buffer Type . 3-15 Freeing a Typed Buffer . 3-16 Using a VIEW Typed Buffer . 3-17 Programming an Oracle Tuxedo ATMI Application Using C iii Setting Environment Variables for a VIEW Typed Buffer . 3-18 Creating a View Description File . 3-19 Executing the VIEW Compiler . 3-22 Using an FML Typed Buffer . 3-23 Setting Environment Variables for an FML Typed Buffer . 3-23 Creating a Field Table File . 3-24 Creating an FML Header File . 3-25 Using an XML Typed Buffer and the Apache Xerces C++ Parser . 3-26 About the XML Typed Buffer. 3-27 About the Apache Xerces C++ Parser . 3-28 XML Parser Control . 3-28 XML Parser Support for ICU . 3-29 XML Parser Sample Application. 3-29 Xerces Schema Sample . 3-29 Converting XML Data To and From FML/FML32 Buffers . 3-29 Using On-Demand Conversion . 3-30 Using Automatic Conversion. 3-31 Mapping XML To and From FML/FML32 Field Types . 3-34 Conversion Limitations . 3-38 Using an MBSTRING Typed Buffer . 3-40 Multibyte Character Encoding Control. 3-42 Enabling MBSTRING to be Self-describing . 3-46 Implementation . 3-46 Safe/Unsafe Encoding Names . 3-46 Multibyte Character Support Limitations . 3-47 Multibyte Character Encoding Support for libiconv. 3-47 Customizing a Buffer . 3-49 Defining Your Own Buffer Types . 3-51 iv Programming an Oracle Tuxedo ATMI Application Using C Coding Switch Element Routines. 3-59 Adding a New Buffer Type to tm_typesw . 3-60 Compiling and Linking Your New tm_typesw . 3-61 Compiling and Linking Your New tm_typesw for a 16-bit Windows Platform . 3-62 Data Conversion . 3-63 4. Writing Clients Joining an Application . 4-1 Using Features of the TPINIT Typed Buffer . 4-4 Client Naming . 4-4 Unsolicited Notification Handling. 4-5 System Access Mode. 4-7 Resource Manager Association . 4-7 Client Authentication. 4-7 Leaving the Application . 4-8 Building Clients . 4-8 See Also. 4-10 Client Process Examples. 4-10 5. Writing Servers Oracle Tuxedo System main( ) . 5-1 System-Supplied Server and Services . 5-3 System-Supplied Server: AUTHSVR( ) . 5-3 System-Supplied Services: tpsvrinit( ) Function. 5-4 Receiving Command-line Options . 5-4 Opening a Resource Manager . 5-5 System-Supplied Services: tpsvrdone( ) Function. 5-7 Guidelines for Writing Servers. 5-8 Programming an Oracle Tuxedo ATMI Application Using C v Defining a Service . 5-9 Example: Checking the.