IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only

Calling QuiP from Java - Cannot get Input from Java variable

  • 1.  Calling QuiP from Java - Cannot get Input from Java variable

    Posted 02/20/03 08:01 PM

    Hi,

    I want to execute an XML Query using Quip on an XML document object
    that is in a variable in a java program of my own. I thought of
    defining a java function that would be called during the execution of
    the XML Query. (In a way similar to the “document” function that gets
    a document into the Quip XML query engine from a remote or local
    file).

    I looked at the examples in QuiP/examples/javaCalls and wrote the
    program below that should work, but it doesn’t.

    I modified the JniTestProg.java in the following way:

    public class JniTestProg {
    static public Element e;

    public static void setElement(Element elem){
    e = elem;
    }
    public static Element getElement(){
    return e;
    }
    }

    The function getElement will be used to input the XML doc into QuiP.

    The relevant portion of my Java Program that calls Quip:

    // …
    Connection qc = …

    // Create an XML “Element” - this will be different every time
    // I call the query (here is just an example)
    String TESTDOC1 = “Begin civil
    twilight19:04 on preceding
    day”;

    Element e = parseStringAsXml(TESTDOC1);

    // The Element is actually SET in JniTestProg
    JniTestProg.setElement(e);

    // the query including the XML Query function that encapsulates
    // getElement that should get my doc into QuiP
    String query = “define function getDocument(){
    javaFunctionElement("JniTestProg1.getElement")} let $x :=
    (getDocument()) return $x//SunData”;

    // Although it was set above, when the query is executed the
    // Element “e” in JniTestProg IS NOT SET = > QUIP ERROR
    QueryResult qr = qc.executeQuery(query);


    Misteriuosly, the element that should have been set by calling
    JniTestProg.setElement(e) it is NOT available to QuiP when the query
    is executed. This is the error QuiP gives:

    quip:message<![CDATA[Error (0,0): Exception occured within Java
    execution: Exception in gcJniCallObjectMethod
    ]]></quip:message>

    Is there any way to pass an XML document stored in a java variable to
    the QuiP query engine?

    Thank you,


    Jose Luis


    #API-Management
    #webMethods
    #Tamino