Hello David, Thanks for answer so quickly, sur, look at this is my extension:
> xquery version "1.0-ml"; > > module namespace security = "http://marklogic.com/rest-api/resource/security"; > import module namespace res = "http://www.product.com/libs/response" at > "/app/libraries/response.xqy"; > import module namespace auth = 'http://www.product.com/models/authentication' > at '/app/models/authentication.xqy'; > declare namespace roxy = "http://marklogic.com/roxy"; > > > (:~ > : Function Overview: Invoke all Get method from security Model. > : > : @param $context > : @param $options json with list parameter > : offline viewing or dynamic links for real-time viewing. > : @return document-node()* json format. > :) > > declare > %roxy:params("request=xs:string") > function security:get( > $context as map:map, > $params as map:map > ) as document-node()* > { > let $function := map:get($params,"function") > let $format := ( map:get($params,"format"), "json" )[1] > > let $data := if($function eq "token") then > auth:login($params) > else > <data><error-message>This function is not > available</error-message></data> > > let $var := res:create(200, 0, $data/message , $data/error-message, > $data, 0, (), (), (), $format ) > > return $var > > }; I just put the get method like example, so, I have a library calle “response.xqy” that import the JSON library to decide what kind of file return in every call. I have this code in my library: import module namespace json="http://marklogic.com/xdmp/json" at "/MarkLogic/json/json.xqy”; depending on what parameter receive my library return a XML or JSON file. The weird is that everything works if I make deploy using Roxy with the admin as default user of my HTTP Server. But if I put other user without the admin role, Roxy gives me this error: ERROR: <error:error xsi:schemaLocation="http://marklogic.com/xdmp/error error.xsd" xmlns:error="http://marklogic.com/xdmp/error" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <error:code>RESTAPI-INVALIDCONTENT</error:code> <error:name>err:FOER0000</error:name> <error:xquery-version>1.0-ml</error:xquery-version> <error:message>Invalid content:</error:message> <error:format-string>RESTAPI-INVALIDCONTENT: (err:FOER0000) Invalid content: invalid security extension: could not parse XQuery extension security; please see the server error log for detail XDMP-MODNOTFOUND: (err:XQST0059) xdmp:eval("xquery version &quot;1.0-ml&quot;;&#10;import module namespace t...", (fn:QName("", "service-defs"), map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:map="http://marklogic.com/xdmp/map"><map:entry key="delete"><map:value xsi:type="xs:string">document...</map:map>), fn:QName("", "extension-name"), ...)) -- Module /opt/MarkLogic/Modules/MarkLogic/json/json.xqy not found; security either is not a valid module or does not provide extension functions (delete, get, put, post) in the http://marklogic.com/rest-api/resource/security namespace</error:format-string> <error:retryable>false</error:retryable> <error:expr> </error:expr> <error:data> <error:datum>invalid security extension: could not parse XQuery extension security; please see the server error log for detail XDMP-MODNOTFOUND: (err:XQST0059) xdmp:eval("xquery version &quot;1.0-ml&quot;;&#10;import module namespace t...", (fn:QName("", "service-defs"), map:map(<map:map xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:map="http://marklogic.com/xdmp/map"><map:entry key="delete"><map:value xsi:type="xs:string">document...</map:map>), fn:QName("", "extension-name"), ...)) -- Module /opt/MarkLogic/Modules/MarkLogic/json/json.xqy not found; security either is not a valid module or does not provide extension functions (delete, get, put, post) in the http://marklogic.com/rest-api/resource/security namespace</error:datum> I’m running this command to deploy with Roxy: sh ml local deploy modules Thanks for the help, Fabian Jaramillo > On Dec 15, 2014, at 10:49 AM, David Lee <[email protected]> wrote: > > Could you show us the snippet of your extension module, particularly how you > import the JSON library ? > Also what version of ML are you running. > > The default search path for modules will differ depending on your application > but I don't know how using a different user for deployment would affect it. > Could you include the full error and stack trace for the exemption and any > associated output in ErrorLog.txt > It might be complaining about a different module ... > > A proper include should fully specify the path to the JSON library like this: > > import module namespace json = "http://marklogic.com/xdmp/json > <http://marklogic.com/xdmp/json>" at "/MarkLogic/json/json.xqy"; > > > ----------------------------------------------------------------------------- > David Lee > Lead Engineer > MarkLogic Corporation > [email protected] <mailto:[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 Fabian Jaramillo > Sent: Monday, December 15, 2014 10:35 AM > To: MarkLogic Developer Discussion > Subject: [MarkLogic Dev General] Problem Importing MarkLogic modules from the > REST API > > Hello, > > I’m trying to use the module JSON (http://marklogic.com/xdmp/json > <http://marklogic.com/xdmp/json>) from one Extension REST API and I get an > error XDMP-MODNOTFOUND, but if I use the admin user to deploy everything > works, somebody knows what is the permission that I have to add to my default > user to allow use these kind of modules? > > Thanks, > > FABIAN JARAMILLO Software Architect > Yuxi Pacific LLC, Cr 48 N 20-34, Centro Empresarial Ciudad del Río, Oficina > 1014, Medellín, Colombia. > [email protected] <mailto:[email protected]> > Office: +19177252076 > Mobile: (57) 300-209-8933 > Skype: yuxi-fabian > > <image001.png> <http://www.twitter.com/YuxiPacific> > <http://www.twitter.com/YuxiPacific><image002.png> > <http://www.linkedin.com/company/yuxi-pacific?trk=company_name> > <http://www.linkedin.com/company/yuxi-pacific?trk=company_name><image003.png> > <http://www.youtube.com/user/yuxipacific> > <http://www.youtube.com/user/yuxipacific><image004.png> > <http://www.facebook.com/yuxipacific?fref=ts> > <http://www.facebook.com/yuxipacific?fref=ts> > <image005.png> <http://www.yuxipacific.com/> > > _______________________________________________ > General mailing list > [email protected] <mailto:[email protected]> > http://developer.marklogic.com/mailman/listinfo/general > <http://developer.marklogic.com/mailman/listinfo/general> FABIAN JARAMILLO Software Architect Yuxi Pacific LLC, Cr 48 N 20-34, Centro Empresarial Ciudad del Río, Oficina 1014, Medellín, Colombia. [email protected] <mailto:[email protected]> Office: +19177252076 Mobile: (57) 300-209-8933 Skype: yuxi-fabian <http://www.twitter.com/YuxiPacific> <http://www.twitter.com/YuxiPacific> <http://www.linkedin.com/company/yuxi-pacific?trk=company_name> <http://www.linkedin.com/company/yuxi-pacific?trk=company_name> <http://www.youtube.com/user/yuxipacific> <http://www.youtube.com/user/yuxipacific> <http://www.youtube.com/user/yuxipacific> <http://www.youtube.com/user/yuxipacific> <http://www.facebook.com/yuxipacific?fref=ts> <http://www.facebook.com/yuxipacific?fref=ts> <http://www.yuxipacific.com/> <http://www.yuxipacific.com/>
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
