Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Ref Cursor - Web Services - Data controls

451296Nov 13 2006 — edited Nov 16 2006
The quick question : How to get a data control to use a web service based on a ref cursor to work, or point me to tutorial somewhere ?

The long question : I've created a web service based on the following Oracle package :

Package Header :
type ListRecord is Record
(
NR NUMBER(3),
SYMBOL VARCHAR2(2),
VERSION VARCHAR2(3),
CREATION_DATE DATE,
CREATED_BY VARCHAR2(15),
UPDATE_DATE DATE,
UPDATED_BY VARCHAR2(15),
STATUS NUMBER(1),
TYPE VARCHAR2(1)
);



type return_cursor is REF CURSOR return ListRecord;

function CursorTest return return_cursor;

Package Body :
function CursorTest return Return_Cursor is
c Return_Cursor;
begin

Open C for
select * from stc_languages;

return C;
end;

I created a web service via the PL/SQL web service wizard.
The web service works correctly.

I then tried to create a data control from the web service. The data control was created but every time I tried using it I got the following error :

oracle.adf.model.adapter.AdapterException: DCA-40022: Failed to create the structure for schema element "result". The complex type definition of the element cannot be supported.

I then searched the forum and found a post where it stated that the datacontrol needs a xsd and an optional xsl file in order to be able to "understand" the return type from the web service. This in turn is due to the wsdl using <any/> in the response soap message.

I've created an xsd file and I've tried using an empty xsl file (as I don't think any transformation is needed) and a simple xsl file as shown below :

xsd file :
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb">
<xsd:element name="ROWSET" type="rowset"></xsd:element>
<xsd:complexType name="rowset">
<xsd:sequence>
<xsd:element name="T_LANGUAGES_T" maxOccurs="unbounded"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="T_LANGUAGES_T">
<xsd:sequence>
<xsd:element name="NR" type="xsd:integer" xdb:SQLName="NR"
xdb:SQLTYPE="NUMBER"></xsd:element>
<xsd:element name="SYMBOL" xdb:SQLName="SYMBOL" xdb:SQLTYPE="VARCHAR2">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="2"></xsd:maxLength>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="VERSION" xdb:SQLName="VERSION" xdb:SQLTYPE="VARCHAR2">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="3"></xsd:maxLength>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="CREATED_BY" xdb:SQLName="CREATED_BY"
xdb:SQLTYPE="VARCHAR2">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="15"></xsd:maxLength>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="UPDATED_BY" xdb:SQLName="UPDATED_BY"
xdb:SQLTYPE="VARCHAR2">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="15"></xsd:maxLength>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="TYPE" xdb:SQLName="TYPE" xdb:SQLTYPE="VARCHAR2">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="1"></xsd:maxLength>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="STATUS" type="xsd:integer" xdb:SQLName="STATUS"
xdb:SQLTYPE="NUMBER"></xsd:element>
<xsd:element name="UPDATE_DATE" type="xsd:dateTime"
xdb:SQLName="UPDATE_DATE" xdb:SQLTYPE="DATE"></xsd:element>
<xsd:element name="CREATION_DATE" type="xsd:dateTime"
xdb:SQLName="CREATION_DATE" xdb:SQLTYPE="DATE"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

xsl file :

<?xml version="1.0" encoding="windows-1252" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Root template -->
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="ROWSET">
<xsl:for-each select="ROW">
<xsl:value-of select="NR"/>
<xsl:value-of select="SYMBOL"/>
<xsl:value-of select="VERSION"/>
<xsl:value-of select="CREATION_DATE"/>
<xsl:value-of select="CREATED_BY"/>
<xsl:value-of select="UPDATE_DATE"/>
<xsl:value-of select="UPDATED_BY"/>
<xsl:value-of select="STATUS"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

I then create a JSF page on which I place table and form objects which come from the data control.

When I execute the JSF page no data is showing in the table or form objects.

Using the HTTP analyzer I can see the JSF page is calling the web service and that the web service is sending an answer and that the JSF page is requesting the xsl file.

Can anybody explain how to get a data control to use a web service based on a ref cursor to work, or point me to tutorial somewhere ?

Many thanks

Paul
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 14 2006
Added on Nov 13 2006
7 comments
826 views