When calling collection.getService("XQueryService", "1.0") it seems that I receive an object of type RemoteXPathQueryService, which is an “exist” class (as opposed to an org.xmldb class).


All this is well and good. Unfortunately, I need to cast to org.xmldb.api.modules.XQueryService, but RemoteXPathQueryService does not implement this interface. Funnily enough, it does implement XQueryService, but only org.exist’s.


I would assume that org.exist.XQueryService should implement org.xmldb.api.modules.XQueryService.

The workaround would be to cast it to org.xmldb.api.modules.XPathQueryService, which again, ironically, it does implement. But I need the “declareVariable” functionality of XQueryService.


Another workaround would be to use org.exist’s XQueryService, but it would be nice to keep the application as neutral from an implementation as possible.


So my questions are:

1. Is this a bug, or am I misunderstanding something?

2. Any other workaround that doesn’t force me to import org.exist.*?




Gil Tayar


Chief Technology Officer

Business: +972 (3) 766 1806

Mobile:    +972 (54) 634 4457