Programming

ActionScript 3 SOAP: Send the literal Null to ColdFusion

Fix MissingArgumentException when sending 'Null' from AS3 to ColdFusion SOAP: use new String('Null'), CDATA, or server-side checks, and test with SOAP traces.

1 answer 5 views

How to pass the string ‘Null’ to a SOAP web service in ActionScript 3 without triggering a MissingArgumentException error

We have an employee whose surname is ‘Null’, and our employee lookup application crashes when this surname is used as a search term. The error received 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>
</soapenv:Fault>

The parameter type is defined as string. This issue occurs specifically when calling the web service from ActionScript 3, but not when calling it from a ColdFusion page.

Technical environment:

  • WSDL (SOAP)
  • Flex 3.5
  • ActionScript 3
  • ColdFusion 8

How can we properly pass the string ‘Null’ to the SOAP web service in ActionScript 3 without the system interpreting it as a null value?

In ActionScript 3, Flex 3.5’s SOAP client has a quirky bug: it coerces the literal string “Null” into an actual null value, omitting the SEARCHSTRING parameter entirely from the SOAP request. This triggers ColdFusion 8’s MissingArgumentException because the server sees no parameter at all. The quick fix? Force it as new String("Null") or wrap in CDATA—both ensure the string arrives intact without ActionScript interpreting it as soap null.


Contents

  • [The “Null” Surname Problem in ActionScript 3 SOAP {#problem}]
  • [Why ActionScript 3 Coerces “Null” to Nothing {#why}]
  • [Reproducing the Issue with SOAP XML Traces {#reproduce}]
  • [Client-Side Fixes: Send Literal “Null” from Flex {#client-fixes}]
  • [Server-Side ColdFusion Workarounds {#server-fixes}]
  • [Testing and Validation Steps {#testing}]
  • [Migration Notes for Modern Setups {#migration}]
  • Sources
  • Conclusion

The “Null” Surname Problem in ActionScript 3 SOAP

Picture this: an employee named Null tries to log in or get looked up. Your Flex 3.5 app, built with ActionScript 3, calls a ColdFusion 8 SOAP web service via WSDL. Boom—crash. The fault? A clean MissingArgumentException claiming SEARCHSTRING wasn’t passed, even though you swore you sent “Null”.

It sounds absurd, right? But it’s a real gotcha in older ActionScript SOAP handling. The parameter’s defined as string in the WSDL, works fine from ColdFusion pages (which send proper XML), but flakes out from Flex. No data races, no network hiccups—just “Null” vanishing like a bad magic trick.

This hits employee lookup apps hard, especially with diverse surnames. And yeah, Null is a legit last name in some cultures. Time to unpack why and fix it.


Why ActionScript 3 Coerces “Null” to Nothing

Under the hood, Flex’s SOAP serializer gets clever—too clever. When you pass proxy.getFacultyNames("Null"), ActionScript 3 does a loose equality check: "Null" == null? In weak typing land, it kinda does, thanks to XML coercion magic.

From the Stack Overflow deep dive, here’s the rub: the XML node gets treated as null-ish, so the client skips serializing it. Result? Empty SOAP body for that param. ColdFusion chokes because required args must appear, even empty.

Quora nails it too: Flex 3.5 omits nulls entirely, no xsi:nil or empty tag. Their breakdown points to string coercion as the villain. Adobe’s Operation docs hint at this via header handling, but don’t call out the bug explicitly.

Short version: ActionScript’s loose == on XML lets “null” slip through as omitted. Strict === helps in checks, but serialization ignores it.


Reproducing the Issue with SOAP XML Traces

Want proof? Fire up Charles Proxy or Fiddler to sniff SOAP traffic.

Bad request (with “Null”)—param ghosts away:

xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
 <soapenv:Body>
 <getFacultyNames/>
 </soapenv:Body>
</soapenv:Envelope>

No SEARCHSTRING. ColdFusion: “Where’s my arg?!”

Good request (from CF page):

xml
<getFacultyNames xmlns="http://yourwsdl">
 <SEARCHSTRING>Null</SEARCHSTRING>
</getFacultyNames>

Repro code in ActionScript 3/Flex:

actionscript
var proxy:YourService = new YourService();
proxy.getFacultyNames("Null"); // <- Boom, omitted!

Trace the result: faultstring screams missing arg. Swap surnames—“Smith”? Fine. “null” lowercase? Still ghosts. Only “Null” trips it reliably.

Medium post confirms: it’s the capital N that matches the null sentinel.


Client-Side Fixes: Send Literal “Null” from Flex

Don’t fight the bug—sidestep it. Here are battle-tested ActionScript 3 tweaks for Flex 3.5 SOAP.

1. Force a New String Instance

ActionScript loves objects. new String("Null") fools the serializer—no coercion.

actionscript
var proxy:YourService = new YourService();
proxy.getFacultyNames(new String("Null")); // Sends <SEARCHSTRING>Null</SEARCHSTRING>

Quora’s go-to fix—works because it’s explicitly not primitive null.

2. CDATA Escape for Safety

Wrap in CDATA to bypass string checks entirely. Stack Overflow swears by it:

actionscript
var param:XML = <SEARCHSTRING><![CDATA[Null]]></SEARCHSTRING>;
proxy.getFacultyNames(param); // Or inject via headers/operation

Generates: <SEARCHSTRING><![CDATA[Null]]></SEARCHSTRING>. ColdFusion eats CDATA fine.

3. Trim-Proof Hack: Add/Strip Space

Sneaky but effective—send "Null " then trim server-side.

actionscript
proxy.getFacultyNames("Null "); // Serializes as string, not null

Medium suggests this for quick wins.

Pick one. new String() is cleanest—no server changes.


Server-Side ColdFusion Workarounds

Client fixes rock, but make ColdFusion 8 bulletproof too. Tweak your CFC.

Defensive Argument Check

coldfusion
<cffunction name="getFacultyNames" returntype="array">
 <cfargument name="SEARCHSTRING" type="string" required="true"/>
 
 <cfif NOT structKeyExists(arguments, "SEARCHSTRING") OR 
 isNull(arguments.SEARCHSTRING) OR 
 arguments.SEARCHSTRING EQ "">
 <cfset arguments.SEARCHSTRING = "Null"> <!-- Default or log -->
 </cfif>
 
 <!--- Your query logic --->
</cffunction>

Handles omission gracefully.

Accept xsi:nil or Empty

Update WSDL/CFC to allow optional-ish:

coldfusion
<cfif structKeyExists(arguments, "SEARCHSTRING")>
 <cfset search = arguments.SEARCHSTRING>
<cfelse>
 <cfset search = "">
</cfif>

Reddit threads echo this: trim and check defensively.

No WSDL regen needed—just CFC smarts.


Testing and Validation Steps

  1. Sniff Traffic: Charles/Fiddler. Verify Null appears.
  2. Unit Test: Mock SOAP with SoapUI. Post “Null”—should return faculty.
  3. Edge Cases: Test “null”, “”, “NULL”, " Null". All must serialize.
  4. Logs: CFADMIN enable SOAP logging. ActionScript: trace(proxy.lastResult).
  5. Live Run: Employee Null searches app. No exception? Victory.

Pro tip: Automate with FlexUnit. If it passes traces, you’re golden.


Migration Notes for Modern Setups

Flex 3.5? Ancient. Apache Flex 4+ or migrate to AS3 alternatives.

  • Upgrade Flex: 4.6 fixes some coercion quirks.
  • Switch to REST: Ditch SOAP—ActionScript URLLoader for JSON APIs.
  • AMF/BlazeDS: If staying CF, use for binary RPC (no XML woes).
  • Node/Java: Frontend in modern JS? Bye ActionScript.

Reddit humor aside, this bug’s why SOAP faded. But for legacy, these fixes hold.


Sources

  1. Stack Overflow: How to pass “Null” (a real surname!) to a SOAP web service in ActionScript 3
  2. Quora: How do you pass the string literal “Null” to a SOAP web service in ActionScript 3
  3. Medium: Handling Null Values in SOAP Requests with ActionScript 3 for Apache Flex
  4. Adobe ActionScript 3 API: mx.rpc.soap.Operation
  5. Reddit ProgrammerHumor: Discussion on the “Null” SOAP issue

Conclusion

ActionScript 3’s SOAP null trap is sneaky but fixable—new String("Null") or CDATA on the client, defensive checks on ColdFusion. Test with traces, and your Null employee lookups work flawlessly. Migrate off Flex if you can; it’s 2026, after all. These tweaks keep legacy humming without rewriting everything.

Authors
Verified by moderation
Moderation
ActionScript 3 SOAP: Send the literal Null to ColdFusion