Re: [MarkLogic Dev General] JSON sending in the request body is not being converted into map:map in ML8 using roxy however working fine with ML6

2015-04-28 Thread David Ennis
HI.

The issue here may be is that json is a first-class citizen in MarkLogic 8
and is happy staying as json.

If all of your code expects a map, then perhaps you can test the type of
the document and if its json, transform it to the map on the fly.

Kind Regards,
David Ennis



Kind Regards,
David Ennis


David Ennis
*Content Engineer*

[image: HintTech]  http://www.hinttech.com/
Mastering the value of content
creative | technology | content

Delftechpark 37i
2628 XJ Delft
The Netherlands
T: +31 88 268 25 00
M: +31 63 091 72 80

[image: http://www.hinttech.com] http://www.hinttech.com
https://twitter.com/HintTech  http://www.facebook.com/HintTech
http://www.linkedin.com/company/HintTech

On 28 April 2015 at 16:14, Indrajeet Verma indrajeet.ve...@gmail.com
wrote:

 Hi,

 Please help us if you have encountered same kind of problem.

 We are upgrading ML6 to ML8 and using roxy as well. The roxy is customized
 based on the customer requirement.


 For one of the REST request /setcache, we are sending below data to
 cache and that is being converted into map (key value pair)

 ML6-

 Request in Body-
 ---

 {USERSESSION:a57e7e98cae8a7857285cd9a66de813f|4/28/2015 9:48:14
 PM:{user:user-profile
 wk-pid=\USR-b740cbc5-5e27-8b1c-d97a-1329625f6b39\docTypeUsers/docTypeusername
 type=\string\USR-b740cbc5-5e27-8b1c-d97a-1329625f6b39/usernameuserId
 type=\string\lrunne...@wk.com/userIdemail type=\string\
 lrunne...@wk.com/emailuserStatus
 type=\string\Active/userStatusdefaultContentCollectionALL/defaultContentCollectionrole
 type=\string\user/roletrialEndDate type=\string\/activationDate
 type=\string\2013-12-25/activationDatephoneNumber
 type=\string\/sendWelcomeEmail type=\string\/additionalEmail
 type=\string\/filingContent
 type=\string\Allowed/filingContentfirstName
 type=\string\John/firstNamelastName
 type=\string\Doe/lastNameorgCode
 type=\string\WK001/orgCodeorgName
 type=\string\LoadRunner/orgNamesalesTerritory
 type=\string\/password5f4dcc3b5aa765d61d8327deb882cf99/passwordpwpassword/pwcountOfLoggedIn11/countOfLoggedIncreated2014-07-11T11:05:11.589-05:00/createdcreatedBy
 type=\string\System/createdBymodified2014-07-11T11:05:11.589-05:00/modifiedmodifiedBy
 yun.y...@wolterskluwer.com/modifiedBy/user-profile,
 session:session wk-pid=\a57e7e98cae8a7857285cd9a66de813f|4/28/2015
 9:48:14
 PM\usernameUSR-b740cbc5-5e27-8b1c-d97a-1329625f6b39/usernamecreated2015-04-28T17:48:14.661+05:30/createdexpiration2015-04-28T21:48:14.661+05:30/expirationcurrenttime2015-04-28T17:48:14.661+05:30/currenttimevalidfalse/valid/session}}

 Converted into below map using ML6-
 --

 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=USERSESSION:97f7d8ec0b5bba928cb025bd1d4d28d4|4/28/2015 9:57:24
 PMmap:valuemap:mapmap:entry key=usermap:valueuser-profile
 wk-pid=USR-59fb4f7d-de03-1e37-a23c-5c3d71552eaausernameUSR-59fb4f7d-de03-1e37-a23c-5c3d71552eaa/usernamedocTypeUsers/docTypeuserId
 type=stringsjauh...@innodata.com/userIdfirstName
 type=stringshruti/firstNamelastName
 type=stringjauhari/lastNameorgCode
 type=stringFORD-101/orgCodeorgName type=stringFord Motor
 Company/orgNamefilingContent
 type=stringAllowed/filingContentuserStatus
 type=stringActive/userStatustrialEndDate
 type=string2018-12-31/trialEndDaterole
 type=stringuser/roletelephoneNumber 
 type=string212-555-1212/telephoneNumbersalesTerritory
 type=stringNortheast/salesTerritorysendWelcomeEmail
 type=stringFalse/sendWelcomeEmaildefaultContentCollection
 type=stringdefault/defaultContentCollectionadditionalEmail
 type=stringskh...@innodata.com/additionalEmailpassword5f4dcc3b5aa765d61d8327deb882cf99/passwordpwpassword/pwcountOfLoggedIn11/countOfLoggedIncreated2015-04-22T15:37:32.151+05:30/createdcreatedByUSR-2fe944cc-013e-5b5a-0dba-7e98c3ffab00/createdBymodified2015-04-22T15:37:32.151+05:30/modifiedmodifiedByUSR-2fe944cc-013e-5b5a-0dba-7e98c3ffab00/modifiedBy/user-profile/map:value/map:entrymap:entry
 key=sessionmap:valuesession
 wk-pid=97f7d8ec0b5bba928cb025bd1d4d28d4|4/28/2015 9:57:24
 PMusernameUSR-59fb4f7d-de03-1e37-a23c-5c3d71552eaa/usernamecreated2015-04-28T17:57:24.34+05:30/createdexpiration2015-04-28T21:57:24.34+05:30/expirationcurrenttime2015-04-28T17:57:24.34+05:30/currenttimevalidfalse/valid/session/map:value/map:entry/map:map/map:value/map:entry/map:map)

 ML8 -
 ---
 Input and converted output is same. i.e. without map:

 {USERSESSION:a57e7e98cae8a7857285cd9a66de813f|4/28/2015 9:48:14
 PM:{user:user-profile
 wk-pid=\USR-b740cbc5-5e27-8b1c-d97a-1329625f6b39\docTypeUsers/docTypeusername
 type=\string\USR-b740cbc5-5e27-8b1c-d97a-1329625f6b39/usernameuserId
 type=\string\lrunne...@wk.com/userIdemail type=\string\
 lrunne...@wk.com/emailuserStatus
 type=\string\Active/userStatusdefaultContentCollectionALL/defaultContentCollectionrole
 type=\string\user/roletrialEndDate 

[MarkLogic Dev General] JSON sending in the request body is not being converted into map:map in ML8 using roxy however working fine with ML6

2015-04-28 Thread Indrajeet Verma
Hi,

Please help us if you have encountered same kind of problem.

We are upgrading ML6 to ML8 and using roxy as well. The roxy is customized
based on the customer requirement.


For one of the REST request /setcache, we are sending below data to cache
and that is being converted into map (key value pair)

ML6-

Request in Body-
---

{USERSESSION:a57e7e98cae8a7857285cd9a66de813f|4/28/2015 9:48:14
PM:{user:user-profile
wk-pid=\USR-b740cbc5-5e27-8b1c-d97a-1329625f6b39\docTypeUsers/docTypeusername
type=\string\USR-b740cbc5-5e27-8b1c-d97a-1329625f6b39/usernameuserId
type=\string\lrunne...@wk.com/userIdemail type=\string\
lrunne...@wk.com/emailuserStatus
type=\string\Active/userStatusdefaultContentCollectionALL/defaultContentCollectionrole
type=\string\user/roletrialEndDate type=\string\/activationDate
type=\string\2013-12-25/activationDatephoneNumber
type=\string\/sendWelcomeEmail type=\string\/additionalEmail
type=\string\/filingContent
type=\string\Allowed/filingContentfirstName
type=\string\John/firstNamelastName
type=\string\Doe/lastNameorgCode
type=\string\WK001/orgCodeorgName
type=\string\LoadRunner/orgNamesalesTerritory
type=\string\/password5f4dcc3b5aa765d61d8327deb882cf99/passwordpwpassword/pwcountOfLoggedIn11/countOfLoggedIncreated2014-07-11T11:05:11.589-05:00/createdcreatedBy
type=\string\System/createdBymodified2014-07-11T11:05:11.589-05:00/modifiedmodifiedBy
yun.y...@wolterskluwer.com/modifiedBy/user-profile,
session:session wk-pid=\a57e7e98cae8a7857285cd9a66de813f|4/28/2015
9:48:14
PM\usernameUSR-b740cbc5-5e27-8b1c-d97a-1329625f6b39/usernamecreated2015-04-28T17:48:14.661+05:30/createdexpiration2015-04-28T21:48:14.661+05:30/expirationcurrenttime2015-04-28T17:48:14.661+05:30/currenttimevalidfalse/valid/session}}

Converted into below map using ML6-
--

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=USERSESSION:97f7d8ec0b5bba928cb025bd1d4d28d4|4/28/2015 9:57:24
PMmap:valuemap:mapmap:entry key=usermap:valueuser-profile
wk-pid=USR-59fb4f7d-de03-1e37-a23c-5c3d71552eaausernameUSR-59fb4f7d-de03-1e37-a23c-5c3d71552eaa/usernamedocTypeUsers/docTypeuserId
type=stringsjauh...@innodata.com/userIdfirstName
type=stringshruti/firstNamelastName
type=stringjauhari/lastNameorgCode
type=stringFORD-101/orgCodeorgName type=stringFord Motor
Company/orgNamefilingContent
type=stringAllowed/filingContentuserStatus
type=stringActive/userStatustrialEndDate
type=string2018-12-31/trialEndDaterole
type=stringuser/roletelephoneNumber
type=string212-555-1212/telephoneNumbersalesTerritory
type=stringNortheast/salesTerritorysendWelcomeEmail
type=stringFalse/sendWelcomeEmaildefaultContentCollection
type=stringdefault/defaultContentCollectionadditionalEmail
type=stringskh...@innodata.com/additionalEmailpassword5f4dcc3b5aa765d61d8327deb882cf99/passwordpwpassword/pwcountOfLoggedIn11/countOfLoggedIncreated2015-04-22T15:37:32.151+05:30/createdcreatedByUSR-2fe944cc-013e-5b5a-0dba-7e98c3ffab00/createdBymodified2015-04-22T15:37:32.151+05:30/modifiedmodifiedByUSR-2fe944cc-013e-5b5a-0dba-7e98c3ffab00/modifiedBy/user-profile/map:value/map:entrymap:entry
key=sessionmap:valuesession
wk-pid=97f7d8ec0b5bba928cb025bd1d4d28d4|4/28/2015 9:57:24
PMusernameUSR-59fb4f7d-de03-1e37-a23c-5c3d71552eaa/usernamecreated2015-04-28T17:57:24.34+05:30/createdexpiration2015-04-28T21:57:24.34+05:30/expirationcurrenttime2015-04-28T17:57:24.34+05:30/currenttimevalidfalse/valid/session/map:value/map:entry/map:map/map:value/map:entry/map:map)

ML8 -
---
Input and converted output is same. i.e. without map:

{USERSESSION:a57e7e98cae8a7857285cd9a66de813f|4/28/2015 9:48:14
PM:{user:user-profile
wk-pid=\USR-b740cbc5-5e27-8b1c-d97a-1329625f6b39\docTypeUsers/docTypeusername
type=\string\USR-b740cbc5-5e27-8b1c-d97a-1329625f6b39/usernameuserId
type=\string\lrunne...@wk.com/userIdemail type=\string\
lrunne...@wk.com/emailuserStatus
type=\string\Active/userStatusdefaultContentCollectionALL/defaultContentCollectionrole
type=\string\user/roletrialEndDate type=\string\/activationDate
type=\string\2013-12-25/activationDatephoneNumber
type=\string\/sendWelcomeEmail type=\string\/additionalEmail
type=\string\/filingContent
type=\string\Allowed/filingContentfirstName
type=\string\John/firstNamelastName
type=\string\Doe/lastNameorgCode
type=\string\WK001/orgCodeorgName
type=\string\LoadRunner/orgNamesalesTerritory
type=\string\/password5f4dcc3b5aa765d61d8327deb882cf99/passwordpwpassword/pwcountOfLoggedIn11/countOfLoggedIncreated2014-07-11T11:05:11.589-05:00/createdcreatedBy
type=\string\System/createdBymodified2014-07-11T11:05:11.589-05:00/modifiedmodifiedBy
yun.y...@wolterskluwer.com/modifiedBy/user-profile,
session:session wk-pid=\a57e7e98cae8a7857285cd9a66de813f|4/28/2015
9:48:14

Re: [MarkLogic Dev General] JSON sending in the request body is not being converted into map:map in ML8 using roxy however working fine with ML6

2015-04-28 Thread David Lee
This is probably best addressed by filing an issue on the Roxy github issue 
tracker.

https://github.com/marklogic/roxy

Roxy is a community/developer supported product.

I suspect the issue is due to the (not backwards compatible, but documented) 
change to many JSON related API's in MarkLogic.

The JSON API's have been converted to work directly with the native JSON data 
types in ML8.

All of the internal MarkLogic libraries and apps have been updated as well to 
adjust to this change.   Exactly where in Roxy this is breaking I don't know, 
but the errors suggest is likely due to the ML8 changes in JSON.

Happy to help with any specific questions on the changes to ML APIs.

-David




-
David Lee
Lead Engineer
MarkLogic Corporation
d...@marklogic.com
Phone: +1 812-482-5224
Cell:  +1 812-630-7622
www.marklogic.comhttp://www.marklogic.com/

From: general-boun...@developer.marklogic.com 
[mailto:general-boun...@developer.marklogic.com] On Behalf Of Indrajeet Verma
Sent: Tuesday, April 28, 2015 10:15 AM
To: MarkLogic Developer Discussion
Subject: [MarkLogic Dev General] JSON sending in the request body is not being 
converted into map:map in ML8 using roxy however working fine with ML6

Hi,

Please help us if you have encountered same kind of problem.

We are upgrading ML6 to ML8 and using roxy as well. The roxy is customized 
based on the customer requirement.


For one of the REST request /setcache, we are sending below data to cache and 
that is being converted into map (key value pair)

ML6-

Request in Body-
---

{USERSESSION:a57e7e98cae8a7857285cd9a66de813f|4/28/2015 9:48:14 
PM:{user:user-profile 
wk-pid=\USR-b740cbc5-5e27-8b1c-d97a-1329625f6b39\docTypeUsers/docTypeusername
 type=\string\USR-b740cbc5-5e27-8b1c-d97a-1329625f6b39/usernameuserId 
type=\string\lrunne...@wk.commailto:lrunne...@wk.com/userIdemail 
type=\string\lrunne...@wk.commailto:lrunne...@wk.com/emailuserStatus 
type=\string\Active/userStatusdefaultContentCollectionALL/defaultContentCollectionrole
 type=\string\user/roletrialEndDate type=\string\/activationDate 
type=\string\2013-12-25/activationDatephoneNumber 
type=\string\/sendWelcomeEmail type=\string\/additionalEmail 
type=\string\/filingContent 
type=\string\Allowed/filingContentfirstName 
type=\string\John/firstNamelastName 
type=\string\Doe/lastNameorgCode type=\string\WK001/orgCodeorgName 
type=\string\LoadRunner/orgNamesalesTerritory 
type=\string\/password5f4dcc3b5aa765d61d8327deb882cf99/passwordpwpassword/pwcountOfLoggedIn11/countOfLoggedIncreated2014-07-11T11:05:11.589-05:00/createdcreatedBy
 
type=\string\System/createdBymodified2014-07-11T11:05:11.589-05:00/modifiedmodifiedByyun.y...@wolterskluwer.commailto:yun.y...@wolterskluwer.com/modifiedBy/user-profile,
 session:session wk-pid=\a57e7e98cae8a7857285cd9a66de813f|4/28/2015 
9:48:14 
PM\usernameUSR-b740cbc5-5e27-8b1c-d97a-1329625f6b39/usernamecreated2015-04-28T17:48:14.661+05:30/createdexpiration2015-04-28T21:48:14.661+05:30/expirationcurrenttime2015-04-28T17:48:14.661+05:30/currenttimevalidfalse/valid/session}}

Converted into below map using ML6-
--

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=USERSESSION:97f7d8ec0b5bba928cb025bd1d4d28d4|4/28/2015 9:57:24 
PMmap:valuemap:mapmap:entry key=usermap:valueuser-profile 
wk-pid=USR-59fb4f7d-de03-1e37-a23c-5c3d71552eaausernameUSR-59fb4f7d-de03-1e37-a23c-5c3d71552eaa/usernamedocTypeUsers/docTypeuserId
 
type=stringsjauh...@innodata.commailto:sjauh...@innodata.com/userIdfirstName
 type=stringshruti/firstNamelastName 
type=stringjauhari/lastNameorgCode 
type=stringFORD-101/orgCodeorgName type=stringFord Motor 
Company/orgNamefilingContent 
type=stringAllowed/filingContentuserStatus 
type=stringActive/userStatustrialEndDate 
type=string2018-12-31/trialEndDaterole 
type=stringuser/roletelephoneNumber 
type=string212-555-1212/telephoneNumbersalesTerritory 
type=stringNortheast/salesTerritorysendWelcomeEmail 
type=stringFalse/sendWelcomeEmaildefaultContentCollection 
type=stringdefault/defaultContentCollectionadditionalEmail 
type=stringskh...@innodata.commailto:skh...@innodata.com/additionalEmailpassword5f4dcc3b5aa765d61d8327deb882cf99/passwordpwpassword/pwcountOfLoggedIn11/countOfLoggedIncreated2015-04-22T15:37:32.151+05:30/createdcreatedByUSR-2fe944cc-013e-5b5a-0dba-7e98c3ffab00/createdBymodified2015-04-22T15:37:32.151+05:30/modifiedmodifiedByUSR-2fe944cc-013e-5b5a-0dba-7e98c3ffab00/modifiedBy/user-profile/map:value/map:entrymap:entry
 key=sessionmap:valuesession 
wk-pid=97f7d8ec0b5bba928cb025bd1d4d28d4|4/28/2015 9:57:24 

Re: [MarkLogic Dev General] JSON sending in the request body is not being converted into map:map in ML8 using roxy however working fine with ML6

2015-04-28 Thread Indrajeet Verma
Thank you David for your explanation. I also have same understanding
however not able to find exact method/module which is not converting into
map.

I identified router.xqy (line 67) and request.xqy where the conversion is
happening and setting map to the request.

Might be good to open a ticket in the github/roxy and see if I get some
resolution.

However I am attaching the router.xqy and request.xqy for your reference.
if possible please take a look and suggest some resolution.

Could you please help me to get the link of the APIs that have modified as
you said in your comments? OR Should we look into release notes?

Thank you for your time and help.

Regards,
Indrajeet

On Tue, Apr 28, 2015 at 8:16 PM, David Lee david@marklogic.com wrote:

  This is probably best addressed by filing an issue on the Roxy github
 issue tracker.



 https://github.com/marklogic/roxy



 Roxy is a community/developer supported product.



 I suspect the issue is due to the (not backwards compatible, but
 documented) change to many JSON related API's in MarkLogic.



 The JSON API's have been converted to work directly with the native JSON
 data types in ML8.



 All of the internal MarkLogic libraries and apps have been updated as well
 to adjust to this change.   Exactly where in Roxy this is breaking I don't
 know, but the errors suggest is likely due to the ML8 changes in JSON.



 Happy to help with any specific questions on the changes to ML APIs.



 -David










 -

 David Lee
 Lead Engineer
 *Mark**Logic* Corporation
 d...@marklogic.com
 Phone: +1 812-482-5224

 Cell:  +1 812-630-7622
 www.marklogic.com



 *From:* general-boun...@developer.marklogic.com [mailto:
 general-boun...@developer.marklogic.com] *On Behalf Of *Indrajeet Verma
 *Sent:* Tuesday, April 28, 2015 10:15 AM
 *To:* MarkLogic Developer Discussion
 *Subject:* [MarkLogic Dev General] JSON sending in the request body is
 not being converted into map:map in ML8 using roxy however working fine
 with ML6



 Hi,



 Please help us if you have encountered same kind of problem.



 We are upgrading ML6 to ML8 and using roxy as well. The roxy is customized
 based on the customer requirement.


 For one of the REST request /setcache, we are sending below data to
 cache and that is being converted into map (key value pair)

 ML6-

 Request in Body-
 ---

 {USERSESSION:a57e7e98cae8a7857285cd9a66de813f|4/28/2015 9:48:14
 PM:{user:user-profile
 wk-pid=\USR-b740cbc5-5e27-8b1c-d97a-1329625f6b39\docTypeUsers/docTypeusername
 type=\string\USR-b740cbc5-5e27-8b1c-d97a-1329625f6b39/usernameuserId
 type=\string\lrunne...@wk.com/userIdemail type=\string\
 lrunne...@wk.com/emailuserStatus
 type=\string\Active/userStatusdefaultContentCollectionALL/defaultContentCollectionrole
 type=\string\user/roletrialEndDate type=\string\/activationDate
 type=\string\2013-12-25/activationDatephoneNumber
 type=\string\/sendWelcomeEmail type=\string\/additionalEmail
 type=\string\/filingContent
 type=\string\Allowed/filingContentfirstName
 type=\string\John/firstNamelastName
 type=\string\Doe/lastNameorgCode
 type=\string\WK001/orgCodeorgName
 type=\string\LoadRunner/orgNamesalesTerritory
 type=\string\/password5f4dcc3b5aa765d61d8327deb882cf99/passwordpwpassword/pwcountOfLoggedIn11/countOfLoggedIncreated2014-07-11T11:05:11.589-05:00/createdcreatedBy
 type=\string\System/createdBymodified2014-07-11T11:05:11.589-05:00/modifiedmodifiedBy
 yun.y...@wolterskluwer.com/modifiedBy/user-profile,
 session:session wk-pid=\a57e7e98cae8a7857285cd9a66de813f|4/28/2015
 9:48:14
 PM\usernameUSR-b740cbc5-5e27-8b1c-d97a-1329625f6b39/usernamecreated2015-04-28T17:48:14.661+05:30/createdexpiration2015-04-28T21:48:14.661+05:30/expirationcurrenttime2015-04-28T17:48:14.661+05:30/currenttimevalidfalse/valid/session}}

 Converted into below map using ML6-
 --

 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=USERSESSION:97f7d8ec0b5bba928cb025bd1d4d28d4|4/28/2015 9:57:24
 PMmap:valuemap:mapmap:entry key=usermap:valueuser-profile
 wk-pid=USR-59fb4f7d-de03-1e37-a23c-5c3d71552eaausernameUSR-59fb4f7d-de03-1e37-a23c-5c3d71552eaa/usernamedocTypeUsers/docTypeuserId
 type=stringsjauh...@innodata.com/userIdfirstName
 type=stringshruti/firstNamelastName
 type=stringjauhari/lastNameorgCode
 type=stringFORD-101/orgCodeorgName type=stringFord Motor
 Company/orgNamefilingContent
 type=stringAllowed/filingContentuserStatus
 type=stringActive/userStatustrialEndDate
 type=string2018-12-31/trialEndDaterole
 type=stringuser/roletelephoneNumber 
 type=string212-555-1212/telephoneNumbersalesTerritory
 type=stringNortheast/salesTerritorysendWelcomeEmail
 type=stringFalse/sendWelcomeEmaildefaultContentCollection
 

Re: [MarkLogic Dev General] JSON sending in the request body is not being converted into map:map in ML8 using roxy however working fine with ML6

2015-04-28 Thread Christopher Hamlin
On Tue, Apr 28, 2015 at 11:42 AM, Indrajeet Verma
indrajeet.ve...@gmail.com wrote:
 ...

 Could you please help me to get the link of the APIs that have modified as
 you said in your comments? OR Should we look into release notes?



Since JSON is now native, there is much change in v8.  The relevant
section of the release notes has a lot of information:

https://docs.marklogic.com/guide/relnotes/chap4#id_92312

/ch
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general