Hi Taras,
I think you need to make sure whether it is the call with xdmp:http-delete()
that is causing the problem, or that it is a syntax problem in the xquery that
does the call. Try putting a try-catch clause around the xdmp:http-delete,
something like:
try {
xdmp:http-delete(...)
} catch ($e) {
$e
}
If the outcome doesn't change with this try-catch then your problem is not
caused by the call with xdmp:http-delete..
Just to clarify, the http-delete call does indeed only send a request to a http
server, sending along any information you supply, like for instance the request
parameter 'uri' you added to the url. Inside the xquery you are calling on the
localhost, you will have to capture the details from that request and find out
how the request wants you to act and respond. Use the xdmp:get-request-method()
to determine whether someone sent a DELETE request.
If you want your xquery to act by deleting the document identified by the uri
parameter, you probably want to do something like:
xdmp:document-delete(xdmp:get-request-field('uri'))
Also note that it is safer to apply the fn:encode-for-uri function on the
document uri before sending it along with the HTTP request. It gets decoded
automatically by the MarkLogic HTTP server.
Kind regards,
Geert
PS: I assume you have good reason to send a http request for deleting a
document from the database, instead of just calling xdmp:delete-document
directly..
>
Drs. G.P.H. Josten
Consultant
http://www.daidalos.nl/
Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665 JZ Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
http://www.daidalos.nl/
KvK 27164984
De informatie - verzonden in of met dit emailbericht - is afkomstig van
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit
bericht kunnen geen rechten worden ontleend.
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Bondarenko, Taras
> Sent: donderdag 5 maart 2009 20:43
> To: General Mark Logic Developer Discussion
> Subject: RE: [MarkLogic Dev General] Troubleshoot xdmp:http-delete()
>
> Sorry, it is. I quickly replaced the names of the variables
> when typing this email. The code indeed is:
>
> declare function plp:delete ($uri-of-document-in-database as
> xs:string){
>
> xdmp:http-delete(fn:concat("http://localhost:8008/test-http-fu
> nctions.xq
> y?uri=",$ uri-of-document-in-database))
> };
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Eric Palmitesta
> Sent: Thursday, March 05, 2009 2:37 PM
> To: General Mark Logic Developer Discussion
> Subject: Re: [MarkLogic Dev General] Troubleshoot xdmp:http-delete()
>
> $uri-of-document-in database as xs:string
>
> should probably be
>
> $uri-of-document-in-database as xs:string
>
> Eric
>
> Bondarenko, Taras wrote:
> > Greetings.
> >
> >
> >
> > I'm finding that xqzone documentation of MLS is very light and on a
> > surface, makes it really hard to understand what is going on.
> >
> >
> >
> > The problem:
> >
> >
> >
> > Have a function defined in library module (even though I'm
> not calling
>
> > it at time of the request)
> >
> >
> >
> > declare function plp:delete ($uri-of-document-in database as
> xs:string){
> >
> >
> >
> xdmp:http-delete(fn:concat("http://localhost:8008/test-http-fu
> nctions.xq
> y?uri=",$uri))
> >
> > };
> >
> >
> >
> > Getting error:
> >
> >
> > *500 Internal Server Error*
> >
> > XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error,
> > unexpected StringLiteral_, expecting Comma_ or Rpar_
> >
> > in /test-harness.xqy, on line NN [1.0-ml]
> >
> >
> >
> >
> >
> > Documentation is extremely misleading:
> >
> >
> >
> > "...Parameters: $uri : The URI of the document to
> delete..." - quite a
>
> > clear description! And then a bit later: "Note the xdmp:http-delete
> > function simply sends a DELETE request to the specified web
> server;...".
> > If there is a definition of conundrum, this is it!
> >
> >
> >
> > Any suggestions?
> >
> >
> >
> > Thank you
> >
> >
> --------------------------------------------------------------
> ----------
> >
> > The information contained in this message is intended only for the
> > recipient, and may be a confidential attorney-client
> communication or
> > may otherwise be privileged and confidential and protected from
> > disclosure. If the reader of this message is not the intended
> recipient,
> > or an employee or agent responsible for delivering this
> message to the
>
> > intended recipient, please be aware that any dissemination
> or copying
> of
> > this communication is strictly prohibited. If you have
> received this
> > communication in error, please immediately notify us by replying to
> the
> > message and deleting it from your computer. The McGraw-Hill
> Companies,
> > Inc. reserves the right, subject to applicable local law, to monitor
> and
> > review the content of any electronic message or information
> sent to or
>
> > from McGraw-Hill employee e-mail addresses without informing the
> sender
> > or recipient of the message.
> >
> >
> --------------------------------------------------------------
> ----------
> >
> >
> >
> --------------------------------------------------------------
> ----------
> >
> > _______________________________________________
> > General mailing list
> > [email protected]
> > http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general