Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Help for Java method used as an Oracle function

  1. #1
    Junior Member
    Join Date
    Oct 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Help for Java method used as an Oracle function

    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!


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Help for Java method used as an Oracle function

    Thread moved. I'm not sure that it's in the right place, but it's better than it was.

  3. #3
    Junior Member
    Join Date
    Oct 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help for Java method used as an Oracle function

    Hello GregBannon, why to Web Frameworks? It regards Java development for Oracle..
    Thank you anyway

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Help for Java method used as an Oracle function

    To get you a bump (now 3) and maybe someone who can help you.

  5. #5
    Junior Member
    Join Date
    Oct 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Help for Java method used as an Oracle function

    Ok thank you!

Similar Threads

  1. Run() method of runnable function has no access to data members?
    By ineedahero in forum What's Wrong With My Code?
    Replies: 6
    Last Post: December 9th, 2013, 05:31 PM
  2. Java Barcode Program with Oracle database
    By techsing14 in forum JavaServer Pages: JSP & JSTL
    Replies: 3
    Last Post: December 6th, 2012, 05:19 AM
  3. how to write a function *method* in Java to reverse an Array using Groovy?
    By Cyclist in forum Other Programming Languages
    Replies: 7
    Last Post: October 17th, 2012, 06:20 PM
  4. Java server Faces and Oracle
    By rcbandit in forum JDBC & Databases
    Replies: 0
    Last Post: December 8th, 2011, 02:59 PM
  5. Replies: 0
    Last Post: May 3rd, 2010, 04:42 AM