With complex web services, it is often easier to go the xml + cfhttp route, as Chester suggested. However, to answer your question, there are a few things wrong with the arguments. That is what the error message means. A method by that name may exist, but its signature does not match the values you have supplied. There is either mismatch in the number of arguments, or in this case, the type of arguments.
According to the wsdl, the
start/endTime
values must be dates. While CF can implicitly convert a variety of U.S. date strings, it cannot parse the format you are using:yyyy-MM-ddThh:mm
. So either use date objects, or use "parseable", date strings such asyyyy-MM-dd hh:mm:ss
.The "weatherParameters" argument should be structure (or complex type) not a string:
<cfset weather = {maxt=true}>
...
<cfinvokeargument name="weatherParameters" value="#weather#">
The
Product
andUnit
values have too many quotes. By usingvalue='"glance"'
you are actually including the double quotes as part of the value. That will probably cause an error because the remote web service expects to receiveglance
(no quotes).While it will not cause an error, you do not need to include closing tags:
</cfinvokeargument>
. If you prefer to close it, it is cleaner to use the shortcut<cfinvokeargument ... />
With those changes, your call should work as expected. Though you might want to consider switching to createObject
, rather than cfinvoke
. Then you can dump the web service object for debugging purposes. It is also less bulky IMO.
<cfscript>
ws = createObject("webservice", "http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl");
//show web service methods for debugging purposes
writeDump(ws);
// construct arguments
args = {latitude="37.94"
, longitude="-75.47"
, product="glance"
, startTime="2014-05-02 12:00:00"
, endTime="2014-05-05 12:00:00"
, Unit="e"
, weatherParameters={maxt=true}
};
// call the method
result = ws.NDFDgen(argumentCollection=args);
writeDump(result)
</cfscript>