Well, I made a small amount of progress.  I have at least proved that 
ColdFusion can retrieve some kind of data from a National Weather Service web 
service.  But, it is not very useful yet.  First of all, I played with the 
code, and I was able to get a different error "Could not perform web service 
invocation "NDFDgenByDay" because java.lang.IllegalArgumentException: argument 
type mismatch".  I have not been able to figure out what argument has a 
mismatched type.  But the code was now finding the service and its methods.

Then I found a different web service URI that I can get data from one of the 
two functions to be returned.  But this data is not properly formed XML.  There 
are several close tags "</someTag>" without an appropriate start tag.  This 
makes the data fairly difficult to use, I think.

I wanted to post my progress here, so that others interested with more web 
service skill then I may be able to figure this out.  I would really love to be 
able to get data like this, because it could be a very nice addition to an 
Outdoor Recreation site I maintain.

MY CODE
---------------

<cfscript>
        // Parameters for the NDFgenByDay function
        NDFDgenByDay = structNew();
        NDFDgenByDay.latitude = 38.9936;
        NDFDgenByDay.longitude = -77.0224;
        NDFDgenByDay.format = "12hourly";
        NDFDgenByDay.startDate = "2005-01-05";
        NDFDgenByDay.numDays = 7;
        
        // Parameters for the NDFDgen function
        NDFDgen = StructNew();
        NDFDgen.Latitude = 38.9936;
        NDFDgen.Longitude = -77.0224;
        NDFDgen.StartTime = "2005-01-05T00:00:00.5";
        NDFDgen.Endtime = "2005-01-06T00:00:00.5";
        NDFDgen.Product = "glance";
        
        weatherParameters = StructNew();
        weatherParameters.maxt = true;
        weatherParameters.mint = true;
        weatherParameters.temp = true;
        weatherParameters.dew = true;
        weatherParameters.pop12 = true;
        weatherParameters.qpf = true;
        weatherParameters.snow = true;
        weatherParameters.sky = true;
        weatherParameters.wspd = true;
        weatherParameters.wdir = true;
        weatherParameters.wx = true;
        weatherParameters.icons = true;
        weatherParameters.waveh = true;
        
        NDFDgen.weatherParameters = weatherParameters;
        
        //The new URI I found when digging around the documentation
        ws1 = CreateObject("webservice", 
"http://www.nws.noaa.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php?wsdl";);
        //The Original URL
        ws2 = CreateObject("webservice", 
"http://www.nws.noaa.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl";);
        
        //Initilize result strings so that there will always be something to 
output.
        aStringWS1 = 'No Output Generated';
        aStringWS2 = 'No Output Generated';
</cfscript>

<!--- 
        TWO possible URI for the web service.
        http://www.nws.noaa.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl
        http://www.nws.noaa.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php?wsdl
--->

<cftry>
        <!--- This call to the new web service will return data, but not well 
formed XML --->
        <cfset aStringWS1 = ws1.NDFDgenByDay(argumentCollection = NDFDgenByDay)>
        <cfcatch type="any"><cfdump var="#cfcatch#" expand="no" label="ERROR: 
http://www.nws.noaa.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php?wsdl";></cfcatch>
</cftry>

<cftry>
        <!--- This call to the original web service does not return data, but 
errors with the mismatched argurment type error. --->
        <cfset aStringWS2 = ws2.NDFDgenByDay(argumentCollection = NDFDgenByDay)>
        <cfcatch type="any"><cfdump var="#cfcatch#" expand="no" label="ERROR: 
http://www.nws.noaa.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl";></cfcatch>
</cftry>

<h1>Results</h1>
<cfoutput>
        
<h2>http://www.nws.noaa.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php?wsdl</h2>
        #HTMLEditFormat(aStringWS1)#
        <hr>
        <h2>http://www.nws.noaa.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl</h2>
        #HTMLEditFormat(aStringWS2)#
</cfoutput>

--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA

"C code. C code run. Run code run. Please!"
- Cynthia Dunning



Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message. 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
This list and all House of Fusion resources hosted by CFHosting.com. The place 
for dependable ColdFusion Hosting.
http://www.houseoffusion.com/banners/view.cfm?bannerid=11

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189432
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to