Could not generate stub objects for web service invocation.

God to I hate this message. There are a 1,001 questions about the cause of this message on the CF 6.1 livedocs for the tag, and none of them have the right answer for my situation. Whats more, I can't find anyone who does have a good solution for CF 7.0 or any version. Click more to read my tale of woe.

My Situation

I am deploying a web service to handle connecting to and closing out logins between applications. This is on a Windows setup, using CF 7.0.2 I successfully built a demonstration of the functionality, connecting from my main app to one of my sub-apps, we will call it "Products", and back. I then copied the CFC file to sub-app2, "Calendar"... and then I get the dreaded "Could not generate stub objects for web service invocation.". Same code, same server, same instance. I think, "ok, maybe there is some bad interaction with the application file." I remove the application file, same result. "Ok, there is something wrong in the code" I think to myself. I create a simple web service like the following:

<cfcomponent output="false">
    <cffunction name="Upper" access="remote" returntype="string">
        <cfargument name="input" type="string" required="true" />
        <cfreturn Ucase(arguments.input) />

Name it webbie.cfc and proceed to call it on Products and things work fine. Copy it to Calendar and once again "Could not generate stub objects for web service invocation." I've found advice telling me that my firewall blocks the JRun used to create the stub, but the stub was generated correctly for Products. I've seen advice telling me that I've messed up something with connecting to a WS over SSL, but there is no secure key involved.

I can browse to both WSDL files with out issue, and can log into the CFC to verify that it has no coding issues. What I did find though, was that there is a discrepancy with the generated WSDL file for Calendar:

Product's webbie.cfc?WSDL (fragment)

<wsdl:definitions targetNamespace="http://ws.cfc.ProductApplicationName" xmlns:apachesoap="" xmlns:impl="http://ws.cfc.ProductApplicationName" xmlns:intf="http://ws.cfc.ProductApplicationName" xmlns:soapenc="" xmlns:tns1="http://rpc.xml.coldfusion" xmlns:wsdl="" xmlns:wsdlsoap="" xmlns:xsd="">

Calendar's webbie.cfc?WSDL (fragment)

<wsdl:definitions targetNamespace="http://ws.cfc" xmlns:apachesoap="" xmlns:impl="http://ws.cfc" xmlns:intf="http://ws.cfc" xmlns:soapenc="" xmlns:tns1="http://rpc.xml.coldfusion" xmlns:wsdl="" xmlns:wsdlsoap="" xmlns:xsd="">

Notice that the WSDL for Product generated 'targetNamespace="http://ws.cfc.ProductApplicationName"' while Calendar generated 'targetNamespace="http://ws.cfc"'? Both have application names set. Both are at similar points in the directory structure... what makes one right?

I thought maybe the stub was corrupted or something so I tried:

<!--- Using the real URL of course --->
<cfset CreateObject( "java", "coldfusion.server.ServiceFactory" ).XmlRpcService.RefreshWebService(
) /

And... "Error, cannot construct stub."

Update: - Resolved. The "calendar" application file had login status checking going on in the onSessionStart method as well as the onRequestStart, unlike "products". Remove that code and things begin working fine again.



Jon Hartmann, July 2011

I'm Jon Hartmann and I'm a Javascript fanatic, UX/UI evangelist and former ColdFusion master. I blog about mysterious error messages, user interface design questions, and all things baffling and irksome about programming for the web.

Learn more about me.

Post a job. Find one.

Interested in becoming a sponsor? Contact me.