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.
Difference between revisions of "EclipseLink/Examples/DBWS/DBWSBasicAutoGenSchema"
< EclipseLink | Examples | DBWS
Line 11: | Line 11: | ||
This example shows an extension to an existing use case where the Web service exposes the results of executing some custom SQL SELECT statements; however, the 'shape' of the returned result is determined at design-time, not runtime. | This example shows an extension to an existing use case where the Web service exposes the results of executing some custom SQL SELECT statements; however, the 'shape' of the returned result is determined at design-time, not runtime. | ||
− | Under normal circumstances, | + | Under normal circumstances, the custom SQL <tt>SELECT</tt> statement returns <code>java.sql.ResultSet</code>'s and the java.sql.ResultSetMetaData APIs (<code>getColumnCount</code>, <code>getColumnLabel</code>, <code>getColumnType</code>, etc.) can be used to determine the name and datatype of the returned information. DBWS uses the Simplified XML Format (SXF) to create an XML document to describe the <code>ResultSet</code>'s information. Unfortunately, since this document can change arbitrarily, the SXF schema is extremely 'loose' |
− | + | ||
− | + | ||
− | + | ||
<source lang="xml"> | <source lang="xml"> | ||
+ | <?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> |
Revision as of 14:51, 13 June 2011
EclipseLink DBWS Service based on schema-formatted Results from custom SQL SELECT statements
This example shows an extension to an existing use case where the Web service exposes the results of executing some custom SQL SELECT statements; however, the 'shape' of the returned result is determined at design-time, not runtime.
Under normal circumstances, the custom SQL SELECT statement returns java.sql.ResultSet
's and the java.sql.ResultSetMetaData APIs (getColumnCount
, getColumnLabel
, getColumnType
, etc.) can be used to determine the name and datatype of the returned information. DBWS uses the Simplified XML Format (SXF) to create an XML document to describe the ResultSet
's information. Unfortunately, since this document can change arbitrarily, the SXF schema is extremely 'loose'
<?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>