0

/t5/coldfusion-discussions/webservice-int-and-boolean-arguments-post-as-strings/td-p/530018
Jun 22, 2006
Jun 22, 2006
Copy link to clipboard
Copied
I'm having some trouble with data type mismatches when
invoking a webservice. It seems ColdFusion sends in all parameters
as strings, when SOAP wants boolean or int and they aren't
matching.
The webservice has the following parameters (I've only included the parts that are giving me problems):
<wsdl:message name="doPassProductSearchRequest">
<wsdl:part name="nCountries" type="xsd:int"/>
<wsdl:part name="isFlexible" type="xsd:boolean"/>
</wsdl:message>
Here is my call to it:
<cfinvoke webservice="#webservice#" method="doPassProductSearch" returnvariable="getProduct" >
<cfinvokeargument name="nCountries" value="0">
<cfinvokeargument name="isFlexible" value="1">
</cfinvoke>
Here is the error I receive:
Could not perform web service invocation "doPassProductSearch".
Here is the fault returned when invoking the web service operation:
java.lang.IllegalArgumentException: argument type mismatch
Does anyone know how I should code this so the cfinvoke will definitely send in a boolean and an int? I assumed just sending a number would do it, but the developer on the other end says no.
Thanks!
The webservice has the following parameters (I've only included the parts that are giving me problems):
<wsdl:message name="doPassProductSearchRequest">
<wsdl:part name="nCountries" type="xsd:int"/>
<wsdl:part name="isFlexible" type="xsd:boolean"/>
</wsdl:message>
Here is my call to it:
<cfinvoke webservice="#webservice#" method="doPassProductSearch" returnvariable="getProduct" >
<cfinvokeargument name="nCountries" value="0">
<cfinvokeargument name="isFlexible" value="1">
</cfinvoke>
Here is the error I receive:
Could not perform web service invocation "doPassProductSearch".
Here is the fault returned when invoking the web service operation:
java.lang.IllegalArgumentException: argument type mismatch
Does anyone know how I should code this so the cfinvoke will definitely send in a boolean and an int? I assumed just sending a number would do it, but the developer on the other end says no.
Thanks!
TOPICS
Advanced techniques
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
LEGEND
,
Jun 22, 2006
Jun 22, 2006
It's not the most intuitive feature but you can you the
<cfparam ...>
tag to set data types for variables.
<cfparam name="nCountries" value="0" type="int">
<cfparam name="isFlexible value="true" type="boolean">
...
<cfinvokeargument name="nCountries" value="#nCountries#">
<cfinvokeargument name="isFlexible" value="#isFlexible#">
I've posted a working test case I once created to get the NOAA's weather
forecast data.
rachelcp wrote:
> I'm having some trouble with data type mismatches when i...
tag to set data types for variables.
<cfparam name="nCountries" value="0" type="int">
<cfparam name="isFlexible value="true" type="boolean">
...
<cfinvokeargument name="nCountries" value="#nCountries#">
<cfinvokeargument name="isFlexible" value="#isFlexible#">
I've posted a working test case I once created to get the NOAA's weather
forecast data.
rachelcp wrote:
> I'm having some trouble with data type mismatches when i...
LEGEND
,
/t5/coldfusion-discussions/webservice-int-and-boolean-arguments-post-as-strings/m-p/530019#M48428
Jun 22, 2006
Jun 22, 2006
Copy link to clipboard
Copied
It's not the most intuitive feature but you can you the
<cfparam ...>
tag to set data types for variables.
<cfparam name="nCountries" value="0" type="int">
<cfparam name="isFlexible value="true" type="boolean">
...
<cfinvokeargument name="nCountries" value="#nCountries#">
<cfinvokeargument name="isFlexible" value="#isFlexible#">
I've posted a working test case I once created to get the NOAA's weather
forecast data.
rachelcp wrote:
> I'm having some trouble with data type mismatches when invoking a webservice.
> It seems ColdFusion sends in all parameters as strings, when SOAP wants boolean
> or int and they aren't matching.
>
> The webservice has the following parameters (I've only included the parts that
> are giving me problems):
>
> <wsdl:message name="doPassProductSearchRequest">
> <wsdl:part name="nCountries" type="xsd:int"/>
> <wsdl:part name="isFlexible" type="xsd:boolean"/>
> </wsdl:message>
>
> Here is my call to it:
>
> <cfinvoke webservice="#webservice#" method="doPassProductSearch"
> returnvariable="getProduct" >
> <cfinvokeargument name="nCountries" value="0">
> <cfinvokeargument name="isFlexible" value="1">
> </cfinvoke>
>
> Here is the error I receive:
>
> Could not perform web service invocation "doPassProductSearch".
> Here is the fault returned when invoking the web service operation:
>
> java.lang.IllegalArgumentException: argument type mismatch
>
> Does anyone know how I should code this so the cfinvoke will definitely send
> in a boolean and an int? I assumed just sending a number would do it, but the
> developer on the other end says no.
>
> Thanks!
>
<cfparam name="WAVEH" default = false type="boolean">
<cfparam name="maxt" default = true type="boolean">
<cfparam name="mint" default = true type="boolean">
<cfparam name="tempx" default = false type="boolean">
<cfparam name="dew" default = false type="boolean">
<cfparam name="pop12" default = false type="boolean">
<cfparam name="qpf" default = false type="boolean">
<cfparam name="snow" default = false type="boolean">
<cfparam name="sky" default = false type="boolean">
<cfparam name="wspd" default = false type="boolean">
<cfparam name="wdir" default = false type="boolean">
<cfparam name="wx" default = false type="boolean">
<cfparam name="icons" default = false type="boolean">
<cfparam name="waveh" default = false type="boolean">
<cfparam name="startDate" default="#now()#" type="date">
<cfparam name="numDays" default="2" type="numeric">
<cfparam name="format" default="24 hourly" type="string">
<cfset strWeatherParameters = STRUCTNEW() />
<cfset strWeatherParameters.WAVEH = WAVEH />
<cfset strWeatherParameters.maxt = maxt />
<cfset strWeatherParameters.mint = mint />
<cfset strWeatherParameters.temp = tempx />
<cfset strWeatherParameters.dew = dew />
<cfset strWeatherParameters.pop12 = pop12 />
<cfset strWeatherParameters.qpf = qpf />
<cfset strWeatherParameters.snow = snow />
<cfset strWeatherParameters.sky = sky />
<cfset strWeatherParameters.wspd = wspd />
<cfset strWeatherParameters.wdir = wdir />
<cfset strWeatherParameters.wx = wx />
<cfset strWeatherParameters.icons = icons />
<cfset strWeatherParameters.waveh = waveh />
<cfinvoke webservice =
" http://weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl"
method = "NDFDgenByDay"
returnvariable = "xmlWeatherData">
<cfinvokeargument name="latitude" value="42.3485"/>
<cfinvokeargument name="longitude" value="-71.0733"/>
<cfinvokeargument name="startDate" value="#startDate#"/>
<cfinvokeargument name="numDays" value="#numDays#"/>
<cfinvokeargument name="format" value="#format#"/>
</cfinvoke>
<cfset NDFDgenByDayData = XMLParse(xmlWeatherData) />
<cfinvoke webservice =
" http://weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl"
method = "NDFDgen"
returnvariable = "xmlWeatherData">
<cfinvokeargument name="latitude" value="42.3485"/>
<cfinvokeargument name="longitude" value="-71.0733"/>
<cfinvokeargument name="product" value="time-series"/>
<cfinvokeargument name="startTime" value="#now()#"/>
<cfinvokeargument name="endTime" value="#dateAdd('d',3,now())#"/>
<cfinvokeargument name="weatherParameters" value="#strWeatherParameters#"/>
</cfinvoke>
<cfset NDFDgenData = XMLParse(xmlWeatherData) />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
" http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<cfdump var="#server#">
<cfdump var="#NDFDgenByDayData#">
<cfdump var="#NDFDgenData#">
</body>
</html>
tag to set data types for variables.
<cfparam name="nCountries" value="0" type="int">
<cfparam name="isFlexible value="true" type="boolean">
...
<cfinvokeargument name="nCountries" value="#nCountries#">
<cfinvokeargument name="isFlexible" value="#isFlexible#">
I've posted a working test case I once created to get the NOAA's weather
forecast data.
rachelcp wrote:
> I'm having some trouble with data type mismatches when invoking a webservice.
> It seems ColdFusion sends in all parameters as strings, when SOAP wants boolean
> or int and they aren't matching.
>
> The webservice has the following parameters (I've only included the parts that
> are giving me problems):
>
> <wsdl:message name="doPassProductSearchRequest">
> <wsdl:part name="nCountries" type="xsd:int"/>
> <wsdl:part name="isFlexible" type="xsd:boolean"/>
> </wsdl:message>
>
> Here is my call to it:
>
> <cfinvoke webservice="#webservice#" method="doPassProductSearch"
> returnvariable="getProduct" >
> <cfinvokeargument name="nCountries" value="0">
> <cfinvokeargument name="isFlexible" value="1">
> </cfinvoke>
>
> Here is the error I receive:
>
> Could not perform web service invocation "doPassProductSearch".
> Here is the fault returned when invoking the web service operation:
>
> java.lang.IllegalArgumentException: argument type mismatch
>
> Does anyone know how I should code this so the cfinvoke will definitely send
> in a boolean and an int? I assumed just sending a number would do it, but the
> developer on the other end says no.
>
> Thanks!
>
<cfparam name="WAVEH" default = false type="boolean">
<cfparam name="maxt" default = true type="boolean">
<cfparam name="mint" default = true type="boolean">
<cfparam name="tempx" default = false type="boolean">
<cfparam name="dew" default = false type="boolean">
<cfparam name="pop12" default = false type="boolean">
<cfparam name="qpf" default = false type="boolean">
<cfparam name="snow" default = false type="boolean">
<cfparam name="sky" default = false type="boolean">
<cfparam name="wspd" default = false type="boolean">
<cfparam name="wdir" default = false type="boolean">
<cfparam name="wx" default = false type="boolean">
<cfparam name="icons" default = false type="boolean">
<cfparam name="waveh" default = false type="boolean">
<cfparam name="startDate" default="#now()#" type="date">
<cfparam name="numDays" default="2" type="numeric">
<cfparam name="format" default="24 hourly" type="string">
<cfset strWeatherParameters = STRUCTNEW() />
<cfset strWeatherParameters.WAVEH = WAVEH />
<cfset strWeatherParameters.maxt = maxt />
<cfset strWeatherParameters.mint = mint />
<cfset strWeatherParameters.temp = tempx />
<cfset strWeatherParameters.dew = dew />
<cfset strWeatherParameters.pop12 = pop12 />
<cfset strWeatherParameters.qpf = qpf />
<cfset strWeatherParameters.snow = snow />
<cfset strWeatherParameters.sky = sky />
<cfset strWeatherParameters.wspd = wspd />
<cfset strWeatherParameters.wdir = wdir />
<cfset strWeatherParameters.wx = wx />
<cfset strWeatherParameters.icons = icons />
<cfset strWeatherParameters.waveh = waveh />
<cfinvoke webservice =
" http://weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl"
method = "NDFDgenByDay"
returnvariable = "xmlWeatherData">
<cfinvokeargument name="latitude" value="42.3485"/>
<cfinvokeargument name="longitude" value="-71.0733"/>
<cfinvokeargument name="startDate" value="#startDate#"/>
<cfinvokeargument name="numDays" value="#numDays#"/>
<cfinvokeargument name="format" value="#format#"/>
</cfinvoke>
<cfset NDFDgenByDayData = XMLParse(xmlWeatherData) />
<cfinvoke webservice =
" http://weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl"
method = "NDFDgen"
returnvariable = "xmlWeatherData">
<cfinvokeargument name="latitude" value="42.3485"/>
<cfinvokeargument name="longitude" value="-71.0733"/>
<cfinvokeargument name="product" value="time-series"/>
<cfinvokeargument name="startTime" value="#now()#"/>
<cfinvokeargument name="endTime" value="#dateAdd('d',3,now())#"/>
<cfinvokeargument name="weatherParameters" value="#strWeatherParameters#"/>
</cfinvoke>
<cfset NDFDgenData = XMLParse(xmlWeatherData) />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
" http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<cfdump var="#server#">
<cfdump var="#NDFDgenByDayData#">
<cfdump var="#NDFDgenData#">
</body>
</html>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/webservice-int-and-boolean-arguments-post-as-strings/m-p/530020#M48429
Jun 22, 2006
Jun 22, 2006
Copy link to clipboard
Copied
That of course should be:
<cfparam name="nCountries" value="0" type="integer">
Thats what I get for typing off the cuff again, and not checking the
documentation.
Ian Skinner wrote:
> <cfparam name="nCountries" value="0" type="int">
<cfparam name="nCountries" value="0" type="integer">
Thats what I get for typing off the cuff again, and not checking the
documentation.
Ian Skinner wrote:
> <cfparam name="nCountries" value="0" type="int">
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

Guest
AUTHOR
/t5/coldfusion-discussions/webservice-int-and-boolean-arguments-post-as-strings/m-p/530022#M48431
Jun 23, 2006
Jun 23, 2006
Copy link to clipboard
Copied
Ian - thank you for your help. When I tried this code, it
seemed to work just the same without the cfparams. I commented
those out and just used:
<cfset strWeatherParameters = STRUCTNEW() />
<cfset strWeatherParameters.WAVEH = false />
<cfset strWeatherParameters.maxt = true />
<cfset strWeatherParameters.mint = true />
<cfset strWeatherParameters.temp = 0 />
<cfset strWeatherParameters.dew = 0 />
<cfset strWeatherParameters.pop12 = 0 />
<cfset strWeatherParameters.qpf = 0 />
<cfset strWeatherParameters.snow = 0 />
<cfset strWeatherParameters.sky = 0 />
<cfset strWeatherParameters.wspd = 0 />
<cfset strWeatherParameters.wdir = 0 />
<cfset strWeatherParameters.wx = 0 />
<cfset strWeatherParameters.icons = 0 />
<cfset strWeatherParameters.waveh = 0 />
It ran without errors. I looked at the WSDL for this service and it does say "xsd:boolean". It must be the "xsd:int" inputs that are failing in my code. Excellent idea to try a public webservice that has those inputs.
<cfset strWeatherParameters = STRUCTNEW() />
<cfset strWeatherParameters.WAVEH = false />
<cfset strWeatherParameters.maxt = true />
<cfset strWeatherParameters.mint = true />
<cfset strWeatherParameters.temp = 0 />
<cfset strWeatherParameters.dew = 0 />
<cfset strWeatherParameters.pop12 = 0 />
<cfset strWeatherParameters.qpf = 0 />
<cfset strWeatherParameters.snow = 0 />
<cfset strWeatherParameters.sky = 0 />
<cfset strWeatherParameters.wspd = 0 />
<cfset strWeatherParameters.wdir = 0 />
<cfset strWeatherParameters.wx = 0 />
<cfset strWeatherParameters.icons = 0 />
<cfset strWeatherParameters.waveh = 0 />
It ran without errors. I looked at the WSDL for this service and it does say "xsd:boolean". It must be the "xsd:int" inputs that are failing in my code. Excellent idea to try a public webservice that has those inputs.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/webservice-int-and-boolean-arguments-post-as-strings/m-p/530021#M48430
Jun 23, 2006
Jun 23, 2006
Copy link to clipboard
Copied
Actually, isn't it type numeric?
Ian Skinner wrote:
> That of course should be:
> <cfparam name="nCountries" value="0" type="integer">
>
> Thats what I get for typing off the cuff again, and not checking the
> documentation.
>
> Ian Skinner wrote:
>> <cfparam name="nCountries" value="0" type="int">
>
Ian Skinner wrote:
> That of course should be:
> <cfparam name="nCountries" value="0" type="integer">
>
> Thats what I get for typing off the cuff again, and not checking the
> documentation.
>
> Ian Skinner wrote:
>> <cfparam name="nCountries" value="0" type="int">
>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

