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\"><docType>Users</docType><username
> type=\"string\">USR-b740cbc5-5e27-8b1c-d97a-1329625f6b39</username><userId
> type=\"string\">lrunne...@wk.com</userId><email type=\"string\">
> lrunne...@wk.com</email><userStatus
> type=\"string\">Active</userStatus><defaultContentCollection>ALL</defaultContentCollection><role
> type=\"string\">user</role><trialEndDate type=\"string\"/><activationDate
> type=\"string\">2013-12-25</activationDate><phoneNumber
> type=\"string\"/><sendWelcomeEmail type=\"string\"/><additionalEmail
> type=\"string\"/><filingContent
> type=\"string\">Allowed</filingContent><firstName
> type=\"string\">John</firstName><lastName
> type=\"string\">Doe</lastName><orgCode
> type=\"string\">WK001</orgCode><orgName
> type=\"string\">LoadRunner</orgName><salesTerritory
> type=\"string\"/><password>5f4dcc3b5aa765d61d8327deb882cf99</password><pw>password</pw><countOfLoggedIn>11</countOfLoggedIn><created>2014-07-11T11:05:11.589-05:00</created><createdBy
> type=\"string\">System</createdBy><modified>2014-07-11T11:05:11.589-05:00</modified><modifiedBy>
> yun.y...@wolterskluwer.com</modifiedBy></user-profile>",
> "session":"<session wk-pid=\"a57e7e98cae8a7857285cd9a66de813f|4/28/2015
> 9:48:14
> PM\"><username>USR-b740cbc5-5e27-8b1c-d97a-1329625f6b39</username><created>2015-04-28T17:48:14.661+05:30</created><expiration>2015-04-28T21:48:14.661+05:30</expiration><currenttime>2015-04-28T17:48:14.661+05:30</currenttime><valid>false</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
> PM"><map:value><map:map><map:entry key="user"><map:value><user-profile
> wk-pid="USR-59fb4f7d-de03-1e37-a23c-5c3d71552eaa"><username>USR-59fb4f7d-de03-1e37-a23c-5c3d71552eaa</username><docType>Users</docType><userId
> type="string">sjauh...@innodata.com</userId><firstName
> type="string">shruti</firstName><lastName
> type="string">jauhari</lastName><orgCode
> type="string">FORD-101</orgCode><orgName type="string">Ford Motor
> Company</orgName><filingContent
> type="string">Allowed</filingContent><userStatus
> type="string">Active</userStatus><trialEndDate
> type="string">2018-12-31</trialEndDate><role
> type="string">user</role><telephoneNumber 
> type="string">212-555-1212</telephoneNumber><salesTerritory
> type="string">Northeast</salesTerritory><sendWelcomeEmail
> type="string">False</sendWelcomeEmail><defaultContentCollection
> type="string">default</defaultContentCollection><additionalEmail
> type="string">skh...@innodata.com</additionalEmail><password>5f4dcc3b5aa765d61d8327deb882cf99</password><pw>password</pw><countOfLoggedIn>11</countOfLoggedIn><created>2015-04-22T15:37:32.151+05:30</created><createdBy>USR-2fe944cc-013e-5b5a-0dba-7e98c3ffab00</createdBy><modified>2015-04-22T15:37:32.151+05:30</modified><modifiedBy>USR-2fe944cc-013e-5b5a-0dba-7e98c3ffab00</modifiedBy></user-profile></map:value></map:entry><map:entry
> key="session"><map:value><session
> wk-pid="97f7d8ec0b5bba928cb025bd1d4d28d4|4/28/2015 9:57:24
> PM"><username>USR-59fb4f7d-de03-1e37-a23c-5c3d71552eaa</username><created>2015-04-28T17:57:24.34+05:30</created><expiration>2015-04-28T21:57:24.34+05:30</expiration><currenttime>2015-04-28T17:57:24.34+05:30</currenttime><valid>false</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\"><docType>Users</docType><username
> type=\"string\">USR-b740cbc5-5e27-8b1c-d97a-1329625f6b39</username><userId
> type=\"string\">lrunne...@wk.com</userId><email type=\"string\">
> lrunne...@wk.com</email><userStatus
> type=\"string\">Active</userStatus><defaultContentCollection>ALL</defaultContentCollection><role
> type=\"string\">user</role><trialEndDate type=\"string\"/><activationDate
> type=\"string\">2013-12-25</activationDate><phoneNumber
> type=\"string\"/><sendWelcomeEmail type=\"string\"/><additionalEmail
> type=\"string\"/><filingContent
> type=\"string\">Allowed</filingContent><firstName
> type=\"string\">John</firstName><lastName
> type=\"string\">Doe</lastName><orgCode
> type=\"string\">WK001</orgCode><orgName
> type=\"string\">LoadRunner</orgName><salesTerritory
> type=\"string\"/><password>5f4dcc3b5aa765d61d8327deb882cf99</password><pw>password</pw><countOfLoggedIn>11</countOfLoggedIn><created>2014-07-11T11:05:11.589-05:00</created><createdBy
> type=\"string\">System</createdBy><modified>2014-07-11T11:05:11.589-05:00</modified><modifiedBy>
> yun.y...@wolterskluwer.com</modifiedBy></user-profile>",
> "session":"<session wk-pid=\"a57e7e98cae8a7857285cd9a66de813f|4/28/2015
> 9:48:14
> PM\"><username>USR-b740cbc5-5e27-8b1c-d97a-1329625f6b39</username><created>2015-04-28T17:48:14.661+05:30</created><expiration>2015-04-28T21:48:14.661+05:30</expiration><currenttime>2015-04-28T17:48:14.661+05:30</currenttime><valid>false</valid></session>"}}
>
> I suspect roxy router.xqy and request.xqy are creating some issues however
> not able to identify the issue yet.
>
> Please suggest the fix for the same.
>
> Other errors in Errorlog.txt-
> -------------------------------------
>
> 2015-04-28 17:11:18.302 Notice: FilingsTool: Expecting map
> (INVALID-PARAMS):
> 2015-04-28 17:11:18.302 Notice: FilingsTool: in
> /app/controllers/setcache.xqy, at 29:22,
> 2015-04-28 17:11:18.302 Notice: FilingsTool: in xdmp:function(fn:QName("
> http://marklogic.com/roxy/controller/setcache","main";),
> "/app/controllers/setcache.xqy")() [1.0-ml]
> 2015-04-28 17:11:18.302 Notice: FilingsTool: $params =
> document{text{"{"USERSESSION:3aa2eb094d15d973e355d54812cf5720|4/28/2015
> 8:..."}}
> 2015-04-28 17:11:18.302 Notice: FilingsTool: $e = <error:error
> xsi:schemaLocation="http://marklogic.com/xdmp/error error.xsd" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"; xmlns:error="
> http://marklogic.com/xdmp/error
> "><error:code>XDMP-UNEXPECTED</error:code><error:name>err:XPST0003...</error:error>
> 2015-04-28 17:11:18.302 Notice: FilingsTool: in /app/lib/router.xqy, at
> 97:16,
> 2015-04-28 17:11:18.302 Notice: FilingsTool: in router:route() [1.0-ml]
> 2015-04-28 17:11:18.302 Notice: FilingsTool: $x = ()
> 2015-04-28 17:11:18.302 Notice: FilingsTool: $valid-request = fn:true()
> 2015-04-28 17:11:18.302 Notice: FilingsTool: in /app/restful-router.xqy,
> at 20:0 [1.0-ml]
>
> Regards,
> Indrajeet
>
> _______________________________________________
> General mailing list
> General@developer.marklogic.com
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
>
_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to