XCC doesn't support 'request fields' but it does support 'session fields' http://docs.marklogic.com/xdmp:set-session-field
You do have to reuse the same XCC Session object for this to work. http://docs.marklogic.com/guide/xcc/concepts#id_55196 Note that this behavior relies on the Cookies to maintain a session. You need to make sure that each request ends up on the same physical server. If using a Load balencer you should enable http 1.1 compliant mode http://docs.marklogic.com/guide/xcc/concepts#id_28335 ----------------------------------------------------------------------------- David Lee Lead Engineer MarkLogic Corporation [email protected] Phone: +1 812-482-5224 Cell: +1 812-630-7622 www.marklogic.com<http://www.marklogic.com/> From: [email protected] [mailto:[email protected]] On Behalf Of Prasanth N V R Sent: Tuesday, February 17, 2015 4:56 AM To: MarkLogic Developer Discussion Subject: Re: [MarkLogic Dev General] How to set session value in ML Thanks Mike for your response. Is there a way to take values from session without passing it into variables. Some api's like, for Eg. xdmp:get-request-field(). We are just looking for something like Oracle Sys_context which can be created and used in particular session in Oracle. Thanks, Prasanth On Tue, Feb 17, 2015 at 2:23 AM, Michael Blakeley <[email protected]<mailto:[email protected]>> wrote: Try passing values from those sessions into XQuery module variables, that are defined as external. See https://docs.marklogic.com/javadoc/xcc/overview-summary.html under "Passing Variables With Queries". The examples use newAdhocQuery, but newModuleInvoke allows external variables too. Also take a look at these code samples: https://github.com/marklogic/recordloader/blob/0fda9f2e2ca9eb9088bdc11f8d903164428628af/src/java/com/marklogic/recordloader/xcc/XccModuleContent.java#L152 https://github.com/marklogic/corb/blob/c7d92d6f26fcf475d244a4ce977bd113a1583d17/src/java/com/marklogic/developer/corb/Manager.java#L442 -- Mike > On 16 Feb 2015, at 22:01 , Prasanth N V R > <[email protected]<mailto:[email protected]>> wrote: > > Hi, > > We are making a XCC connection to ML DB from Java(invoking XQuery file). > > Is it possible to have any value defined in the XCC session, so that the > value added in the session could be used in XQuery file which is invoked via > the XCC call. > > We in-turn call series of functions defined in various XQuery files, so > instead of passing the values to all these files, is it possible to have a > value in the session and access wherever i need it. > > We tried using the session.setUserObject(). But we are not sure how to access > the session value in XQuery. > > Thanks, > Prasanth > _______________________________________________ > General mailing list > [email protected]<mailto:[email protected]> > http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected]<mailto:[email protected]> http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
