Could not resolve CFC datatype: Error when viewing a cfc?wsdl
Here is what it comes down to. Let's say you have a CFC on your server on the following physical location:
/data/cfcs/remotes/giftshop/products.cfc
And the apache or IIS web root points to "remotes", thus, to call this webservice wsdl you would use
http://myurl/giftshop/products.cfc?wsdl
Now let's say that you have a CFMX mapping to any directory, it actually doesn't matter, but with the name "giftshop".
When you go now to the wsdl URL you get this nasty error:
AXIS error
Sorry, something seems to have gone wrong... here are the details:
Fault - Error attempting to create Java skeleton for CFC web service; nested exception is:
coldfusion.xml.rpc.CFCInvocationException: [coldfusion.xml.rpc.SkeletonClassLoader$UnresolvedCFCDataTypeException : Could not resolve CFC datatype: /giftshop/webProducts.cfc]
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString: Error attempting to create Java skeleton for CFC web service; nested exception is:
coldfusion.xml.rpc.CFCInvocationException: [coldfusion.xml.rpc.SkeletonClassLoader$UnresolvedCFCDataTypeException : Could not resolve CFC datatype: /giftshop/webProducts.cfc]
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:ibm-1.sandals.com
The problem lies that CFMX confuses the webroot path with the coldfusion mapping, it can't distinguish between them and actually follows the mapping. Once you remove or rename the CFMX mapping, the error disappears and you have a wsdl compilation.
Does anybody now if a fix is on the way? or already out? Please let me know.
Sean Corfield
Having a mapping with the same name as a real directory in your webroot is just plain ol' a bad idea! It's like "Doctor, doctor! It hurts when I do this!" - just don't do it.
If the mapping is to the same directory (i.e., /foo maps to {webroot}/foo) then it isn't needed. If the mapping is to a different directory then how confusing is that? /foo points to two different places depending on how you try to access a file - bad, bad idea!
Luis Majano
Sean, The problem lies, when coldfusion is used to run several virtual sites on apache. So a name of a directory on one virtual site coincides with a cfmx mapping. The two are not related. This happened by coincidence, and that is how I came to see the bug. Not the same mapping for the same dir.LOL!!
Sean Corfield
You're missing the point Luis - it doesn't matter whether it's one site or many: you can't reasonably have a mapping that has the same name as a real directory beneath a web root. If you have a URL /foo/something and a mapping /foo then either 1. /foo points to the web directory /foo (in which case it is redundant) or 2. /foo points to a different directory and you have two possible resolutions for /foo/something - there is, after all, only one ColdFusion server in play here and therefore the mapping /foo is global and affects all hosted websites served by that instance.
Luis Majano
Correct Sean! my point is that I fell upon this bug (or more like created it) :) by pure coincidence of having the two with the same name. After this I had to revise that I did not have any mappings with the same name as any of the real directories.
Advice: MAKE MAPPING NAMES DIFFERENT THAN YOUR REAL DIRECTORY NAMES.
Thanks again.
Joel Cass
Unfortunately I tried creating a CFC outside the web root defined in the installation, creating a virtual directory in IIS and then (after error) creating a mapping in the administrator.
It does not work. It is impossible. All I got were "java skeleton error" this and "invalid data type" that.
I got the CFC going after abstracting it to a service placed in the web root.
I see this issue as either a bug or a limitation. Don't go all pointy haired on us and call it a "feature" - It would be good if a CFC could be created and invoked outside the defined web directory, just for security's sake.
Esref Atak
This error is a datatype validation result really. All functions results must valid and living. Because, when the page requested via
http://...?wsdl
server does a validation. Specifically, please check function that it return a component.
Aaron Foote
I receved a related error. I had a mapping /foo pointing to a few levels above the webroot (eg /foo -> c:\inetpub | IIS Website @ c:\inetpub\wwwroot) I moved the WebService to be outside the mapping and it all magicaly worked
Thanks for the post, it pointed me in the right direction