Hello everyone, I'm new here! (:
I'm also quite new to Java development and Oracle either, but I'm learning.
My problem is the following, I created a dll in .net and used it as custom function in MSSqlServer, basically this library act as a SOAP gateway letting me call a webservice (both in GET and POST) simply using a SELECT like this
SELECT *
FROM fn_SoapGateway_MakeWebRequest
(
'GET', -- Method
'https://fish.go-moo.it', -- Url
'/foo/bar?method=info', -- Path
'' -- XML Envelope
)
Now, I want to do the same thing but using Java for Oracle.
For testing purposes, I created the class "SoapGateway" which exposes two static methods:
- 1) public statis String GetData() <- which returns just a string, to see that all things work good..
- 2) public static String MakeWebRequest(String username, String password, String method, String url, String path, String envelope) <- makes the call to the webservice
The second step is compiling everything with the Oracle java compiler so there will be no problems of java version: done!
Now third step: binding Oracle function to the java class with a simple code like this
CREATE OR REPLACE FUNCTION fn_SoapGateway_GetData RETURN VARCHAR2 AS
LANGUAGE JAVA NAME 'SoapGateway.GetData() return java.lang.String';
COMMIT;
and last, test the simple function GetData with this select
SELECT MY_SCHEMA.fn_SoapGateway_GetData() FROM DUAL ;
.. works like a charme!! and it returns me my custom string.
Now, finally I can ask you my questions:
1) What should I write in Oracle to bind the function "MakeWebRequest" and create the function in Oracle?
2) Is it correct sending a "String" as an Envelope and returning a "String" or should I use a bigger data type? If so, which kind of data type? Can you help me correcting my code? I can share everything once it works
3) How can I invoke the function correctly from Oracle to obtain the response as an XML variable?
Many many thanks for helping!
tell me if I was not clear in something!