![]() |
![]() |
![]() |
![]() |
![]() |
•
• buildscaclient: Builds client processes that call SCA components.
• buildscacomponent: Builds SCA components.
• buildscaserver: Builds an Oracle Tuxedo server containing SCA components.
• SCAHOST: Generic server for Python, Ruby or PHP SCA components.
• scatuxgen: Generates Oracle Tuxedo Service Metadata Repository interface information from an SCA interface.
• scastructc32,scastructc: Structure description file compiler.
• scastructdis32, scastructdis: Binary structure and view files disassembler.
• tuxscagen: Generates SCA, SCDL, and server-side interface files for Oracle Tuxedo services.You must define the applications physical representation. Strict SCA client applications are SCA component types. Listing 2‑1shows the directory structure used to place SCA components in an application.Listing 2‑1 SCA Component Directory StructureListing 2‑2 shows an example of typical root.composite content.Listing 2‑2 root.composite ContentThe implementation.composite@name parameter references the directory that contains the component named 'myClientComponent'. This value is required at runtime. For more information, see Running the Client Application.In the case of calling external Web services, an interface matching the service WSDL must be provided. For more information, see SCA Data Type Mapping for the correspondence between WSDL types and C++ types.Listing 2‑3 shows an interface example.Listing 2‑3 Interface ExampleIn the interface shown in Listing 2‑3, a single method TOUPPER is defined. It takes a single parameter of type std::string, and returns a value of type std::string. This interface needs to be located in its own .h file, and is referenced by the client program by including the .h file.Listing 2‑4 shows an example of a succession of calls required to perform an invocation.Listing 2‑4 Invocation Call Example
• UNIX samples: $TUXDIR/samples/salt/sca
• Windows samples: %TUXDIR%\samples\salt\scaThe link between the local call and the actual component is made by defining a binding in the SCDL side-file. For example, Listing 2‑4 shows a call to an existing Oracle Tuxedo ATMI service, the SCDL descriptor shown in Listing 2‑5 should be used. This SCDL is contained in a file called <componentname>.composite.Listing 2‑5 SCDL DescriptorThis composite file indicates that a client component may perform a call to the TOUPPER reference, and that this call is performed using the ATMI binding. In effect, this results in a tpcall() to the "TOUPPER" Oracle Tuxedo service. This Oracle Tuxedo service may be an actual existing Oracle Tuxedo ATMI service, or another SCA component exposed using the ATMI binding. For more information, see SCA Component Programming.The inputBufferType and outputBufferType elements are used to determine the type of Oracle Tuxedo buffer used to exchange data. For more information, see SCA Data Type Mapping and the ATMI Binding Element Reference for a description of all possible values that can be used in the binding.atmi element.Once all the elements are in place, the client program is built using the buildscaclient command. You must do the following steps:
• APPDIR - designates the application directory; in the case of SCA this typically contains the top-level SCDL composite.
• SCA_COMPONENT - the default SCA component (the value 'myClientComponent' in the example shown in Listing 2‑2). It tells the SCA runtime where to start when looking for services in the locateService() call.Access to existing Oracle Tuxedo ATMI services from an SCA client program can be simplified using the examples shown in Listing 2‑6, Listing 2‑7, and Listing 2‑8.Starting from a Oracle Tuxedo METADATA repository entry as shown in Listing 2‑6, the tuxscagen(1) command can be used to generate interface and SCDL.Listing 2‑7 Generated HeaderListing 2‑8 Generated SCDL ReferenceThe steps used to invoke these services are identical to the examples shown in Listing 2‑6 through Listing 2‑8.Invoking a non-SCA Oracle Tuxedo ATMI service may return an error, but still send back data by using tpreturn(TPFAIL, …). When this happens, an SCA client or component is interrupted by the ATMIBindingException type.The data returned by the service, if present, can be obtained by using the ATMIBindingException.getData()API. For more information see, TPFAIL Return Data.Listing 2‑9 Invocation Interruption ExampleListing 2‑10 /binding.atmi DefinitionOther returned data types must be cast to the corresponding type. For example, an invocation returning a commonj::sdo::DataObjectPtr as shown in Listing 2‑11.Listing 2‑11 SCDL Invocation ExampleListing 2‑12 ATMIBindingException.getData() ResultsThe rules for returning TPFAIL data to the calling application are as follows:
• For each <errorBufferType>, a canonical type is defined, where <errorBufferType> is converted. When the <errorBufferType> is equal to the <outputBufferType>, the canonical type is the same C++ type that is returned in a successful service implementation.
• When the <errorBufferType> is different from the <outputBufferType>, the canonical type is as follows:
•
•
• For CARRAY buffers, a C++ CARRAY_PTR.
• For X_OCTET buffers, a C++ X_OCTET_PTR.
• For FML, FML32, VIEW, VIEW32, X_COMMON, and X_C_TYPE buffers, a C++ commonj::sdo::DataObjectPtr.
• In each case, the value returned by getData() is a pointer to one of the types listed above.For more conversion rules between Oracle Tuxedo buffer types and C++ data information, see SCA Data Type Mapping.The Oracle Tuxedo SCA container provides the capability of hosting SCA components in an Oracle Tuxedo server environment. This allows you to take full advantage of proven Oracle Tuxedo qualities: reliability, scalability and performance.Figure 2‑1 summarizes SCA components and Oracle Tuxedo server mapping rules.
• An SCA composite declaring one or more services with a <binding.atmi> definition maps to a single Oracle Tuxedo server advertising the same number of services as the SCA composite.
• The resulting Oracle Tuxedo server advertises as many services as there are binding.atmi sections in the SCDL definition
• Interfaces may declare multiple methods. Each method is linked to an Oracle Tuxedo native service using the /binding.atmi/@map attribute. A method not declared via the /binding.atmi/@map attribute is not accessible through Oracle Tuxedo. The use of duplicate service names are detected at server generation time, so that Oracle Tuxedo service names-to-interface method mapping in a single Oracle Tuxedo server instance is 1:1.SCA composites are deployed in an Oracle Tuxedo application by configuring instances of generated SCA servers in the UBBCONFIG file. Multiple instances are allowed. Multi-threading capabilities are also allowed and controllable using already-existing Oracle Tuxedo features.You must first define the applications physical representation. Listing 2‑13 shows the directory structure used to place SCA components in an application:Listing 2‑13 SCA Component Directory StructureListing 2‑14 shows typical root.composite content.Listing 2‑14 root.composite ContentThe implementation.composite@name parameter references the directory that contains the 'myComponent' component.
• C++ classes (other than std::string and commonj::sdo::DataObjectPtr) cannot be used as parameters or return valuesListing 2‑15 shows an example of an interface implemented for a client program.Listing 2‑15 Component Implementation InterfaceThe component implementation then generally consists of two source files (as shown Listing 2‑16 and Listing 2‑17 respectively):
• component implementation definitions, contained in a <servicename>Impl.h file, and
• component implementation, contained in a <servicename>Impl.cpp fileListing 2‑16 Example (TuxServiceImpl.h):Listing 2‑17 Example (TuxServiceImpl.cpp):Additionally, a side-file (componentType), is required. It contains the necessary information for the SCA wrapper generation and possibly proxy code (if this component calls another component).This componentType file (<componentname>Impl.componentType)is an SCDL file type. Listing 2‑18 shows an example of a componentType file (TuxServiceImpl.componentType).Listing 2‑18 componentType File ExampleThe link between the local implementation and the actual component is made by defining a binding in the SCDL side-file. For example, for the file type in Listing 2‑18 to be exposed as an Oracle Tuxedo ATMI service, the SCDL in Listing 2‑19 should be used. This SCDL is contained in a file called <componentname>.composite (for example, myComponent.composite).Listing 2‑19 Example SCDL DescriptorThis composite file indicates that the service, mySVC, can be invoked via the Oracle Tuxedo infrastructure. It further indicates that the toupper() method is advertised as the TUXSVC service in the Oracle Tuxedo system. Once initialized, another SCA component may now call this service, as well as a non-SCA Oracle Tuxedo ATMI client.The inputBufferType and outputBufferType elements are used to determine the type of Oracle Tuxedo buffer used to exchange data. For more information, see SCA Data Type Mapping and the ATMI Binding Element Reference for a description of all possible values that can be used in the binding.atmi element.
Note: The mycomponent.componentType service name should be same as the composite file, otherwise an exception is thrown.Once all the elements are in place, the component is built using the buildscacomponent command. The steps are as follows:
1. Navigate to the APPDIR directory. The component and side files should be in its own directory one level downIn order for components to be supported in an Oracle Tuxedo environment, a host Oracle Tuxedo server must be built. This is achieved using the buildscaserver command.For example: $ buildscaserver -c myComponent -s . -o mySCAServerWhen the command is executed, mySCAServer is ready to be used. It automatically locates the component(s) to be deployed according to the SCDL, and performs the appropriate Oracle Tuxedo/SCA associations.
• Python, Ruby, and PHP must be built with shared-libraries enabled. This is usually the case for out-of-the-box installations. If you are building from source, the --enable-shared options must be used in the configure step.SALT SCA Python, Ruby, and PHP support provides a set of APIs to perform SCA calls from Python, Ruby or PHP client programs, and language extensions to call Python, Ruby or PHP components. For more information, see Python, Ruby, and PHP Client Programming and Python, Ruby, and PHP Component Programming.The buildscaclient, buildscaserver and buildscacomponent commands do not need adapting for use with Python, Ruby or PHP programs, as they are not be required to produce executables or component libraries.
Note: A system server, SCAHOST, is provided to correctly marshal requests and responses to and from Python, Ruby or PHP scripts. It contains Python, Ruby, and PHP scripts exposed as SCA services (via the Oracle Tuxedo Metadata Repository). The definitions describe the parameters and return types of the corresponding exposed Python, Ruby or PHP functions.For more information, see Python, Ruby, and PHP Data Type Mappingfor Service Metadata Repository entry examples.Figure 2‑2 provides an overview of the SALT SCA environment Python, Ruby, and PHP support architecture.The calculator object is used to invoke the “add” operation (for example, x = calculator.add(3, 2)).In order to use Python, Ruby or PHP scripts in SCA as components, you must use the implementation.python, implementation.ruby and implementation.php parameters.
Note: implementation.python implementation.ruby and implementation.php usage is similar to the implementation.cpp element (see Listing 2‑19 and Listing 2‑31); the difference is that the interface.python and interface.ruby elements, or .componentType are not required.The implementation.python element has the following attributes:Name of the Python module (.py file) containing the operation(s) that this component offers in the form of module-level function(s).Name of the Ruby script (.rb file) containing the operation(s) that the component offers in the form of methods of a class contained in the script file. The name of the script is its full name (that is, it also includes the .rb extension).Name of the Ruby class (.rb file) containing the operation(s) that the component offers.Name of the PHP script (.php file) containing the operation(s) that this component will offer, in the form of methods of a class contained in the script file. The name of the script is its full name, i.e. it also includes the .php extension.Name of the PHP class (.php file) containing the operation(s) that this component will offer.Listing 2‑20 shows an example of a Python component in an SCA composite accessible using the ATMI binding. In this example, runtime looks for a Python component located in a file named ToupperService.py in the same location as the composite file.Similarly, a Ruby component is required in a file named ToupperService.rb, in the same location as the composite file.Listing 2‑20 Python Component in an SCA CompositeListing 2‑21 shows an example of a PHPcomponent in an SCA composite accessible using the ATMI bindingListing 2‑21 PHP Component in an SCA CompositePython operations are exposed as module-level functions contained in a Python module file. For example, a ToupperService.py file would contain the code shown in Listing 2‑22.Listing 2‑22 Python Module FileParameter and return values types are dynamically determined at runtime. Application exceptions are caught by the extension runtime and re-thrown as tuscany::sca::ServiceInvocationException.During input, unsupported types or an error processing an input DataObject results in the following exception:
a tuscany::sca::ServiceDataException.During output, simple return types are always processed. An error generating a DataObject (from XML data) results in the following exception:
tuscany::sca::ServiceDataException.Ruby operations are exposed as methods of an implementation class contained in a Ruby script file (.rb extension). For example, a ToupperService.rb file would contain the code shown in Listing 2‑23.Listing 2‑23 Ruby Script FileParameter and return values types are dynamically determined at runtime. Application exceptions are caught by the extension runtime and re-thrown as tuscany::sca::ServiceInvocationException.During input, unsupported types or an error processing an input DataObject results in the following exception:
a tuscany::sca::ServiceDataException.During output, simple return types are always processed. An error generating a DataObject (from XML data) results in the following exception: tuscany::sca::ServiceDataException.PHP operations are exposed as functions contained in a PHP class. For example, a toupper.php file would contain the code shown in Listing 2‑24Listing 2‑24 PHP ClassParameter and return values types are dynamically determined at runtime. Application exceptions are caught by the extension runtime and re-thrown as tuscany::sca::ServiceInvocationException.During input, unsupported types or an error processing an input DataObject results in the following exception:
a tuscany::sca::ServiceDataException.During output, simple return types are always processed. An error generating a DataObject (from XML data) results in the following exception: tuscany::sca::ServiceDataException.
Note: You must use the struct data type specified in the SCA method parameter definition or in the definition of a return value from an SCA method as follows:
• struct structurename *
• struct structurename &
•
•
•
•
• struct nestedstructurename
•
Note: The scagen utility parses typedef and struct keywords. For more information, see the SCA Command Reference.
• std::string or a std::wstring
•
•
• .h and .cpp files referencing the use of structures are required to include a definition for the structure being used and for any nested structures contained within that structure.
• The type parameter in column 1 allows the additional values bool, unsignedchar, signedchar, wchar_t, unsignedint, unsignedlong, longlong, unsignedlonglong, longdouble, and struct.
• If the value in column1 is struct, then the cname value in column 2 is the name of a previously defined VIEW that describes a nested structure. In this case, the count value in column 4 may optionally be specified to specify the number of occurrences of the nested structure.If a structure described in a structure description file is converted to (or from) an FML32 or FML buffer at runtime in an SCA-ATMI application, then the name of the corresponding FML field is the fbname value specified in column 3, if any, and is the cname value specified in column 2 (if no value is specified in column 3). When compiled, the structure description file produces a binary structure description file as shown in Listing 2‑25. The binary structure header file is shown in shown in Listing 2‑26.Listing 2‑25 SCA Structure Description FileListing 2‑26 Binary Structure Header FileThe scastructc32 and scastructc commands are used to convert a source structure description file into a binary structure description file and to generate a header file describing the structure(s) in the structure description file. The scastructdis32 and scastructdis commands accept the same arguments as viewdis32 and viewdis. For more information, see the SCA Command Reference.
Notes: scastructc32 and scastructc generate a binary file with suffix .V on Unix and suffix .VV on Windows.When invoked with the option -S, tuxscagen(1) generates a structure for any function parameter or return value that would otherwise have been passed using DataObjectPtr.
Note: If tuxscagen -S is run, then simple data types are generated just as they would have been if tuxscagen were run without the -S option. It is possible to mix simple data types, structures, and other complex data types within a single metadata repository. In order to use simple data types in an application that also uses structures, it is not necessary to run tuxscagen without -S.
•
• SCA invocations made using the SCA container have the capability of being performed using the Oracle Tuxedo WorkStation protocol (/WS). This is accomplished by specifying the value WorkStation (not abbreviated so as not to confuse it with WebServices) in the <remoteAccess> element of the <binding.atmi> element.Only reference-type invocations are be available in this mode. Service-type invocations may be performed using the /WS transparently (there is no difference in behavior or configuration, and setting the <remoteAccess> element to WorkStation for an SCA service has no effect).Since native and WorkStation libraries cannot be mixed within the same process, client processes must be built differently depending on the type of remote access chosen.
Note: When using the value propagatesTransaction in /binding.atmi/@requires, the behavior of the ATMI binding does not actually perform any transaction propagation. It actually starts a transaction, since the use of this protocol is reserved for client-side access to Oracle Tuxedo (SCA or non-SCA) applications only. For more information, see ATMI Binding.SCA invocations made using the SCA container have the capability of being performed using the Oracle Tuxedo /Domains protocol. No additional configurations are necessary on <binding.atmi> declarations in SCDL files.
•
• Legacy mode (SCA -> Tux interop mode) - /binding.atmi/service/@name attribute.Oracle Tuxedo communications are configured in SCDL using a <binding.atmi> element. This allows you to specify configuration elements specific to the ATMI transport, such as the location of the TUXCONFIG file, the native Oracle Tuxedo buffer types used, Oracle Tuxedo-specific authentication or /WS (WorkStation) configuration elements, etc.Listing 2‑27 shows a summary of the <binding.atmi> element.Listing 2‑27 ATMI Binding Pseudoschema
Note: SSL is supported through the Oracle 12c JCA Adapter. LLE is not currently supported.The following Oracle Tuxedo CPP ATMI binding workStationParameters elements are not supported:
Note:
• binding.atmi/fieldTables - Specifies a comma-separated list of Java classes that are extended from the weblogic.wtc.jatmi.TypedFML base class.
• binding.atmi/fieldTables32 - Specifies a comma-separated list of Java classes that are extended from the weblogic.wtc.jatmi.TypedFML32 base class.
• binding.atmi/viewFiles - Specifies a comma-separated list of Java classes that are extended from the weblogic.wtc.jatmi.TypedView base class. These derived classes usually are generated from an Oracle Tuxedo VIEW file using the weblogic.wtc.jatmi.viewj compiler. These also includes derived from weblogic.wtc.jatmi.TypedXCType and weblogic.wtc.jatmi.TypedXCommon.For more information, see How to Use the viewj Compiler in the Oracle Tuxedo WebLogic Tuxedo Connector Programmer's Guide.
• binding.atmi/viewFiles32 - Specifies a comma-separated list of Java classes that are extended from the webogic.wtc.jatmi.TypedView32 base class. These derived classes usually are aslo generated from an Oracle Tuxedo VIEW file using the weblogic.wtc.jatmi.viewj32 compiler.Listing 2‑28 shows an example of composite file for binding declaration of an Oracle Tuxedo service named "ECHO“.Listing 2‑28 ECHO Composite FileListing 2‑29 shows the interface for the example mentioned in Listing 2‑28.Listing 2‑29 ECHO InterfaceListing 2‑30 shows an example of an SCA client implementation.Listing 2‑30 SCA Client Implementation
• If a binding is configured with a data type that does not match what the Python, Ruby or PHP component is designed to handle, an exception is thrown by the Python, Ruby or PHP runtime (for example, binding.atmi configured with STRING Oracle Tuxedo buffers and a Python function handling numerical data).
• Python, Ruby or PHP programs with a composite scope require an Oracle Tuxedo server reload when the script is modified. A stateless scope allows dynamic reloading of modified scripts.
• In order to expose Python, Ruby or PHP scripts as Web services, the SCAHOST command must use the -w option in order to load the correct service binding during initialization.
Note: SCAHOST does not allow mixing both ATMI and Web services binding types in one SCAHOST instance.
• TMMETADATA server is required in order to expose Python, Ruby, and PHP components.
• When using the ATMI binding for interoperability calls (that is, when requires="legacy" is set), mixing named and non-named parameters is not allowed (for example, Python: def func(a, *b, **c), Ruby: def func(a, *b, hash)), since there is no mechanism to restore the parameter names.
• Multiple parameters: def func(a, b, c) (same syntax for Python, Ruby, and PHP)
• Multiple parameters and list of parameters: def func(a, *b) (same syntax for Python and Ruby)
• Named parameters: PHP - $svc->searchBike(array('COLOR' => 'RED', 'TYPE' => 'MTB')). For more information, see PHP Data Type Mapping.
•
Note: Python parameters defined with ** are considered named parameters. Ruby parameters defined with hash are considered named parameters. For more information, see Python Parameters and Ruby Parameters.
• Unicode strings are not supported; accordingly MBSTRING buffers or FLD_MBSTRING fields are not supported.The Web services binding (binding.ws) leverages previously existing Oracle Tuxedo capabilities by funneling Web service traffic through the GWWS gateway. SCA components are hosted in Oracle Tuxedo servers, and communications to and from those servers are performed using the GWWS gateway.When SCA components are exposed using the Web services binding (binding.ws), tooling performs the generation of WSDF information, metadata entries and FML32 field definitions.When SCDL code of SCA components to be hosted in an Oracle Tuxedo domain (for example, service elements) contains <binding.ws> elements, the buildscaserver command generates an WSDF entry in a file named service.wsdf where 'service' is the name of the service exposed. An accompanying service.mif and service.fml32 field table files are also generated, based on the contents of the WSDL interface associated with the Web service. You must compose a WSDL interface. If no WSDL interface is found, an error message is generated.
1. Convert the WSDL file into a WSDF entry by using the wsdlcvt tool. Simultaneously, a Service Metadata Entry file (.mif), and fml32 mapping file are generated.
2. Make sure that the UBB source has the TMMETADATA and GWWS servers configured
3. Import the WSDF file into the SALTDEPLOY file
4.
5. Load the Service Metadata Entry file (.mif) into the Service Metadata Repository using the tmloadrepos command.Listing 2‑31 shows an SCA component service exposed as a Web service.
2. Use buildscacomponent to build the application component runtime, similar to building a regular SCA component.
3. buildscaserver -w is used to convert SCDL code into a WSDF entry, and produce a deployable server (Oracle Tuxedo server + library + SCDL).Listing 2‑32 WSDF Entry
4. buildscaserver -w also constructs a Service Metadata Repository entry based by parsing the SCDL and interface. The interface needs to be in WSDL form, and manually-composed in this release.
5. Make sure that the UBB source has the TMMETADATA and GWWS servers configured.
6.
7. The WSDF file must be imported into the SALTDEPLOY file and SALTDEPLOY converted into binary using wsloadcf.
8. The Service Metadata Entry file (.mif) is loaded into the Service Metadata Repository.These steps are required, in addition to the SALTDEPLOY configuration, in order to set up the GWWS gateway for Web services processing (for example, configuration of GWInstance, Server Level Properties, etc.). When completed, Web service clients (SCA or other) have access to the Web service.Listing 2‑33 shows a reference accessing a Web service.Listing 2‑33 Example Reference Accessing a Web Service
2. The WSDL file must be converted into a WSDF entry using the wsdlcvt tool. At the same time a Service Metadata Entry file (.mif), and fml32 mapping file is generated.
3. The WSDF file must be imported into the SALTDEPLOY file and SALTDEPLOY converted into binary using wsloadcf.
4. The Service Metadata Entry file (.mif) is loaded into the Service Metadata Repository using the tmloadrepos command.These steps are required, in addition to the SALTDEPLOY configuration, in order to set up the GWWS gateway for Web services processing (for example, configuration of GWInstance, Server Level Properties, etc.). When completed, the SCA client has access to the Web service.Using ATMI binding leverages the Oracle Tuxedo infrastructure. Data exchanged between SCA components, or Oracle Tuxedo clients/services and SCA clients/components is performed using Oracle Tuxedo typed buffers. Table 2‑1 through Table 2‑10 summarize the correspondence between native types and Oracle Tuxedo buffers/types, as well as SOAP types when applicable.In the example shown in Listing 2‑34, implementations send and receive an Oracle Tuxedo STRING buffer. To the software (binding and reference extension implementations), the determination of the actual Oracle Tuxedo buffer to be used is provided by the contents of the /binding.atmi/inputBufferType, /binding.atmi/outputBufferType, or /binding.atmi/errorBufferType elements in the SCDL configuration, and the type of buffer returned (or sent) by a server (or client). It does not matter whether client or server is an ATMI program or an SCA component.Notice that the Oracle Tuxedo simpapp service has its own namespace within namespace services. A C++ method toupper is associated with this service.Listing 2‑34 C++ Interface Example
•
• CARRAY (and X_OCTET)
•
• Table 2‑1 lists simple Oracle Tuxedo buffer types that are mapped to SCA binding.
wchar_t * or wchar_t array When a service called by an SCA client returns successfully, a pointer to the service return data is passed back to the Proxy stub generated by buildscaclient. The Proxy stub then de-references this pointer and returns the data to the application.Table 2‑1 can be interpreted as follows:
• When the reference or service binding extension runtime sees an Oracle Tuxedo STRING buffer, it looks for either a char*, char array, std::string parameter or return type (depending on the direction). If a different type is found, an exception is thrown with a message explaining what happened.
• When the reference or service binding extension runtime sees a char* (for example) as a single parameter or return type, it looks for STRING as the buffer type in the binding.atmi element. If a different Oracle Tuxedo buffer type is found, an exception is thrown with a message explaining what happened.Oracle Tuxedo uses multibyte strings to represent multibyte character data with encoding names based on iconv (as defined by Oracle Tuxedo). C++ uses a wstring, wchar_t*, or wchar_t[] data type to represent multibyte character data with encoding names (as defined by the C++ library).When an SCA client or server receives an MBSTRING buffer or an FML32 buffer with a FLD_MBSTRING field, it considers the encoding for that multibyte string to be the first locale from the following cases:
a. Locale associated with the FLD_MBSTRING field, if present.
b. If case a or b is matched, Oracle Tuxedo invokes the setlocale() function for locale type LC_CTYPE with the locale for the received buffer. If setlocale() fails (indicating there is no such locale) and an alternate name has been associated with this locale in the optional $TUXDIR/locale/setlocale_alias file, Oracle Tuxedo attempts to set the LC_CTYPE locale to the alternate locale.The $TUXDIR/locale/setlocale_alias file may be optionally created by the Oracle Tuxedo administrator. If present, it contains a mapping of Oracle Tuxedo MBSTRING codeset names to an equivalent operating system locale accepted by the setlocale() function.Lines consist of an Oracle Tuxedo MBSTRING codeset name followed by whitespace and an OS locale name. Only the first line in the file corresponding to a particular MBSTRING codeset name are considered. Comment lines begin with #.The $TUXDIR/locale/setlocale_alias file is used by the SALT SCA software when converting MBSTRING data into C++ wstring or wchar_t[] data. If setlocale() fails when using the Oracle Tuxedo MBSTRING codeset name, then the SALT SCA software attempts to use the alias name, if present. For example, if the file contains a line 'GB2312 zh_CN.GB2312' then if setlocale(LC_CTYPE, 'GB2312') fails, the SALT SCA software attempts setlocale(LC_CTYPE, 'zh_CN.GB2312').When an SCA client or server converts a wstring, wchar_t[], or wchar_t* to an MBSTRING buffer or a FLD_MBSTRING field, it uses the TPMBENC environment variable value as the locale to set when converting from C++ wide characters to a multibyte string. If the operating system does not recognize this locale, Oracle Tuxedo uses the alternate locale from the $TUXDIR/locale/setlocale_alias file, if any.
Note: It is possible to transmit multibyte data retrieved from an MBSTRING buffer, an FML32 FLD_MBSTRING field, or a VIEW32 mbstring field. It is also possible to transmit multibyte data entered using the SDO setString() method.However, it is not possible to enter multibyte characters directly into an XML document and transmit this data via SALT. This is because multibyte characters entered in XML documents are transcoded into multibyte strings, and SDO uses wchar_t arrays to represent multibyte characters.The following C++ built-in types (used as return types) are considered complex and automatically encapsulated in an FML/FML32 buffer as a single generic field following the complex buffer mapping rules described in Complex Oracle Tuxedo Buffer Data Mapping. This mechanism addresses the need for returning types where a corresponding Oracle Tuxedo buffer cannot be used.
Note: Interfaces returning any of the built-in types assume that FML/FML32 is the output buffer type. The name of this generic field is TUX_RTNdatatype based on the type of data being returned. TUX_RTNdatatype fields are defined in the Usysflds.h/Usysfl32.h and Usysflds/Usysfl32 shipped with Oracle Tuxedo.
• bool : maps to TUX_RTNCHAR field
• char: maps to TUX_RTNCHAR field
• signed char: maps to TUX_RTNCHAR field
• unsigned char: maps to TUX_RTNCHAR field
• short: maps to TUX_RTNSHORT field
• unsigned short: maps to TUX_RTNSHORT field
• int: maps to TUX_RTNLONG field
• unsigned int: maps to TUX_RTNLONG field
• long: maps to TUX_RTNLONG field
• unsigned long: maps to TUX_RTNLONG field
• long long: (maps to TUX_RTNLONG field
• unsigned long long: maps to TUX_RTNLONG field
• float: maps to TUX_RTNFLOAT field
• double: maps to TUX_RTNDOUBLE field
• long double: maps to TUX_RTNDOUBLE field
•
•
• VIEW (and X_* equivalents)
• Table 2‑2 lists the complex Oracle Tuxedo buffer types that are mapped to SCA binding.For FML and FML32 buffers, parameter names in interfaces must correspond to field names, and follow the restrictions that apply to Oracle Tuxedo fields (length, characters allowed). When these interfaces are generated from metadata using tuxscagen(1), the generated code contains the properly formatted parameter names.Listing 2‑35 shows an interface example. The associated field definitions (following the interface) must be present in the process environment.
An unsigned int being converted to FML or FML32 is cast to a long before being converted to FLD_LONG or long. An unsigned int being converted to a VIEW or VIEW32 member is cast to an int. An exception is thrown if the value of a 64-bit long does not fit into a FLD_LONG or long on a 32-bit platform. An unsigned long is cast to long before being converted to FLD_LONG or long. An exception is thrown if the data value does not fit within a FLD_LONG or long. An unsigned long long is cast to long long before being converted to FLD_LONG or long. This mapping is used when part of a DataObject Generate a data transformation exception, which is translated to an ATMIBindingException before being returned to the application, when: struct structurename Listing 2‑35 Interface ExampleC++ method prototypes that use commonj::sdo::DataObjectPtr objects as parameter or return types are mapped to an FML, FML32, VIEW, or VIEW32 buffer.You must provide an XML schema that describes the SDO object. The schema is made available to the service or reference extension runtime by placing the schema file (.xsd file) in the same location as the SCDL composite file that contains the reference or service definition affected. The schema is used internally to associate element names and field names.
Note: When using view or view32, a schema type (for example, complexType) which name matches the view or view32 used is required.Listing 2‑36 shows the associated schema.Listing 2‑36 SchemaTable 2‑3 shows the generated field table.
Table 2‑3 Generated Field Tables The scatuxgen and tuxscagen utilities are used to generate manual SCA data type mapping. The scatuxgen mapping rules are as follows:
Note: The mapping rules for tuxscagen are executed in the reverse direction (Oracle Tuxedo Buffer Type -> C++ Parameter Type).Table 2‑4 shows the correspondence between parameter/return types and Oracle Tuxedo buffer types (inbuf service-level keyword).
X_COMMON, X_C_TYPE, VIEW, VIEW32, FML, or FML32 depending on intputBufferType setting X_COMMON, X_C_TYPE, VIEW, VIEW32, FML, or FML32 depending on intputBufferType setting Table 2‑5shows the correspondence between parameter/return types and Oracle Tuxedo buffer types (outbuf or err buf service-level keywords).
X_COMMON, X_C_TYPE, VIEW, VIEW32, FML or FML32 depending on the binding.atmi/outputBufferType or binding.atmi/errorBufferType setting. FML32 if no binding.atmi is set, or binding.atmi is set and binding.atmi/outputBufferType or binding.atmi/errorBufferType aren't specified. X_COMMON, X_C_TYPE, VIEW, VIEW32, FML or FML32 depending on the binding.atmi/outputBufferType or binding.atmi/errorBufferType setting. struct structurename FML32 if no binding.atmi is set, or binding.atmi is set and binding.atmi/outputBufferType or binding.atmi/errorBufferType are not specified.Table 2‑7 shows how scatuxgen handles interface parameter types and converts them to an Oracle Tuxedo Service Metadata Repository parameter-level keyword value when more than one parameter is used in the method signature.
Table 2‑6 Parameter-Level/Field Type Mapping Table struct structurename When a method takes an SDO object as an argument, or returns an SDO object, for example as follows: commonj::sdo::DataObjectPtr myMethod(commonj::sdo::DataObjectPtr input).The corresponding runtime type may be described by an XML schema as shown in Listing 2‑37 and then referenced in the binding as shown in Listing 2‑38.Listing 2‑37 XML SchemaListing 2‑38 BindingWhen such a schema is present, scatuxgen parses it and generates the corresponding parameter-level mapping entries as listed in Table 2‑7.
Table 2‑7 Parameter-level/Field Type Mapping mbstring(FLD_MBSTRING) when -t option is specified When a method takes a C struct as an argument, or returns a C struct (for example, as shown in Listing 2‑39), scatuxgen parses it and generates the corresponding parameter-level mapping entries listed in Table 2‑8.Listing 2‑39 C Struct
Table 2‑8 Parameter-Level/Field Type Mapping For parameter-level keywords, the Oracle Tuxedo buffer type/parameter type restrictions are consistent with the contents expected by tmloadrepos. An error message is returned when an attempt to match any combinations that are not listed in Table 2‑9 and Table 2‑10.
In Python, clients or components only use parameters and return values which types are listed in Table 2‑11. Multiple parameters are supported (in the same way that multiple parameters are supported in C++), using FML32 Oracle Tuxedo buffers.
In order to map a string of length 1 to a char*/std::string/STRING, the originating Python variable will have to have 2 ending zeroes (for example, 't = "a\x00").Supported XML objects in Python must be xml.etree.ElementTree objects, (that is, the language extension converts xml.etree.ElementTree objects into commonj::sdo::DataObjectPtr objects, and commonj::sdo::DataObjectPtr objects into xml.etree.ElementTree objects.Some limitations concerning multiple parameters and lists will stand with respect to using bindings. For more information, see Python, Ruby, and PHP Binding.and an example of call: test(1, 2, 3, 4, 5)Exposing a Python function as an SCA service with ATMI or Web services binding requires an interface. This interface is stored in the Oracle Tuxedo Service Metadata Repository as outlined in Python, Ruby, and PHP Component Programming.
Note: Using this notation is limited to local calls (no binding), or using ATMI binding between SCA components (that is, the <binding.atmi> element with no requires="legacy" attribute).and an example of call: test(a=1, b=2)Exposing a Python function as an SCA service with the ATMI or Web Services binding requires an interface. This interface is stored in the Oracle Tuxedo Service Metadata Repository as outlined in Python, Ruby, and PHP Component Programming.The names of the parameters match the key names passed to the Python function. The interface is obtained by making an internal call to the TMMETADATA server. The TMMETADATA server must be running in order to make calls to Python, Ruby or PHP functions.Table 2‑12 lists supported Ruby, C/C++ and Oracle Tuxedo buffer types. Multiple parameters are supported (in the same way that multiple parameters are supported in C++), using FML32 Oracle Tuxedo buffers.
Supported XML objects in Ruby must be REXML (that is, the language extension converts REXML::Document objects into commonj::sdo::DataObect objects, and commonj::sdo::DataObjectPtr objects into REXML::Document objects.
Note: Some limitations concerning multiple parameters and lists will stand with respect to using bindings. For more information, see Python, Ruby, and PHP Binding.which can be called like this: func(1, 2, 3, 4, 5)Exposing a Ruby function as an SCA service with the ATMI or Web Services binding requires an interface. This interface is stored in the Oracle Tuxedo Service Metadata Repository as outlined in Python, Ruby, and PHP Component Programming.
Notes: Using this notation is limited to local calls (no binding), or with using the ATMI binding between SCA components (that is, the <binding.atmi> element with no requires="legacy" attribute).which can be called like this: func2("first" => true, "next" => 5, "last" => "hi")When exposing a Ruby function as an SCA service with the ATMI or Web Services binding, an interface is required. This interface is stored in the Oracle Tuxedo Service Metadata Repository as outlined in Python, Ruby, and PHP Component Programming.Table 2‑13 lists supported Ruby, C/C++ and Oracle Tuxedo buffer types. Multiple parameters are supported (in the same way that multiple parameters are supported in C++), using FML32 Oracle Tuxedo buffers.
Returning XML data in PHP is done by returning a STRING object which is then converted into a SimpleXMLElement as follows:Individual supported types are limited to the types listed in Listing 2‑13, with the exception of types originating from or becoming commonj::sdo::DataObjectPtr objects.In SCA-ATMI applications, an SCA structure parameter can be mapped to an ATMI FML32, FML, VIEW32, VIEW, X_COMMON, or X_C_TYPE data type, and this is the data type that is specified in the SCA composite file.If a VIEW32, VIEW, X_COMMON, or X_C_TYPE data type is specified, then this view must exactly match the structure used as an SCA parameter or return type.If the SCA structure parameter is mapped to FML32 or FML, then the field type of the associated FML32 or FML field is a type that can be converted to and from the SCA structure data type For more informations, see SCA Data Type Mapping.In SCA-ATMI applications, the FML32 or FML field name associated with a structure element shall be obtained from the structure description file. For more information, see Using SCA Structure Description Files.For example, if a structure element is char COMPANY_NAME[20]; and FML field COMPANY_NAME with value "International Business Machines" is mapped to this structure element, then "International Busine" is copied to the structure element with no trailing null character.If an SCA structure is mapped to a VIEW32, VIEW, X_OCTET, or X_C_TYPE data type, then the structure used for the Oracle Tuxedo view-based type must exactly match the SCA structure, and is copied byte-by-byte. In other words, no marshalling of data is done when converting between an SCA structure, and a view. FML32 or FML should be used if data marshalling is required.When an SCA structure is mapped to a view-based Oracle Tuxedo type, you cannot specify bool, wchar_t, long long, unsigned long long, long double, or nested structure data types within the SCA structure since corresponding data types do not exist within Oracle Tuxedo views. Elements corresponding to any Oracle Tuxedo Associated Count Member or Associated Length Member fields must be provided. Appropriate values for any such elements must also be provided by the application if converting an SCA structure to an Oracle Tuxedo view.An mbstring field type currently exists in VIEW32 (for more information, see tpconvvmb32). SCA structures treat the mbstring field type in the same way as in VIEW32. The encoding information is part of an mbstring structure element, and Fmbunpack32() and Fmbpack32() must be used in application programs using mbstring data in structures.You can specify a structure pointer as data returned on TPFAIL if the same structure pointer is also returned on successful output. Since SCA must store internal information describing the returned structure along with the application data, <tuxsca.h> is used to define the structure and typedef as shown in Listing 2‑42.Listing 2‑42 <tuxsca.h> SCA Structure and Typedef DefinitionIf an application normally returns "struct mystruct *" data, it accesses TPFAIL data as shown in Listing 2‑42.Listing 2‑43 TPFAIL ExampleExisting Oracle Tuxedo service interoperability is performed by using the /binding.atmi/@requires attribute with the legacy value. When a legacy value is specified, invocations are performed using the following behavior:
• If a <map> element is present in either a <reference> or a <service>, that value is used to determine which Oracle Tuxedo service is associated with the specified method name to call or advertise.
• In a <reference> element: the value specified in the /reference/@name element is used to perform the Oracle Tuxedo call, with semantics according to the interface method used.
• In a <service> element: the Oracle Tuxedo service specified in the /binding.atmi/map element is advertised, and mapped to the method specified in the /binding.atmi/map/@target attribute.Additionally, the /binding.atmi/@requires attribute is used to internally control data mapping, such that FML32 or FML field tables are not required.
Note: When not specified, communications are assumed to have SCA -> SCA semantics where the actual Oracle Tuxedo service name is constructed from /service/@name or /reference/@name and actual method name (see the pseudo schema shown Listing 2‑27).The ATMI binding schema supports SCA transaction policies by using the /binding.atmi/@requires attribute and three transaction values. These transaction values specify the transactional behavior that the binding extension follows when ATMI binding is used (see the pseudo schema shown Listing 2‑27).When specified, the transaction context is not propagated to the service called. For a <service>, the transaction (if present), is automatically suspended before invoking the application code, and resumed afterwards, regardless of the outcome of the invocation. For a <reference>, equivalent to making a tpcall() with the TPNOTRAN flag.Only applicable to <reference> elements, ignored for <service> elements. Starts a new transaction if one does not already exist, otherwise participate in existing transaction. Such a behavior can be obtained in a component or composite <service> by configuring it AUTOTRAN in the UBBCONFIG. An error is generated if an Oracle Tuxedo server hosts the SCA component implementation and is not configured in a transactional group in the UBBCONFIG.SCA references pass credentials using the <authentication> element of the binding.atmi SCDL element.SCA services can be ACL protected by referencing their internal name: /binding.atmi/service/@name attribute followed by a '/' and method name in SCA -> SCA mode, /binding.atmi/service/@name attribute in legacy mode (SCA -> Tux interop mode).