Note that there are some explanatory texts on larger screens.

plurals
  1. POColdfusion web service failing to see component
    primarykey
    data
    text
    <p>I've got a CFC that I'm going to access with ?wsdl as a SOAP webservice.</p> <p>If I call the CFC directly in a browser, my results render fine:</p> <pre><code>http://server/webservice/calc.cfc?method=doStuff&amp;foo=bar </code></pre> <p>If I try to access it as a web service:</p> <pre><code>ws = CreateObject("webservice", 'http://server/webservice/calc.cfc?wsdl'); result = ws.doStuff('bar'); </code></pre> <p>I get an error:</p> <pre><code>Cannot perform web service invocation doStuff. The fault returned when invoking the web service operation is: AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: coldfusion.xml.rpc.CFCInvocationException: [coldfusion.xml.rpc.CFCInvocationException : [java.lang.ClassNotFoundException : com.calculations.calc][java.lang.NullPointerException : null]] faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:coldfusion.xml.rpc.CFCInvocationException: [coldfusion.xml.rpc.CFCInvocationException : [java.lang.ClassNotFoundException : com.calculations.calc][java.lang.NullPointerException : null]] at coldfusion.xml.rpc.CFComponentSkeleton.__createCFCInvocationException(CFComponentSkeleton.java:733) at coldfusion.xml.rpc.CFComponentSkeleton.__convertOut(CFComponentSkeleton.java:359) at webservice.calc.doStuff(/var/www/vhosts/server/httpdocs/webservice/calc.cfc) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.r... '' </code></pre> <p>The problem is because the doStuff function is declaring an instance of a CFC inside it:</p> <pre><code>remote struct function doStuff(foo) { var objReturn = {}; objReturn.msg = 'A message'; // do a calculation var objCalc = new com.calculations.calc(foo); objReturn.calc = objCalc; return objReturn; } </code></pre> <p>So my CFC that I'm using as a webservice has got another CFC being declared inside a function. Browsing directly to my webservice CFC works fine, but trying to call it using the CreateObject/webservice route fails, as it can't create an instance of the <strong>com.calculations.calc</strong> component.</p> <p><strong>UPDATE:</strong></p> <p>If I refresh the page a few times, sometimes the error changes to:</p> <pre><code>AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: coldfusion.xml.rpc.CFCInvocationException: [coldfusion.xml.rpc.CFCInvocationException : [java.lang.ClassNotFoundException : com.calculations.calc][coldfusion.xml.rpc.CFCInvocationException : returnType must be defined for remote CFC functions.]] faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace:coldfusion.xml.rpc.CFCInvocationException: [coldfusion.xml.rpc.CFCInvocationException : [java.lang.ClassNotFoundException : com.calculations.calc][coldfusion.xml.rpc.CFCInvocationException : returnType must be defined for remote CFC functions.]] at coldfusion.xml.rpc.CFComponentSkeleton.__createCFCInvocationException(CFComponentSkeleton.java:733) at coldfusion.xml.rpc.CFComponentSkeleton.__convertOut(CFComponentSkeleton.java:359) at webservices.TaxCalc.feed.getTaxCalc(/var/www/vhosts/server/httpdocs/webservice/calc.cfc) at sun.reflect.Nat... '' </code></pre> <p>This is asking for a return type, but the init func of com.calculations.calc has <em>return this;</em></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload