If that helps, a perusal of URL escaping shows that the easiest
Way to get your URL paths perfect and more readable and compost lee is to do it 
I'm two steps.  Gather all URL query pairs In a map and URL encode each , join 
by =
The. Join all pairs by & ( careful, & == &amp, in literal XQuery ,
And append the URL encoded path with ? || query

May seem overkill  at first but put into a function and life is good
Your code will work.no<http://work.no> matter what you throw at it, and it can 
read well.
New XQuery 3.0 syntax can make it shine ,

  ( "key","value") => map;put( $args),
...




Sent from my iPad
David A Lee
d...@marklogic.com<mailto:d...@marklogic.com>


On Feb 9, 2016, at 12:24 AM, Ryan Dew 
<ryan.j....@gmail.com<mailto:ryan.j....@gmail.com>> wrote:

Browsers are often smart enough to encode spaces for you. What if you try the 
following? Hopefully it gives you what you are looking for.

let $geturl := 
"http://api.academicbenchmarks.com/rest/v3/standards&amp;partner.id=devconnect04&amp;auth.signature=Tp1akyZwnn4hNcS91LQH1Rq7os9L4vGtxNHIz3GWT0s=&amp;auth.expires=1454652779865&amp;list=state,document,subject_doc&amp;state=in&amp;subject=math&amp;document.title=<http://api.academicbenchmarks.com/rest/v3/standards&amp;partner.id=devconnect04&amp;auth.signature=Tp1akyZwnn4hNcS91LQH1Rq7os9L4vGtxNHIz3GWT0s=&amp;auth.expires=1454652779865&amp;list=state,document,subject_doc&amp;state=in&amp;subject=math&amp;document.title=Academic%20Standards>"
 || xdmp:url-encode("Academic Standards")

let $result :=
    xdmp:http-get($geturl,
    <options xmlns="xdmp:http">
       <timeout>60</timeout>
     </options>
      )
  return  $result

-Ryan Dew

On Mon, Feb 8, 2016 at 10:16 PM, 
<thangella.vinodre...@cognizant.com<mailto:thangella.vinodre...@cognizant.com>> 
wrote:
Hi Team,

Can anyone help on this. I am trying to send a get request using 
xdmp:http-get() and receiving below socket receive exception . I increased time 
out in the options as well.

[1.0-ml] SVC-SOCRECV: 
xdmp:http-get("http://api.academicbenchmarks.com/rest/v3/standards&amp;partner....";,
 <options xmlns="xdmp:http"><timeout>60</timeout></options>) -- Socket receive 
error: wait: Timeout (decodeResponseLine1)


My code is

xquery version "1.0-ml";

let $geturl := 
"http://api.academicbenchmarks.com/rest/v3/standards&amp;partner.id=devconnect04&amp;auth.signature=Tp1akyZwnn4hNcS91LQH1Rq7os9L4vGtxNHIz3GWT0s=&amp;auth.expires=1454652779865&amp;list=state,document,subject_doc&amp;state=in&amp;subject=math&amp;document.title=Academic
 
Standards<http://api.academicbenchmarks.com/rest/v3/standards&amp;partner.id=devconnect04&amp;auth.signature=Tp1akyZwnn4hNcS91LQH1Rq7os9L4vGtxNHIz3GWT0s=&amp;auth.expires=1454652779865&amp;list=state,document,subject_doc&amp;state=in&amp;subject=math&amp;document.title=Academic%20Standards>"

let $result :=
    xdmp:http-get($geturl,
    <options xmlns="xdmp:http">
       <timeout>60</timeout>
     </options>
      )
  return  $result

When I am using ML7 I am getting the below exception

<response xmlns="xdmp:http">
<code>406</code>
<message>Not Acceptable</message>
<headers>
<cache-control>no-cache</cache-control>
<pragma>no-cache</pragma>
<content-type>text/html; charset=utf-8</content-type>
<connection>close</connection>
<content-length>652</content-length>
</headers>
</response>
Text document
<HTML><HEAD>

<TITLE>Request Error</TITLE>

</HEAD>

<BODY>

<FONT face="Helvetica">

<big><strong></strong></big><BR>

</FONT>

<blockquote>

<TABLE border=0 cellPadding=1 width="80%">

<TR><TD>

<FONT face="Helvetica">

<big>Request Error (unsupported_protocol)</big>

<BR>

<BR>

</FONT>

</TD></TR>

<TR><TD>

<FONT face="Helvetica">

Your request used a protocol that is not currently supported.

</FONT>

</TD></TR>

<TR><TD>

<FONT face="Helvetica">



</FONT>

</TD></TR>

<TR><TD>

<FONT face="Helvetica" SIZE=2>

<BR>

For assistance, contact your network support team.

</FONT>

</TD></TR>

</TABLE>

</blockquote>

</FONT>

</BODY></HTML>

When I hit the same URL Using REST client I am getting the response and also in 
the above query if I remove document.title parameter I am getting the response 
from the above MarkLogic code. So I would like to know is there any specific 
parameters like document will not work with xdmp:http-get() function.

Can anyone please help me on this ASAP.


Thanks,
Vinod.


This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.

_______________________________________________
General mailing list
General@developer.marklogic.com<mailto:General@developer.marklogic.com>
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general


_______________________________________________
General mailing list
General@developer.marklogic.com<mailto:General@developer.marklogic.com>
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to