Hi,
I need to pick the all the docs in directory path ($Path) from Ingestion DB and
insert them in Db which is configured for rest services(rest-ingestion).
The below code works fine from Qconsole, but from Rest service , the xml being
picked from the Ingestion DB is not coming as xml when the code is hit from
Rest service. In logs, only content is theres, xml elements are
missing.(attached are the logs)
Please let me know, what I am missing in this code.
Thanks
Pragya
Code:
import module namespace dls = "http://marklogic.com/xdmp/dls"
at "/MarkLogic/dls.xqy";
import module namespace functx = "http://www.functx.com"
at "/MarkLogic/functx/functx-1.0-nodoc-2007-01.xqy";
let $transId := '39932186-9cab-44e9-8f4f-7ebf45dabf8f'
let $PrefixURI := "/docs/"
let $Path := fn:concat('/processing/', $transId,'/validDocs/')
let $DirectoryListing :=
xdmp:eval('
import module namespace functx =
"http://www.functx.com"
at
"/MarkLogic/functx/functx-1.0-nodoc-2007-01.xqy";
declare variable $Path as xs:string external;
xdmp:directory($Path)
'
,
(xs:QName("Path"), $Path)
,
<options xmlns="xdmp:eval">
<database>{xdmp:database("Ingestion")}</database>
</options>
)
for $FileEntry in $DirectoryListing
let $Filename :=
functx:substring-after-last(xdmp:node-uri($FileEntry),'/')
let $docUri := fn:concat($PrefixURI, $Filename)
let $_ := xdmp:log(fn:concat("uri",$docUri))
let $contents := $FileEntry
return
(: Insert the document :)
(dls:document-insert-and-manage(
$docUri,
fn:false(),
$contents,
"created",
(xdmp:permission("dls-user", "read"),
xdmp:permission("dls-user", "update")),
"historic"),
xdmp:document-add-collections(
$docUri,
"latest"),
xdmp:document-remove-collections(
$docUri, "historic")
)
"This e-mail and any attachments transmitted with it are for the sole use of
the intended recipient(s) and may contain confidential , proprietary or
privileged information. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original message. Any
unauthorized review, use, disclosure, dissemination, forwarding, printing or
copying of this e-mail or any action taken in reliance on this e-mail is
strictly prohibited and may be unlawful."
2014-10-15 13:09:34.506 Info: rest-ingestion: 4076
2014-10-15 13:09:34.506 Info: rest-ingestion: REPO-GMR-2000
2014-10-15 13:09:34.506 Info: rest-ingestion: 2010-09-22
2014-10-15 13:09:34.506 Info: rest-ingestion: BAU
2014-10-15 13:09:34.506 Info: rest-ingestion: 1-44
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion: Euro
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion: Same daySame day
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion: Yes
2014-10-15 13:09:34.506 Info: rest-ingestion: STAR FINANCIAL
SERVICES LTD.
2014-10-15 13:09:34.506 Info: rest-ingestion: New York
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion: No
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion: Failure to
Deliver Securities
2014-10-15 13:09:34.506 Info: rest-ingestion: Standard
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion: Not applicable
2014-10-15 13:09:34.506 Info: rest-ingestion: Not applicable
2014-10-15 13:09:34.506 Info: rest-ingestion: Not applicable
2014-10-15 13:09:34.506 Info: rest-ingestion: Standard
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion: MAKEMAKE
BANK, N.A.
2014-10-15 13:09:34.506 Info: rest-ingestion: Active
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion: ABC INC.
2014-10-15 13:09:34.506 Info: rest-ingestion: Active
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion: England and Wales
2014-10-15 13:09:34.506 Info: rest-ingestion:
2014-10-15 13:09:34.506 Info: rest-ingestion:
REPO-GMR-20002010-09-234076
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general