ColdFusion and Perl

Monday, October 25 2004

I’ve gone and stumped myself.

I built a web service using Perl with SOAP::Lite, and I can consume said web service with ColdFusion, but some weird things:

When I send an array back from the Perl web service, I only get the first element of the array in ColdFusion. ColdFusion sees it as an array, and not a single string, but ignores the rest. I’ve tested the web service with other platforms besides ColdFusion and at the very least I get a SOAP packet with three array elements as expected. So I’m thinking it must be ColdFusion. I haven’t tried constructing my own SOAP request packets yet because that could get ugly.

As far as I know, ColdFusion uses Apache’s Axis project to consume and serve SOAP web services. The ColdFusion server is fully patched.

Also, I’m not sure why, but I can’t seem to hit a method within the Perl web service without passing it an argument. I’m pretty sure it has something to do with my WSDL file which I had to hand author because Generate::WSDL is total crap.

Anyone have any ideas?

To those not technically inclined let it be known that everything I said about the SOAP and the WSDL above is not some kind of funny joke.

After significant poking and prodding, I got the Perl web service to return an array to ColdFusion. I modified the return expression to look something like so:

return SOAP::Data->name(‘array’ => @subArray);

The array part was a semi-educated guess. I knew, after doing some research, that name() was used to rename the packets that were returned to whatever was consuming the web service. I figured “Let’s see what happens if I just call it array” and bam, it worked. It troubles me that I’m not sure exactly why that works, but I’m pleased to see it working anyhow.

The real trick now is to see if I can pass back Perl hashes as ColdFusion structures, and figure out what constitutes a recordset in Perl and pass that back to ColdFusion. Once that’s done, I polish it up, and turn them in Perl modules somehow (I might enlist the help of those wiser than me with Perl for that).