Skip to main content
Inspiring
July 27, 2010
Question

CFInvoke CDYNE weather

  • July 27, 2010
  • 1 reply
  • 2111 views

There are 3 methods to use with cdyne:  (1) getcityweatherbyzip  (2) getcityforecastbyzip (3) getWeatherInformation

More information can be found on their site at http://ws.cdyne.com/WeatherWS/Weather.asmx

The first two are pretty straightforward and return the values needed:

<cfinvoke webservice="http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl" method="getcityweatherbyzip" returnvariable="aWeatherReturn">
<cfinvokeargument name="ZIP" value="27502"/>
</cfinvoke>


<cfoutput>
#aweatherreturn.weatherid#<Br />
#aWeatherReturn.temperature#<br />
#aweatherreturn.description#<Br />
#aweatherreturn.weatherstationcity#<br />

</cfoutput>

<cfdump var="#aweatherreturn#">

I am stumped on method 3, getWeatherInformation.  Does anyone know how to get the returned values for weatherid, description, and pictureURL from this method?  I don't get this.  How does it know what area/zip for this method?

<cfinvoke webservice="http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl" method="getweatherinformation" returnvariable="bWeatherReturn">
</cfinvoke>

<cfdump var="#bweatherReturn#">

<cfoutput>#bweatherreturn.weatherdescription#<Br />
</cfoutput>

Here is an example of my results for both methods:

http://shepherdsvineyardpool.com/sites/dsp/dsp_weather.cfm

Thank YOU!  Once this is resolved, I hope to have CDYNE post this example on their website to help others.  They have an example of the other methods, but not this one.

    This topic has been closed for replies.

    1 reply

    Inspiring
    July 27, 2010

    I am stumped on method 3, getWeatherInformation.  Does

    anyone know how to get the returned values for weatherid,

    description, and pictureURL from this method?  I don't get

    this.  How does it know what area/zip for this method?

    I do not think it is doing what you are thinking.. It seems to return a list of standard weather codes (Partly Sunny, Clear, etcetera) and the images used for each.

    <cfinvoke webservice="http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl" method="getweatherinformation" returnvariable="bWeatherReturn" />

    <cfset weatherArray = bweatherReturn.getWeatherDescription()>

    <cfloop array="#weatherArray#" index="weather">

        <cfoutput>

        #weather.weatherid#<Br />

        #weather.Description#<br />

        #weather.PictureURL#<Br />

        </cfoutput>

    </cfloop>

    Message was edited by: -==cfSearching==-

    Inspiring
    July 27, 2010

    Thank you!  It was wishful thinking on my part that it would combine the zip code with the description.  I put a simple <cfif> in the weather description loop that you created to get the results I wanted.  I was so locked into making it do what I wanted that I couldn't even get the array right! Thank you so much.  The array is just what I needed to make this work.  Thank you for your time.


    <cfinvoke webservice="http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl" method="getcityweatherbyzip" returnvariable="aWeatherReturn">
    <cfinvokeargument name="ZIP" value="27502"/>
    </cfinvoke>

    <cfinvoke webservice="http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl" method="getweatherinformation" returnvariable="bWeatherReturn">
    </cfinvoke>

    <cfset weatherArray = bweatherReturn.getWeatherDescription()>

    <cfloop array="#weatherArray#" index="weather">

    <cfif weather.weatherid eq aweatherreturn.weatherid>

        <cfoutput>

        <img src="#weather.PictureURL#" /><Br />#aWeatherReturn.temperature#

        </cfoutput>
    </cfif>

    </cfloop>

    Inspiring
    July 27, 2010

    You are welcome.

    By the way, if you only need one specific image there should be a getWeatherDescription(weatherID) method too.  You could use that method instead of having to loop through all of the descriptions every time.