I think you best reach out to the IT department to ask which proxy product they 
are using, and how to use it. It kind of depends on the specific proxy what 
approach to use..

Cheers

From: 
<[email protected]<mailto:[email protected]>>
 on behalf of Gary Russo <[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Monday, August 24, 2015 at 4:47 PM
To: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: [MarkLogic Dev General] How to do an http get using an http proxy?

The on-line docs have an example on how to use an http proxy with the http-get. 
=> http://docs.marklogic.com/xdmp:http-get

Unfortunately, this example does not work for me.

I see that others are having similar issues based on the discussion posted 
here. => http://markmail.org/message/sbfj44jtmpsyopyh

This is my XQuery Code Snippet.  Am I missing something?


let $proxy := "http://webproxy.h.corp.services:80";
let $uri   := "http://dbpedia.org/sparql";

let $host      := fn:tokenize($uri,'/')[3]
let $proxyuri  := fn:resolve-uri(substring-after($uri, $host), $proxy)

return
(
  "$uri:       "||$uri,
  "$host:      "||$host,
  "$proxyuri:  "||$proxyuri,
  xdmp:http-get(
    $proxyuri,
    <options xmlns="xdmp:http">
     <headers>
       <host>{$host}</host>
     </headers>
    </options>
  )
)


This is the response:

$uri:       http://dbpedia.org/sparql
$host:      dbpedia.org
$proxyuri:  http://webproxy.h.corp.services:80/sparql


<response xmlns="xdmp:http">
  <code>400</code>
  <message>Bad Request</message>
  <headers>
    <server>squid/3.1.10</server>
    <mime-version>1.0</mime-version>
    <date>Wed, 19 Aug 2015 20:42:28 GMT</date>
    <content-type>text/html</content-type>
    <content-length>1642</content-length>
    <x-squid-error>ERR_INVALID_URL 0</x-squid-error>
    <x-cache>MISS from cawston.int.westgroup.com</x-cache>
    <via>1.0 cawston.int.westgroup.com (squid/3.1.10)</via>
    <connection>close</connection>
  </headers>
</response>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd";>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <title>ERROR: The requested URL could not be retrieved</title>
      <style type="text/css">
        <!--     body :lang(fa) { direction: rtl; font-size: 100%; font-family: 
Tahoma, Roya, sans-serif; float: right; } :lang(he) { direction: rtl; float: 
right; }  -->
      </style>
  </head>
  <body>
    <div id="titles">
      <h1>ERROR</h1>
      <h2>The requested URL could not be retrieved</h2>
    </div>
    <hr>
      <div id="content">
        <p>The following error was encountered while trying to retrieve the 
URL: <a href="/sparql">/sparql</a></p>
        <blockquote id="error"><p><b>Invalid URL</b></p></blockquote>
        <p>Some aspect of the requested URL is incorrect.</p>
        <p>Some possible problems are:</p><ul>
          <li><p>Missing or incorrect access protocol (should be 
<q>http://</q<http://%3c/q>> or similar)</p></li>
          <li><p>Missing hostname</p></li>
          <li><p>Illegal double-escape in the URL-Path</p></li>
          <li><p>Illegal character in hostname; underscores are not 
allowed.</p></li>
        </ul>
      <p>Your cache administrator is <a 
href="mailto:webmaster?subject=CacheErrorInfo%20-%20ERR_INVALID_URL&amp;body=CacheHost%3A%20cawston.int.westgroup.com%0D%0AErrPage%3A%20ERR_INVALID_URL%0D%0AErr%3A%20%5Bnone%5D%0D%0ATimeStamp%3A%20Wed,%2019%20Aug%202015%2020%3A42%3A28%20GMT%0D%0A%0D%0AClientIP%3A%2010.206.77.107%0D%0A%0D%0AHTTP%20Request%3A%0D%0A%0D%0A%0D%0A";>webmaster</a>.</p>
      <br>
    </div>
    <hr>
    <div id="footer">
      <p>Generated Wed, 19 Aug 2015 20:42:28 GMT by cawston.int.westgroup.com 
(squid/3.1.10)</p>
      <!-- ERR_INVALID_URL -->
    </div>
  </body>
</html>




Gary Russo
Enterprise NoSQL Architect
http://garyrusso.wordpress.com<http://garyrusso.wordpress.com/>
http://twitter.com/garyprusso



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

Reply via email to