We have an employee whose surname is Null. Our employee lookup application is killed when that last name is used as the search term (which happens to be quite often now). The error received (thanks Fiddler!) is:
<soapenv:Fault>
<faultcode>soapenv:Server.userException</faultcode>
<faultstring>coldfusion.xml.rpc.CFCInvocationException: [coldfusion.runtime.MissingArgumentException : The SEARCHSTRING parameter to the getFacultyNames function is required but was not passed in.]</faultstring>
Cute, huh?
The parameter type is string
.
I am using:
- WSDL (SOAP)
- Flex 3.5
- ActionScript 3
- ColdFusion 8
Note that the error does not occur when calling the webservice as an object from a ColdFusion page.
Well, I guess that Flex' implementation of the SOAP Encoder seems to serialize null values incorrectly. Serializing them as a String Null doesn't seem to be a good solution. The formally correct version seems to be to pass a null value as:
So the value of "Null" would be nothing else than a valid string, which is exactly what you are looking for.
I guess getting this fixed in Apache Flex shouldn't be that hard to get done. I would recommend opening a Jira issue or to contact the guys of the apache-flex mailinglist. However this would only fix the client side. I can't say if ColdFusion will be able to work with null values encoded this way.
See also Radu Cotescu's blog post How to send null values in soapUI requests.
Stringifying a
null
value in ActionScript will give the string"NULL"
. My suspicion is that someone has decided that it is, therefore, a good idea to decode the string"NULL"
asnull
, causing the breakage you see here -- probably because they were passing innull
objects and getting strings in the database, when they didn't want that (so be sure to check for that kind of bug, too).It's a kludge, but assuming there's a minimum length for
SEARCHSTRING
, for example 2 characters,substring
theSEARCHSTRING
parameter at the second character and pass it as two parameters instead:SEARCHSTRING1 ("Nu")
andSEARCHSTRING2 ("ll").
Concatenate
them back together when executing the query to the database.Translate all characters into their hex-entity equivalents. In this case,
Null
would be converted intoE;KC;C;
On the xkcd note, the Bobby Tables website has good advice for avoiding the improper interpretation of user data (in this case, the string "Null") in SQL queries in various languages, including ColdFusion.
It is not clear from the question that this is the source of the problem, and given the solution noted in a comment to the first answer (embedding the parameters in a structure) it seems likely that it was something else.
As a hack, you could consider having a special handling on the client side, converting 'Null' string to something that will never occur, for example, XXNULLXX and converting back on the server.
It is not pretty, but it may solve the issue for such a boundary case.