Hi Geert,
Yes, the error response message gets inserted instead of the document. I'll try to come up with an example for you. ~Tim -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Geert Josten Sent: Saturday, May 15, 2010 3:52 AM To: General Mark Logic Developer Discussion Subject: Re: [MarkLogic Dev General] Is there a simple way to retrievethehttp response statuses when invoking xdmp:document-load? Hi Tim, Have you tried to see what happens when the url you pass in to document-load returns an error status? I wouldn't be surprised if the load function throws an error or doesn't insert anything at all.. Kind regards, Geert > drs. G.P.H. (Geert) Josten Consultant Daidalos BV Hoekeindsehof 1-4 2665 JZ Bleiswijk T +31 (0)10 850 1200 F +31 (0)10 850 1199 mailto:[email protected] http://www.daidalos.nl/ KvK 27164984 P Please consider the environment before printing this mail. De informatie - verzonden in of met dit e-mailbericht - 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 > Tim Meagher > Sent: vrijdag 14 mei 2010 19:38 > To: 'General Mark Logic Developer Discussion' > Subject: Re: [MarkLogic Dev General] Is there a simple way to > retrieve thehttp response statuses when invoking xdmp:document-load? > > Oh just one more thing. I think that without the response > status there is an inherent risk in using > xdmp:document-load(). The loaded document can end up being > merely an invalid response message, in which case clean up > needs to be performed in the destination. Perhaps supplying > acceptable response codes as part of the options to > xdmp:document-load() would be more suitable, such that if the > response does not match those provided an error is thrown and > the document is not loaded. Nobody guarantees SLAs with 100% > uptime. So even with an SLA of 99.99%, that means 1 out of > 10,000 documents would be suspect. > > > > Respectfully, > > > > ~Tim > > > > ________________________________ > > From: [email protected] > [mailto:[email protected]] On Behalf Of > Tim Meagher > Sent: Friday, May 14, 2010 1:19 PM > To: 'General Mark Logic Developer Discussion' > Subject: Re: [MarkLogic Dev General] Is there a simple way to > retrieve thehttp response statuses when invoking xdmp:document-load? > > > > Hi Michael, > > > > If I use a combination of an xdmp:http-get() and > xdmp:document-insert(), isn't there a penalty for having to > obtain the document before loading it or does > xdmp:document-load() pretty much do the same thing as the > combination of xdmp:http-get() and xdmp:document-insert() > (any buffering included)? > > > > I suspect that calling xdmp:http-get() and > xdmp:document-insert() from within an xquery module running > in MarkLogic might take advantage of some optimizations in > the MarkLogic database. Currently I have an .Net application > with a .Net library that wraps xdmp:document-load in an HTTP > Get invocation. I mapped the location of the source document > to a virtual web address. Using this approach avoids > buffering the source document locally before inserting it and > prevents me from having to include and keep the XCC libraries > current with the latest MarkLogic releases. > > > > It looks like there are a variety of methods available to > accomplish my objective, but I would still like to submit a > request to the new feature queue to obtain the http response > status code xdmp:document-load(). > > > > Thank you! > > > > ~Tim > > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of > Michael Blakeley > Sent: Friday, May 14, 2010 11:23 AM > To: General Mark Logic Developer Discussion > Subject: Re: [MarkLogic Dev General] Is there a simple way to > retrieve http response statuses wen invoking xdmp:document-load? > > > > Note that xdmp:http-get() supports repair options too - but > they have to > > be specified in the right namespace. > > > > http://developer.marklogic.com/pubs/4.1/apidocs/Ext-2.html#xdm > p:http-get > > > > > > This parameter can also include certain option elements > (for example, > > > repair, encoding, default-language) in the xdmp:document-load and > > > xdmp:document-get namespaces. > > > > xdmp:http-get( > > 'http://google.com/DNE', > > <options xmlns="xdmp:http-get"> > > <format xmlns="xdmp:document-get">xml</format> > > <repair xmlns="xdmp:document-get">full</repair> > > </options>) > > > > You can also use xdmp:tidy() on the response. That technique can > > sometimes fix up html that is too far gone for repair=full to handle. > > You might even decide which options to use on a case-by-case basis. > > > > -- Mike > > > > On 2010-05-14 08:12, Mark Helmstetter wrote: > > > You could use xdmp:http-get() to fetch the document (which > will give you an http status code), use xdmp:unquote() to > convert to xml (you can specify repair options here), then > call xdmp:document-insert(). > > > > > > From: [email protected] > > [mailto:[email protected]] On Behalf Of Tim > > Meagher > > > Sent: Friday, May 14, 2010 10:35 AM > > > To: 'General Mark Logic Developer Discussion' > > > Subject: [MarkLogic Dev General] Is there a simple way to > retrieve http response statuses wen invoking xdmp:document-load? > > > > > > > > > xdmp:document-load() is a very powerful function for > copying documents and is superior to xdmp:document-insert() because: > > > > > > > > > > > > 1. It allows for document repair, and > > > > > > 2. You can copy a document without having to buffer it and > then insert it. > > > > > > > > > > > > However, as far as I can tell there is no simple way to > determine the success of the document retrieval by checking > the http response status code without looking at the contents > of the inserted document. Is that right? Is there some kind > of debug status that can be enabled for document loads to > determine the success of the http response code? If not, may > I suggest that a simple mechanism be made available for doing so? > > > > > > > > > > > > It would be nice to know if the http source server is > working properly, whether it is up or overloaded or whether > the user is just pinging the wrong document URI. > > > > > > > > > > > > Thank you! > > > > > > > > > > > > Tim Meagher > > > > > > > > > > > > > _______________________________________________ > > General mailing list > > [email protected] > > http://developer.marklogic.com/mailman/listinfo/general > > _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
