Support for PLSQL Boolean, PLSQL Record, and PLSQL Table Types

Oracle JCA Adapter for Database 9-117 Figure 9–57 Defining a Database Adapter Service: Finish Page The contents of this page describe what the Adapter Configuration Wizard has detected and what actions are performed when the Finish button is clicked. The following summarizes the contents of this page:

1. The name of the generated WSDL is UseJPub.wsdl.

2. The name of the JCA file is UseJPub_db.jca.

3. Two SQL scripts are created and added to the BPEL process project:

a. BPEL_USEJPUB.sql – Creates the schema objects.

b. BPEL_USEJPUB_drop.sql – Drops the schema objects.

4. The name of the generated XSD is SCOTT_USEJPUB_PKG-24PLSQL.xsd.

When you click Finish, Oracle JPublisher is invoked to generate the SQL files and load the schema objects into the database. The process of generating wrappers may take quite some time to complete. Processing times for wrappers that are generated in the same package usually require less time after an initial wrapper has been generated for another procedure within the same package. The following user-defined types are generated to replace the PLSQL types from the original procedure: SQL CREATE TYPE PKG_REC AS OBJECT X NUMBER, Y VARCHAR2 10; SQL CREATE TYPE PKG_TBL AS TABLE OF NUMBER; The naming convention for these types is OriginalPackageName_ OriginalTypeName . Boolean is replaced by INTEGER in the wrapper procedure. Note: You must execute BPEL_XXXX_drop.sql when re-creating an Oracle Database Adapter. This is likely due to the JPublisher functionality, which uses a cache when generating wrappers. 9-118 Oracle Fusion Middleware Users Guide for Technology Adapters Acceptable values for the original Boolean parameter, now that it is an INTEGER are 0 for FALSE and any non-zero INTEGER value for TRUE. Any value other than 1 is considered false. The generated wrapper procedure uses APIs from the SYS.SQLJUTL package to convert from INTEGER to Boolean and vice-versa. A new wrapper package called BPEL_USEJPUB is created that contains the wrapper for procedure PLSQL, called PKGPPLSQL, as well as conversion APIs that convert from the PLSQL types to the user-defined types and vice-versa. If the original procedure is a root-level procedure, then the name of the generated wrapper procedure is TOPLEVELOriginalProcedureName. The generated XSD represents the signature of wrapper procedure PKGPLSQL and not the original procedure. The name of the XSD file is URL-encoded, which replaces with -24. Note the naming conventions for the generated artifacts: ■ The service name is used in the names of the WSDL and SQL files. It is also used as the name of the wrapper package. ■ The name of the generated XSD is derived from the schema name, service name, and the original package and procedure names. ■ The name of a SQL object or collection data types are derived from the original package name and the name of its corresponding PLSQL type. ■ The name of the wrapper procedure is derived from the original package and procedure names. TOPLEVEL is used for root-level procedures. The name of the generated wrapper package is limited to 30 characters. The name of the wrapper procedure is limited to 29 characters. If the names generated by Oracle JPublisher are longer than these limits, then they are truncated. When the PartnerLink that corresponds with the service associated with the procedure is invoked, then the generated wrapper procedure is executed instead of the original procedure.

9.7.7.3.1 Default Clauses in Wrapper Procedures

If a procedure contains a special type that requires a wrapper to be generated, then the default clauses on any of the parameters are not carried over to the wrapper. For example, consider SQL CREATE PROCEDURE NEEDSWRAPPER B BOOLEAN DEFAULT TRUE, N NUMBER DEFAULT 0 IS BEGIN … END; Assuming that this is a root-level procedure, the signature of the generated wrapper procedure is TOPLEVELNEEDSWRAPPER B INTEGER, N NUMBER The Boolean type has been replaced by INTEGER. The default clauses on both parameters are missing in the generated wrapper. Parameters of generated wrapper procedures never have a default clause even if they did in the original procedure. In this example, if an element for either parameter is not specified in the instance XML, then an error occurs stating that an incorrect number of arguments have been provided. The default value of the parameter that is specified in the original procedure is not used. To address this, the generated SQL file that creates the wrapper must be edited, restoring the default clauses to the parameters of the wrapper procedure. The wrapper Oracle JCA Adapter for Database 9-119 and any additional schema objects must then be reloaded into the database schema. After editing the SQL file, the signature of the wrapper procedure is as follows: TOPLEVELNEEDSWRAPPER B INTEGER DEFAULT 1, N NUMBER DEFAULT 0 For Boolean parameters, the default value for true is 1, and the default value for false is 0. As a final step, the XSD file generated for the wrapper must be edited. A special attribute must be added to elements representing parameters that now have default clauses. Add db:default=true to each element representing a parameter that now has a default clause. For example, element name=B … db:default=true … element name=N … db:default=true … This attribute is used at run time to indicate that if the element is missing from the instance XML, then the corresponding parameter must be omitted from the procedure call. The remaining attributes of these elements remain exactly the same.

9.8 Oracle Database Adapter Use Cases

This describes the Oracle Database Adapter and Oracle Database Adapter - stored procedures use cases. This section includes the following topics: ■ Section 9.8.1, Use Cases for Oracle Database Adapter ■ Section 9.8.2, Use Cases for Oracle Database Adapter - Stored Procedures

9.8.1 Use Cases for Oracle Database Adapter

To obtain Oracle Database Adapter use cases, access the Oracle SOA Sample Code site, and select the Adapters tab. Table 9–20 shows the Oracle Database Adapter samples that are provided with Oracle BPEL PM, and Mediator. Table 9–20 Oracle Database Adapter Use Cases Tutorial Name Description Delete Illustrates the outbound delete operation of the Oracle Database Adapter. An XML record is passed to the operation and the row in the database with the same primary key is deleted. File2Table Illustrates the use of an input a native CSV data file defined in a custom format. The input file is a purchase order, which the file adapter processes and publishes as an XML message to the FIle2Table BPEL process. The message is transformed to another purchase order format and routed to an invoke activity. Insert Illustrates the outbound insert operation of the Oracle Database Adapter. An XML record is passed to the operation and inserted into the database as relational data. In JDeveloper BPEL Designer, Merge Insert or Update is provided. InsertWithCatch Illustrates the extra steps based on the Insert tutorial needed to add fault handling to your BPEL process.