Below is the code in my Oracle Forms to call a web service:
-- Method: authenticate (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
a1 VARCHAR2) RETURN VARCHAR2 IS
args := JNI.CREATE_ARG_LIST(2);
RETURN JNI.CALL_STRING_METHOD(FALSE, obj, 'mypackage/AuthenticatorWebServiceServiceStub',
'authenticate', '(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;', args);
However when the above code is invoked it shows the message 'here1' on the form and then throws the following exception: java.lang.Exception: java.lang.ClassCastException
Please suggest me what's wrong with the code. I appreciate your time and help.
Edited by: Scott on Feb 9, 2011 8:05 AM
First that isn't "JNI".
JNI is a specification related to java which allows java and other language to interact in the same process.
Conversely you are obviously using a PL/SQL package. The fact that is named 'JNI' means nothing.
Is that even an Oracle system package? I couldn't find Oracle docs for it.
The exception seems obvious. And the most likely sources are your arguments or the return type.
That code is auto generated by Oracle forms when a java class is imported. I couldn't find much documentation on the JNI methods but here is a link where Oracle talks a little bit about that:
It says: You can conveniently access the imported Java through the generated PL/SQL using the new ORA_JAVA package and its built-ins. Internally, the generated PL/SQL packages use the Java Native Interface (JNI) standard.
I double checked the arguments and all. Nothing seems wrong. I am in a very bad situation as there isn't any documentation available on the JNI methods used in this code.
Thanks for your time.