Your code sample won't evaluate. The FLWOR lacks a return, which is required. 
Then the function declaration follows the body, which isn't allowed. Then the 
code declares local:http-get-proxy, but calls the undefined function 
xdmp:http-get-proxy.

Try the code at http://stackoverflow.com/a/26966474/908390 instead. That works 
for me with 7.0-4. I see "Documents found:   248407" in the result.

-- Mike

> On 12 Jan 2015, at 23:37 , Lee Li Bin <[email protected]> wrote:
> 
> Hi All,
>  
> I’ve use the following code for proxy server:
>  
> let $proxy := "http://172.21.10.60:3128"; (: simple http proxy :)
> let $uri := 
> "http://www.austlii.edu.au/cgi-bin/sinosrch.cgi?results=200;query=damage";(: 
> target web service :)
>  
> xdmp:http-get-proxy($proxy, $uri)
>  
> declare function local:http-get-proxy($proxy, $uri){
>   let $host := fn:tokenize($uri,'/')[3]
>   let $proxyuri := fn:concat($proxy,"?",$uri)
>   return xdmp:http-get($proxyuri,
>     <options xmlns="xdmp:http"> 
>       <headers> 
>         <host>{$host}</host>
>       </headers>
>     </options>)
> };
>  
>  
> but having bad request as the request URL is 
>  
> 172.21.11.61 NONE/400 3447 GET 
> /http://www.austlii.edu.au/cgi-bin/sinosrch.cgi?results=200;query=hello - 
> NONE/- text/html
>  
> Have an extra forward slash in front of the URL. Tested the xquery and look 
> at the proxy server, it seem that the extra slash is coming directly from 
> Marklogic.
> The current installed Marklogic is 7.0—2.3
>  
> Anyone able to help?
>  
>  
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general

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

Reply via email to