Thursday, July 14, 2011

OSB Custom XPath: XQuery expression validation failed: {err}FONS0003: : prefix not defined in static context

I have created a Custom XPath function, and the entry in osb-built-in.xml is:


            initTSSArray
            Fills the TSScache with all elements, using Id as a key
            http://acme.com/Nis
            com.acme.osb.CachesService
            java.lang.String initTSSArray(java.lang.String, [Lorg.apache.xmlbeans.XmlObject;)
            true
            Pipeline
            SplitJoin
        



When using the new XPath function, I have to precede it with the Namespace prefix generated by OSB :

nisnx:initTSSArray(...)


Problem is, in Eclipse this nisnx is not defined. So I add nisnx as a static prefix in the Proxy Workflow, and next thing I get is:

XQuery expression validation failed: {err}XQ0017: unknown function (or number of arguments (0) is wrong)

The problem now is how to register the custom function in Eclipse.

I will find out one day....


The official documentation says nothing on the topic:

http://download.oracle.com/docs/cd/E17904_01/doc.1111/e15866/custom_xpath.htm

It turns out that, if Eclipse is installed in
C:\Oracle4\Middleware\oepe_11gR1PS3

you must copy the XML and JAR file to
C:\Oracle4\Middleware\Oracle_OSB1\config\xpath-functions

at this point Eclipse will recognize the Custom XPath functions (after restart and clean).

My problem was that I had deployed the JAR and XML only to my remote installation, not to the local OSB installation. So Eclipse could not see the definition of the XPath Functions.


see also:

http://www.xenta.nl/blog/2010/07/14/oracle-service-bus-custom-xpath-functions-prefix-not-defined-in-static-context/

http://forums.oracle.com/forums/thread.jspa?threadID=1118538&tstart=30

http://www.xenta.nl/blog/2010/05/10/oracle-service-bus-11g-using-custom-xpath-functions/


and watch this cool video


No comments: