Copy link to clipboard
Copied
I'm trying to build a very basic web service that will sit on a remote server and query the live database
<cfcomponent displayName="invoiceUtilities" output="false">
<cffunction name="getInvoiceDetailsFromWebService" returnType="Query" access="remote" output="false">
<cfargument name="invoiceDetailId" type="String" required="true">
<cfquery datasource="#dataSource#" name="invoiceQuery">
SELECT invoiceId,productType
FROM InvoiceDetails
WHERE InvoiceDetailId='#invoiceDetailId#'
</cfquery>
<cfreturn invoiceQuery/>
</cffunction>
</cfcomponent>
Currently whilst I'm testing it - it is sat within a different application (as it would be normally) but on my dev server on my box
I can access the WSDL via the browser but when I try and call it from my application - I get the following error:
Cannot generate stub objects for web service invocation. | |
Name: http://localhost:8500/llsintranet/hip_view_657836ty/invoiceUtilities.cfc?wsdl. WSDL: http://localhost:8500/llsintranet/hip_view_657836ty/invoiceUtilities.cfc?wsdl. org.apache.axis.wsdl.toJava.DuplicateFileException: Duplicate file name: C:\ColdFusion9\stubs\WS306957249\llsintranet\hip_view_657836ty\InvoiceUtilities.java. Hint: you may have mapped two namespaces with elements of the same name to the same package name. It is recommended that you use a web browser to retrieve and examine the requested WSDL document to ensure it is correct. If the requested WSDL document cannot be retrieved or is dynamically generated, it is likely that the target web service has programming errors. |
This is the WSDL:
Copy link to clipboard
Copied
The very first thing I ALWAYS do when ever I see that "Cannot generate stub objects for web service invocation." is to go into the ColdFusion administrator under the web service tab and delete any related web service defined there.
This can be caused by CF caching an out of date WSDL and deleting the old one and letting a new one get created and clear this up.
Copy link to clipboard
Copied
I would have done that but there is nothing defined in the ColdFusion Administration Web Services tab at all - Do you know where it might be physically cached ?
I'll go for a hunt anyway
Thanks for a possible clue
Copy link to clipboard
Copied
The next most common issue after caching outdated WSDL data, is an Application.cfm or Application.cfc file breaking the web service request.
If either an Application.cfm OR an Application.cfc OnRequest method are in play and they insert extra text, even white space, this will break the web service request and prevent them from working correctly.
Copy link to clipboard
Copied
Thanks for that pointer - however I've moved everything out of Application.cfm to Application.cfc->onSessionStart and it's not made any difference to the errors I'm getting - This is very frustrating because the web service is key to me getting this problem sorted out - I have to be able to make a remote call to the external server to query the live database
Copy link to clipboard
Copied
Do not forget that more often than not each webservice request will create a new session (and will run onSessionStart()) if it invokes standard Application.cfc(cfm)...
I tend to create a separate Application.cfc(cfm) in webservices dir to do exactly what I need it to do.
Copy link to clipboard
Copied
Joannecorless,
Coldfusion did give you a hint which has apparently been ignored so far. Here it is:
"Duplicate file name: C:\ColdFusion9\stubs\WS306957249\llsintranet\hip_view_657836ty\InvoiceUtilities.java. Hint: you may have mapped two namespaces with elements of the same name to the same package name."
Copy link to clipboard
Copied
Hi,
im runing into the same issue : (
i was wondering if you were able to fix yours ?
i am using : CF 8,0,1,195765 along with HotFix3 (JVM: 1.6.0_14)
thaaks for the help in advance.
Regards
M
Copy link to clipboard
Copied
Your datasource variable is not defined.
Troubleshooting webservice problems is easier by invoking them as components until they work perfectly. Then, any problems regarding invoking them as webservices is not likely to be caused by the component.
Copy link to clipboard
Copied
Thanks Dan for the update,
my component is working perfectly when calling it localy,
and if i rename it also i does work via webservice call (using <cfinvoke>)
it just not working now after we updated our CF 8 to CF 8.0.1
something is still cached somewhere, i tried deleting the /stub folder restarted the service still no luck : (
regards
M
Copy link to clipboard
Copied
Try removing the attribute “displayname” from the <cfcomponent> tag.
Copy link to clipboard
Copied
Removing the attribute "displayname" worked for me. Can anyone explain why?