Hi David,

For a 500 error you should get a little more detail in the server logs, but one thing you mention is indeed wrong -- you need to return a document-node from the transform.

It should be possible to wrap the binary output you want into a document node though.

Charles


constructor
On 04/04/2013 07:32 AM, Steiner, David J. (LNG-DAY) wrote:
Trying to do the following:
curl --anyauth --user id:pass -X PUT -d@"./createPDF.xqy" -H "Content-type: 
application/xquery" 'http://ilabsmltest:8011/v1/config/transforms/createPDF'

And getting the error:
<rapi:error xmlns:rapi="http://marklogic.com/rest-api";>
<rapi:status-code>500</rapi:status-code>
<rapi:status>INTERNAL ERROR</rapi:status>
<rapi:message-code/>
<rapi:message>500 Internal Server Error internal error</rapi:message>
</rapi:error>

The following works from QConsole:
xquery version "1.0-ml";
import module namespace jam = "http://xqdev.com/jam"; at "jam.xqy";
import module namespace jamu = "http://xqdev.com/jam-utils"; at "jam-utils.xqy";

let $xslfoDoc :=  [xsl-fo deleted]
return
(jam:start("http://ilabsmltest:8080/mljam/mljam";, "mljam", "secret"),
jamu:fop($xslfoDoc),
jam:end())

So, I'm trying to make a XQuery transformation module out of it :
xquery version "1.0-ml";

module namespace cpdf = "http://marklogic.com/rest-api/transform/createPDF";;

import module namespace jam = "http://xqdev.com/jam"; at "jam.xqy";
import module namespace jamu = "http://xqdev.com/jam-utils"; at "jam-utils.xqy";

declare function cpdf:transform(
   $context as map:map,
   $params as map:map,
   $content as document-node()
) as binary()
{
   if (fn:empty($content/*)) then $content
   else
(jam:start("http://ilabsmltest:8080/mljam/mljam";, "mljam", "secret"),
jamu:fop($content),
jam:end())
};


I'm assuming that there's just something wrong with the imports... and/or 
namespacing...
And not that I can't return a binary() instead of a document-node().


Thanks,
David




_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

--
Charles Greer
Senior Engineer
MarkLogic Corporation
[email protected]
Phone: +1 707 408 3277
www.marklogic.com

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to