Hi Selven,

You do not need to change your App Server to basic authentication to make this 
work.  You can specify digest auth in the authentication option to 
xdmp:http-get:

<options xmlns="xdmp:http">
       <authentication method="digest">
         <username>myname</username>
         <password>mypassword</password>
       </authentication>
     </options>

Remember, basic auth sends the password in the clear.  Digest encrypts the 
password.

-Danny

From: [email protected] 
[mailto:[email protected]] On Behalf Of Selven Xavier
Sent: Thursday, October 29, 2009 6:38 AM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] Reg: Usage of xdmp:http-get API

Hi Geert,
Thanks a lot!!!.

As suggested, we have used authentication credentials in options tag but we 
received following error:
[1.0-ml] XDMP-AUTHMISMATCH: xdmp:http-get("http://localhost:8000/Books.html";, 
<options xmlns="xdmp:http"><authentication 
method="basic"><username>Selven</username><password>Selven</password></authentication></options>)[2]
 -- Authorization mismatch: basic specified, server wants digest

After changing, authentication dropdown from "digest" to "basic" in created 
http DOCS server through Admin interface, we are able to get the content of the 
html file.

Thanks for you information!!!


Thanks & Regards,
Selven Xavier .A



On Thu, Oct 29, 2009 at 6:35 PM, Geert Josten 
<[email protected]<mailto:[email protected]>> wrote:
Hi Selven,

Sounds like your browser has cached authentication credentials to your 
localhost service. It is not easy to check this, so it might be easier to check 
the service running on 8000 itself. The response code clearly indicates 
authentication credentials are required. You can supply them to you http-get 
function call as options:

xdmp:http-get("http://www.my.com/document.xhtml";,
     <options xmlns="xdmp:http">
       <authentication method="basic">
         <username>myname</username>
         <password>mypassword</password>
       </authentication>
     </options>)
(First example taken from 
http://developer.marklogic.com/pubs/4.1/apidocs/Ext-2.html#xdmp:http-get)

Kind regards,
Geert



Drs. G.P.H. Josten
Consultant




Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665  JZ  Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
www.daidalos.nl<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]>
 
[mailto:[email protected]<mailto:[email protected]>]
 On Behalf Of Selven Xavier
Sent: donderdag 29 oktober 2009 13:54
To: [email protected]<mailto:[email protected]>
Subject: [MarkLogic Dev General] Reg: Usage of xdmp:http-get API
Hi Team,
I have created a Book.html file under Docs folder with the content as shown 
below

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from 
url=(0062)http://developer.marklogic.com/columns/smallchanges/Books.html -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="MSHTML 6.00.6000.16915" name=GENERATOR></HEAD>
<BODY>Some Content ....
<H4>Favorite Books:</H4>
<table border=1>
  <TBODY>
  <TR>
    <TH>Title</TH>
    <TH>Author</TH>
    <TH>ISBN-13</TH></TR>
  <TR>
    <TD>Java Servlet Programming</TD>
    <TD>Jason Hunter</TD>
    <TD>978-0596000400</TD></TR>
  <TR>
    <TD>Querying XML</TD>
    <TD>Stephen Buxton and Jim Melton</TD>
    <TD>978-1558607118</TD>
  <TR>
    <TD>Java NIO</TD>
    <TD>Ron Hitchens</TD>
    <TD>978-0596002886</TD></TR>
  <TR>
    <TD>Speech and Language Processing</TD>
    <TD>Daniel Jurafsky and James H. Martin </TD>
    <TD>978-0130950697</TD></TR></TBODY></table></BODY></HTML>

When we query through web-browser http://localhost:8000/Books.html we are able 
to see the table containing content. But when we call the same URL using the 
xdmp:http-get API, we are getting 401 Unauthorized error.

xquery version "1.0-ml";
 let $page :=          xdmp:tidy(
       xdmp:http-get("http://localhost:8000/Books.html";)[2])[2]
return $page

Please help us to solve the above problem?

Regards,
Selven Xavier .A



_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://xqzone.com/mailman/listinfo/general

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

Reply via email to