CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   ColdFusion (http://www.codingforums.com/forumdisplay.php?f=45)
-   -   Error when using CFHTTP (http://www.codingforums.com/showthread.php?t=271045)

anarchos78 08-21-2012 07:33 PM

Error when using CFHTTP
 
Greetings friends,
I have built an app on openBD using CFML. In the app I am using CFHTTP like following:

Code:

<cfcomponent output="false">
<cfprocessingdirective pageencoding="utf-8">
<cfset setEncoding("URL", "utf-8")>

  <cffunction name="search" access="remote" returnType="any" returnFormat="plain">           
      <cfargument name="q" type="string" default="" required="yes">     
      <cfargument name="rows" type="string" default="&rows=120" required="yes"> 
      <cfargument name="score" type="string" default="&sort=score%20desc" required="yes">
      <cfargument name="highlight" type="string" default="&hl=true" required="yes">         
      <cfargument name="json" type="string" default="&wt=json" required="yes">
      <cfargument name="phrasehighlighter" type="string" default="&hl.usePhraseHighlighter=true" required="yes">
      <cfargument name="filtr" type="string" default="&fq=model:*" required="yes">
      <cfargument name="callbackP" type="string" required="false">
     
      <cfset theUrl = 'http://localhost:8090/solr/ktimatologio/select/?hl.requireFieldMatch=true&hl.fl=*&q=' & #Arguments.q# & #ARGUMENTS.rows# & #ARGUMENTS.score# & #ARGUMENTS.highlight# & #ARGUMENTS.json# & #ARGUMENTS.phrasehighlighter#>
     
      <cfhttp url= "#theUrl#"  result="rs"></cfhttp>
…………………
…………………
…………………
…………………
</cfcomponent>

When I run it I am getting the error: 'Failed to set URL: Invalid query'.

I am damn stuck! What does this error means? I think on Adobe’s CFML engine is working properly, but I am not sure. My "programing" quiver was run out of arrows!.I need to get this working on openBD.
With respect,
Tom
Greece

WolfShade 08-21-2012 09:19 PM

It appears (to me) that you are setting "q" to equal q, rows, score, highlight, json, and phrasehighlighter. If these are all supposed to have their own name for each value, the string needs to be reformatted. There is also no closing ' for the string (not critical, but I consider it good form to always use a closing string delimiter.)

Also, you can do without the hashmarks, since the values are not contained within "double quotes".

Code:

<cfset theUrl = 'http://localhost:8090/solr/ktimatologio/select/?hl.requireFieldMatch=true&hl.fl=*&q=' & Arguments.q & '&rows=' & ARGUMENTS.rows & '&score=' & ARGUMENTS.score & '&highlight=' & ARGUMENTS.highlight & '&json=' & ARGUMENTS.json & '&phrasehighlighter=' & ARGUMENTS.phrasehighlighter & ''>


All times are GMT +1. The time now is 06:34 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.