• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Web Services and Parameters - Problem

LEGEND ,
Nov 22, 2007 Nov 22, 2007

Copy link to clipboard

Copied

I have 2 web services I set up. One takes no parameters and works fine. The
other takes arguments and it tells me the method cannot be found. What am I
missing? What is the magic bullet to invoke a web service that takes
arguments and have it work? I have all the web service's arguments set to
'required="yes"' and I set up another 'no argument function' in the
SearchProperty.cfc to make sure it also works and it did fine, so I know the
web service exists and is accessible.

I tried both createObject in my contoller and cfinvoke. Both work fine for
the web service that takes no arguments and neither work for the one that
does.

Here is my controller blocks (please excuse the Model-Glue)

This works fine
<!---Get All Cities For Search Engine--->
<cffunction name="getCities" access="public" returntype="void"
output="false" hint="I displays all the cities for the front page">
<cfargument name="event" type="ModelGlue.Core.Event" required="yes">
<cfset Cities = createObject("webservice",
" http://74.86.90.210/realitorToolBox/model/webservices/CityGateway.cfc?wsdl")/>
<cfset allCities = Cities.getCities() />
<cfset arguments.event.setValue("getAllCities", allCities)/>
</cffunction>

This cannot be found:
<!---Search Residentual Properties--->
<cffunction name="SearchProperties" access="public" returntype="void"
output="false" hint="I displays all the cities for the front page">
<cfargument name="event" type="ModelGlue.Core.Event" required="yes">
<cfset userID = 555555>
<cfset bedrooms = arguments.event.getValue("bedrooms")/>
<cfset bathrooms = arguments.event.getValue("bathrooms")/>
<cfset footage = arguments.event.getValue("footage")/>
<cfset minprice = arguments.event.getValue("minprice")/>
<cfset maxprice = arguments.event.getValue("maxprice")/>
<cfset basement = arguments.event.getValue("basement")/>
<cfset garage = arguments.event.getValue("garage")/>
<cfset CITIES = arguments.event.getValue("CITIES")/>
<cfset Search = createObject("webservice",
" http://74.86.90.210/realitorToolBox/model/webservices/SearchProperty.cfc?wsdl")/>
<cfset searchAll = Search.SearchProperty(#userID#, #bedrooms#,
#bathrooms#, #footage#, #minprice#, #maxprice#, #basement#, #garage#,
#CITIES#) />
<cfset arguments.event.setValue("Results", searchAll)/>
</cffunction>


Any ideas? My client is getting anxious and I hope to offer this service to
other developers to use for their client's site.


TOPICS
Advanced techniques

Views

448

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 22, 2007 Nov 22, 2007

Copy link to clipboard

Copied

Ok, I will make this simplier. Couple questions.

Is it possible to use cfargument in a web service?
I looked at the samples out there and they all just have queries that take a
form variable (#form.name#) since it was being passed by a form.

Is it possible to have one web service function invoke another function in
the same cfc?
If you have one function that calls another to first validate the user and
then invoke another to get the search results, do all have to be remote or
can you have the search be private since you dont want it invoked remotely.

I.E.
<cffunction name="search" access="remote" returntype="query">
<cfset authenticate = authenticateUser(#username#)>
<cfif authenticate EQ 'yes'>
<cfset myResults = searchProperty(#mlsnumber#)>
</cfif>
<cfreturn my Results>
</cffunction>

I tried a simple city search and tried to pass a variable argument.

<cfinvoke
webservice=" http://74.86.90.210/realitorToolBox/model/webservices/CityGateway.cfc?wsdl" method="findCity" city = "clinton" returnvariable="aQuery"/>to: <cffunction name="findCity" access="remote" returntype="query"> <cfquery name="getCities" datasource="MLSListings"> Select city FROM residential WHERE city = '#city#' </cfquery> <cfreturn getCities> </cffunction>And I still get a function cannot be found, even though I used the cfcexplorer to verify that it does exist on the remote server.Any ideas?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 22, 2007 Nov 22, 2007

Copy link to clipboard

Copied

you have access set to public instead of remote in the function definition.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 22, 2007 Nov 22, 2007

Copy link to clipboard

Copied

That is the controller and not the web service.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 22, 2007 Nov 22, 2007

Copy link to clipboard

Copied

Your problem is this:
type="ModelGlue.Core.Event"
Examples of valid argument types are date, string, number, etc.

You have other issues also, but that's the one that's causing your current problem.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 24, 2007 Nov 24, 2007

Copy link to clipboard

Copied

LATEST
Actually, that is how you set a controller with Model-Glue. That part is
fine. Check into model-glue and you'll see that the event is a collection of
all the variables from form or url.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation