Hi, There is a standard function for this as well: fn:escape-html-uri().
Regards, -- Florent Georges http://fgeorges.org/ http://h2oconsulting.be/ On 9 February 2016 at 06:24, Ryan Dew 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&partner.id=devconnect04&auth.signature=Tp1akyZwnn4hNcS91LQH1Rq7os9L4vGtxNHIz3GWT0s=&auth.expires=1454652779865&list=state,document,subject_doc&state=in&subject=math&document.title=" > || 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, <[email protected]> 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&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&partner.id=devconnect04&auth.signature=Tp1akyZwnn4hNcS91LQH1Rq7os9L4vGtxNHIz3GWT0s=&auth.expires=1454652779865&list=state,document,subject_doc&state=in&subject=math&document.title=Academic >> Standards" >> >> >> >> 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 >> [email protected] >> Manage your subscription at: >> http://developer.marklogic.com/mailman/listinfo/general >> > > > _______________________________________________ > General mailing list > [email protected] > Manage your subscription at: > http://developer.marklogic.com/mailman/listinfo/general > _______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
