I'm having trouble understanding how some code a former co-worker wrote works.
He retrieves an object by calling the GetWeatherInfo method of the service http://www.ejse.com/WeatherService/Service.asmx?WSDL. Then he retrieves individual data points by calling functions on that method. The WSDL doesn't show those functions and that's what is confusing me. How did he know about them? What piece is doing the magic? The code is coldfusion, I'm not sure whether that matters. In case it does, I'll include it. He sets oWeather equal to the result of the call to the GetWeatherInfo method. oWeather is an object. Does the server with the service get called everytime a method is invoked on oWeather? I think it must not, but if it does, how does it know what data to return? <cfset keep.webService = "http://www.ejse.com/WeatherService/Service.asmx?WSDL"> <cfset keep.xmlFile = "D:\inetpub\wgapps\tasks\xml\currentweather.xml"> <cfset keep.imageDirURL = "http://" & CGI.server_name & "/tasks/images/weathericons"> <cffunction name="initWS" access="public" output="false" returntype="boolean" hint="Populates the object with current weather conditions for the plant, using a web service."> <cfargument name="plant" type="string" required="true" displayname="Plant Code" hint="The plant code of the plant to initialize."> <cfset var rc = true> <cfset var oWeather = ""> <!--- Create an structure containing current weather conditions for a plant ---> <cfset self.plant = arguments.plant> <cfset self.zipCode = keep.stPlant[self.plant]> <cfinvoke webservice="#keep.webService#" method="GetWeatherInfo" zipCode="#self.zipCode#" returnVariable="oWeather" /> <cfset self.location = oWeather.getLocation()> <cfset self.iconIndex = oWeather.getIconIndex()> <cfset self.iconURL = "#keep.imageDirURL#/#self.iconIndex#.gif"> <cfset self.temperature = oWeather.getTemprature()> <cfset self.feelsLike = oWeather.getFeelsLike()> <cfset self.forecast = oWeather.getForecast()> <cfset self.visibility = oWeather.getVisibility()> <cfset self.pressure = oWeather.getPressure()> <cfset self.dewPoint = oWeather.getDewPoint()> <cfset self.UVIndex = oWeather.getUVIndex()> <cfset self.humidity = oWeather.getHumidity()> <cfset self.wind = oWeather.getWind()> <cfset self.reportedAt = oWeather.getReportedAt()> <cfset self.lastUpdated = oWeather.getLastUpdated()> <cfreturn rc> </cffunction> ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com).
