Page 1 of 1

import fn-bea libraries

Posted: Mon Aug 22, 2011 11:57 am
by sandrocchio_0.1
Hi all,
we'd like to use propetary functions from Oracle OSB on Oxygen xquery editor, such as fn-bea:date-from-string-with-format().

I've tried copying some xquery jars from the Oracle installation into Oxygen lib folder and declaring the namespace as

declare namespace fn-bea = "oracle.xquery.XQueryContext";
or
declare namespace fn-bea = "http://www.bea.com/xquery/xquery-functions";

but it still doesn't find it.

Any helps?
Thanks in advance

Re: import fn-bea libraries

Posted: Mon Aug 22, 2011 5:41 pm
by adrian
Hello,

What XQuery engine are you planning to use to execute XQuery with these extensions? I'm guessing it's the default one offered by Oxygen (Saxon-PE XQuery) but I'm asking because these extensions can sometimes depend on the engine.

Do NOT add the extension jars to the Oxygen lib folder, they won't be picked up from there by the XQuery engine, and they might accidentally overwrite some Java classes that are essential to Oxygen.

We haven't tested specifically Saxon XQuery with the BEA extensions in Oxygen but you should be able to use them by configuring an XQuery transformation scenario(Document > Transformation > Configure Transformation Scenario, New).
In the XQuery tab from the scenario configuration dialog make sure Saxon-PE XQuery is selected from the Transformer combo, press the Extensions button and add the jars there.

To execute the scenario press Transform now in the Configure Transformation Scenario dialog or from the main menu/toolbar: Document > Transformation > Apply Transformation Scenario.

Regards,
Adrian

Re: import fn-bea libraries

Posted: Mon Aug 22, 2011 6:31 pm
by sandrocchio_0.1
Hi Adria,
thanks for the quick reply. I moved out the jars from the lib folder as you suggested. I've also set them onto the extension pannel but yet, doesn't work. It fails validating the xquery
F [Saxon-PE XQuery 9.3.0.5] Cannot find a matching 2-argument function named {http://www.bea.com/xquery/xquery-functi ... ith-format()
Do I have to type some specific namespace instead of

declare namespace fn-bea = "http://www.bea.com/xquery/xquery-functions";


Thanks again for your help

Re: import fn-bea libraries

Posted: Tue Aug 23, 2011 5:18 pm
by adrian
Hi,

Are the fn-bea libraries public for download? I can't seem to find them anywhere.
I've only found some online documentation of the functions.

Regards,
Adrian

Re: import fn-bea libraries

Posted: Thu Mar 05, 2015 5:06 pm
by archenroot
Those libraries you cannot probably download as single artefacts, but need to install Oracle Fusion Middleware, for current 12c version you are ok with Infrastructure, Oracle Service Bus or Oracle SOA Suite products. I am just trying to achieve this as soon as I like the debugger functionality of Oxygen XML editor.

Question: Can I replace the Xquery builtin engine in Oxygen with one implemented in Oracle Service Bus? This will make things even cleaner.

Thank you.

Ladislav

Re: import fn-bea libraries

Posted: Thu Mar 05, 2015 5:25 pm
by archenroot
Well, after creating the Transformation scenario I added all the xquery sdk jar files from Oracle Service Bus, but in the editor of Xquery file it is not able to find the function under defined namespace:

Code: Select all


declare namespace fn-bea = "http://www.bea.com/xquery/xquery-functions";
declare function local:getInbound() as element() (:: schema-element(ctx:endpoint) ::){
fn-bea:inlinedXML($geh:errorCaptureMessage//geh:inbound/text())
};
Result in editor on validation:

Code: Select all

System ID: C:\JDeveloper\mywork\Vodafone_OracleServiceBus\CommonServices_GenericErrorHandling_Processing\XQuery\ConstructErrorGenericMessage.xqy
Main validation file: C:\JDeveloper\mywork\Vodafone_OracleServiceBus\CommonServices_GenericErrorHandling_Processing\XQuery\ConstructErrorGenericMessage.xqy
Engine name: Saxon-PE XQuery 9.5.1.5
Severity: fatal
Description: XPST0017: Cannot find a matching 1-argument function named {http://www.bea.com/xquery/xquery-functions}inlinedXML()
Start location: 56:0
URL: http://www.w3.org/TR/xpath20/#ERRXPST0017
Oxygen cannot see the OSB functions, I will try to execute it.

Ladislav

Re: import fn-bea libraries

Posted: Thu Mar 05, 2015 5:33 pm
by archenroot
The files of the Xquery SDK for Oracle Fusion Middleware 12c are available here:
http://uloz.to/xptJmHDi/oracle-xdk-12-1-3-7z

Re: import fn-bea libraries

Posted: Thu Mar 05, 2015 5:40 pm
by adrian
Hi,

@Ladislav: The XQuery engine used by Oxygen is Saxon XQuery and it's not possible to replace it. Note that XQuery debugging is only available with the engines supported by Oxygen out-of-the box, Saxon XQuery (builtin) and external XQuery Databases.

I'm not familiar with the Oracle Service Bus, so I'm not sure in what form it can be used or what API it implements or offers.

If needed, you can configure an external/custom XQuery engine in Oxygen in Options > Preferences, XML > XSLT/FO/XQuery > Custom Engines:
Oxygen XML Editor 16.1 - Custom Engines Preferences
You can then use this engine in an XQuery transformation scenario.

Alternatively, if it implements XQuery API for Java (XQJ), you could configure a XQJ Data Source and XQJ Connection.
Similarly, you can then use this engine (the connection name) in an XQuery transformation scenario.

Regards,
Adrian

Re: import fn-bea libraries

Posted: Thu Mar 05, 2015 6:01 pm
by archenroot
Thank you, I am in the moment what engine it uses. In the Oracle documentation I just see that Xquery 1.0 is fully supported and was able to find those Xquery sdk JAR files. If I will be able to find the engine, will try to replace it in Oxygen.

The main purpose is not to replace the engine in Oxygen, main purpose is to use Oxygen with OSB XQuery specific functions which are available via JAR files.

Hm, I was able to find an article on Xquery debugging in JDeveloper and there is also the Java way:
http://biemond.blogspot.ie/2008/11/usin ... g-and.html

The code snippet:

Code: Select all

import java.io.FileNotFoundException;  
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;

import javax.xml.namespace.QName;

import oracle.xml.parser.v2.DOMParser;
import oracle.xml.parser.v2.XMLDocument;
import oracle.xml.parser.v2.XMLParseException;
import oracle.xml.xqxp.datamodel.XMLItem;
import oracle.xml.xqxp.datamodel.XMLSequence;
import oracle.xquery.PreparedXQuery;
import oracle.xquery.XQueryContext;
import oracle.xquery.exec.Utils;
import org.xml.sax.SAXException;


public class TestXQuery {

public TestXQuery() {
try {

XQueryContext ctx = new XQueryContext();
Reader strm = new FileReader("main_delfor2.xq");
PreparedXQuery xquery = ctx.prepareXQuery(strm);

DOMParser prs = new DOMParser();
InputStream is = Utils.getStream("delfor2.xml");
prs.parse(is);
XMLDocument doc = prs.getDocument();

xquery.setNode( new QName("data_message2"), doc);

XMLSequence seq = xquery.executeQuery();
while (seq.next()) {
XMLItem item = seq.getCurrentItem();
item.getNode().print(System.out);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (XMLParseException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
}
}

public static void main(String[] args) {
TestXQuery testXQuery = new TestXQuery();
}
}
From those imports I am going to identify which of the JAR files are physically imported and will post later. Also will try to configure them as Oxygen engine.

Thanks a lot.

Re: import fn-bea libraries

Posted: Fri Mar 06, 2015 2:29 pm
by archenroot
Well, custom engine is not the solution to this problem. I can create wrapper around Oracle XQuery Development Kit without issue. The wrapper will have 3 parameters:
->input XML
->input XQuery
->output XML

But still it is not solving the issue with non-resolved osb function from fn-bea and other Oracle related namespaces in Oxygen XML Editor itself. I would like to utilize Oxygen debugger, that is the main task. Do you have any hint on this, some hacking of Oxygen?

Re: import fn-bea libraries

Posted: Fri Mar 06, 2015 5:34 pm
by adrian
Hi,

You can only use a custom/external XQuery engine for transformations (transformation scenario). It cannot be used for validation (that's what you need for the namespaces to be accepted) or debugging.
I mentioned in my previous post that the debugger can only be used with the engines supported by Oxygen out-of-the-box.

If there are XQuery modules that declare the functions from those namespaces, you could import these modules in your XQuery for validation in Oxygen with Saxon XQuery.

Regards,
Adrian

Re: import fn-bea libraries

Posted: Tue Mar 10, 2015 7:21 pm
by archenroot
But the all Oracle Xquery modules are in Java CLASS form, not Xquery form, is there any way how to import Java Xquery modules into Oxygen for usage in Xquery editor and debugger?

It might be solution to create over Oracle XDK libraries wrapper compatible with Oxygen interfaces. Do you think it might be possible?

Re: import fn-bea libraries

Posted: Wed Mar 11, 2015 6:29 pm
by adrian
Hi,

The manual mentions that an XQuery processor that offers an XQJ API implementation can be used for validation:
XQuery Validation

So, if you're using the Oracle XQuery Development Kit, you should, at least in theory, be able to use it for validation as an XQJ processor.
The first step is to try configuring and running it in Oxygen as an XQJ processor:
http://docs.oracle.com/database/121/ADX ... ADXDK99930
See my first reply to you on how that can be done:
adrian wrote:Alternatively, if it implements XQuery API for Java (XQJ), you could configure a XQJ Data Source and XQJ Connection.
Similarly, you can then use this engine (the connection name) in an XQuery transformation scenario.
Regards,
Adrian

Re: import fn-bea libraries

Posted: Thu Mar 12, 2015 4:59 pm
by archenroot
Sorry Adrian, I should more carefully read all the comments first. Thank you for your hints and your patience, I am going to give it a try, will post results.

Re: import fn-bea libraries

Posted: Thu Mar 12, 2015 7:15 pm
by archenroot
Ok, so in Oracle Fusion Middleware (SOA Suite) 12c are some files multipletimes, I didn't checked the version, but switched from SOA box to Oracle Database 12c box and copied required files as described in documentation.

Now, I tried pure Java example to use Oracle 12c XDK Engine with success:
Image

Note: here is used driver "oracle.xml.xquery.OXQDataSource" for the datasource(engine itself). There is also available JDBC driver as "import oracle.xml.xquery.xqjdb.OXQDDataSource", which will allow connect to database located engine.

Ok, I am going with import oracle.xml.xquery.xqjdb.OXQDDataSource in Oxygen for the first time:
Define the Data source and related Connection
Image

Define new Validation scenario with new engine Oracle 12c XDK Connection:
Image

And testing the scenario:
Image

This is failing OXQConnection:method not implemented

Re: import fn-bea libraries

Posted: Fri Mar 13, 2015 4:07 pm
by archenroot
Well, so Oxygen is reporting on Validation, Execution:
OXQConnection:method not implemented

But what method is missing?

When trying to start Debug session it reports:
The transformer Oracle 12c XQuery Engine is not supported in debugging mode, even I set debug-mode Connection property to true in Preferences.

Stuck in the moment. Is there any way of starting Oxygen in debug mode with output to file? Or can I configure log4j.xml file under tools/config folder to support new file appender with full trace enabled?

Re: import fn-bea libraries

Posted: Fri Mar 13, 2015 4:47 pm
by adrian
Hi,

I did not yet have the chance to test Oracle XDK in Oxygen. My guess is there's a missing jar, or you're using an older version of the XDK that did not have a full XQJ implementation.

But, as I mentioned before, the XQuery debugger can only be used with the XQuery engines supported by Oxygen out-of-the-box, not with XQJ. So, even if you configure this successfully as XQJ, you will not be able to use it in the XQuery debugger. If that is your end goal, I must disappoint you.

Also, from what I've tested with another implementation of XQJ, the validation via XQJ from Oxygen returns only a pass/fail result, without any location or information about the actual error.

Regards,
Adrian

Re: import fn-bea libraries

Posted: Fri Mar 13, 2015 6:23 pm
by archenroot
Hi,

again thanks for your prompt answer. I understand, I tried to replace the jar files taken from Oracle 12c Database installation as described in documentation by files taken from Oracle Fusion Middleware SOA Suite installation (there are about 7 additional files).

For your games, here is available folder called oracle.xdk_12.1.3 available in Oracle Fusion Middleware installation:
http://ulozto.net/xxVgw7zx/oracle-xdk-12-1-3-7z

Still it want to work also with 3 other files as in documentation.
orai18n-mapping.jar
apache-xmlbeans.jar
antlr-runtime.jar

I found different versions of apache-xmlbeans.jar and orai18n-mapping.jar files installed within my OFM install. So will install again the latest 12c database, will upgrade with latest patch from oracle (I am registered with Oracle Support) and will try again.

Well, it is clear to me now. In maximum we get from Oxygen Validation/Transformation(execution) phases. Which is anyway nice of course if possible.
On the other hand the primary goal is to get some Xquery debugger for SOA products from Oracle as soon as currently in JDeveloper there is only testing console, but that console comes from old times of BEA Systems, based from UI I think I can recognize ancient artifacts. This console gives you just the dummy message output in some case (committing some more Java exceptions details) :
Expected [1] item, got [0]

Suppose you have query with dozens of functions, you are in hell with such message :-)))

Is the Oxygen Debugger so linked to Saxon that it cannot be used with another implementation, I am no beginner, but was never that deep in XQuery and Java and Engine problematic before.

Thank you very much for those information.

Ladislav

Re: import fn-bea libraries

Posted: Mon Jun 14, 2021 1:19 pm
by suresh
I am facing the below error while calling evaluate() in the class XQueryEvaluator in java to calling xquery. I have mentioned the decencies below, error and other details. Could you please help on this. Please let me know if any information is required.

Error:
Static error on line 33 column 59
XPST0017 Cannot find a 1-argument function named
Q{http://www.bea.com/xquery/xquery-functions}inlinedXML()
2021-06-14 15:01:40.721 ERROR 11280 --- [ntContainer#0-1] c.p.b.f.c.FitRoutingConsumer : Error while calling transformBtpsgenXquery : net.sf.saxon.s9api.SaxonApiException: Cannot find a 1-argument function named Q{http://www.bea.com/xquery/xquery-functions}inlinedXML()
or
Static error on line 33 column 59
XPST0017 Cannot find a 1-argument function named Q{oracle.xquery.XQueryContext}inlinedXML()
2021-06-14 15:34:47.561 ERROR 12244 --- [ntContainer#0-1] c.p.b.f.c.FitRoutingConsumer : Error while calling transformBtpsgenXquery : net.sf.saxon.s9api.SaxonApiException: Cannot find a 1-argument function named Q{oracle.xquery.XQueryContext}inlinedXML()

In XQuery:
declare namespace fn-bea = "oracle.xquery.XQueryContext";
or
declare namespace fn-bea = "http://www.bea.com/xquery/xquery-functions";

for $formMessage at $formPosition in $formMessages/*:objFileTransPollData
let $transactionId := string($formMessage/*:transmission_id[1])
let $holdReleaseId := string($formMessage/*:hold_release_id[1])
let $taxForm := fn-bea:inlinedXML(string($formMessage/*:message_body[1])) ==> here it was failing



Dependecies:

compile 'net.sf.saxon:Saxon-HE:9.7.+'
or
implementation group: 'net.sf.saxon', name: 'Saxon-HE', version: '10.1'