Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/UserGuide/DBWS/Creating from a Stored Procedure"

m
m
 
Line 2: Line 2:
 
'''[http://www.eclipse.org/eclipselink/documentation/2.4/dbws/toc.htm Developing Persistence Architectures Using EclipseLink Database Web Services, Release 2.4]'''
 
'''[http://www.eclipse.org/eclipselink/documentation/2.4/dbws/toc.htm Developing Persistence Architectures Using EclipseLink Database Web Services, Release 2.4]'''
  
 
+
For "Creating from a Stored Procedure," see http://http://www.eclipse.org/eclipselink/documentation/2.4/dbws/creating_dbws_services005.htm
----
+
[[Category:DBWS]]
 
+
 
+
{{EclipseLink_UserGuide
+
|info=y
+
|toc=n
+
|eclipselink=y
+
|eclipselinktype=DBWS
+
}}
+
 
+
==Creating from a Stored Procedure==
+
EclipseLink DBWS can create a Web service that exposes a Stored Procedure (or multiple procedures). Because it is not possible to determine the structure of the returned data from the Stored Procedure's metadata, EclipseLink uses the Simple XML Format schema. The EclipseLink DBWS runtime produces an XML document that is simple and "human-readable".
+
 
+
The EclipseLink DBWS supports any combination of IN, OUT and IN OUT arguments. Additionally, EclipseLink also supports procedures in packages that are overloaded (that is, the same name but different parameters).
+
 
+
 
+
===Example===
+
This example uses the following Stored Procedure:
+
 
+
<source lang="sql"  enclose="div">
+
DROP PROCEDURE TESTECHO;
+
CREATE OR REPLACE PROCEDURE TESTECHO(T IN VARCHAR2, U OUT VARCHAR2) AS
+
BEGIN
+
  U := CONCAT(T, '-test');
+
END;
+
</source>
+
 
+
The <tt>DBWSBuilder</tt> utility requires a DBWS configuration XML file as input, as shown here:
+
 
+
<source lang="xml" enclose="div">
+
<?xml version="1.0" encoding="UTF-8"?>
+
<dbws-builder xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
  <properties>
+
    <property name="projectName">testEcho</property>
+
    ... database properties
+
  </properties>
+
  <procedure
+
    name="testEcho"
+
    procedurePattern="TESTECHO"
+
    isSimpleXMLFormat="true"
+
  />
+
</dbws-builder>
+
</source>
+
 
+
Execute the DBWS Builder, as shown here:
+
 
+
<source lang="text">
+
prompt > dbwsbuilder.cmd -builderFile dbws-builder.xml -stageDir output_directory -packageAs wls testEcho.war
+
</source>
+
 
+
where
+
* <tt>dbws-builder.xml</tt> is the DBWS builder configuration XML file above
+
* <tt>output_directory</tt> is the output directory for the generated files
+
* <tt>-packageAs</tt> specifies the platform on which the web service will be deployed
+
 
+
The generated <tt><b>eclipselink-dbws-schema.xsd</b></tt> file is the schema for the Simple XML format, as shown here:
+
<source lang="xml" enclose="div">
+
<?xml version="1.0" encoding="UTF-8"?>
+
<xsd:schema
+
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+
  >
+
  <xsd:complexType name="simple-xml-format">
+
    <xsd:sequence>
+
      <xsd:any minOccurs="0"/>
+
    </xsd:sequence>
+
  </xsd:complexType>
+
</xsd:schema>
+
</source>
+
 
+
You can customize the <tt><b>simple-xml-format</b></tt> and <tt><b>simple-xml</b></tt> tags by setting the appropriate properties on an <tt>sql</tt> operation.
+

Latest revision as of 08:45, 1 November 2012

For the current version, see: Developing Persistence Architectures Using EclipseLink Database Web Services, Release 2.4

For "Creating from a Stored Procedure," see http://http://www.eclipse.org/eclipselink/documentation/2.4/dbws/creating_dbws_services005.htm

Back to the top