Question
BUG? CF7.0.2, Webservices
Hi,
This has to be either my coding error (most likely), or a bug in CF.
We are using CF 7+. I "CAN" see the WSDL file in the URL. My query does return data from the db. I can get the "webservice" to work when I return a string, a structure, or a query object. When I am trying to return this array it fails. The actual error message is at the "very" bottom of this post. Also, both cfc's are in the same directory as the calling file which in this case is just an index.cfm page. I can get it to work as a webservice, but not when I return a datatype of "array". The other CFC user.cfc just has some getters and setters.
The code runs perfectly as a component. I can return the array fine, but when its a webservice, the code does not work.
Here is the CFC
<cfcomponent output="false" name="userService.cfc">
<cffunction name="getUsers" access="remote" returntype="array">
<cfset var q = "" />
<cfset var a = arrayNew(1) />
<cfset var u = "" />
<cfquery name="q" datasource="mydsn">
SELECT *
FROM t_User
</cfquery>
<cfloop query="q">
<cfscript>
u = createObject("component","User");
u.setId(q.id);
u.setFname(q.fname);
u.setLname(q.lname);
u.setEmail(q.email);
arrayAppend(a,u);
</cfscript>
</cfloop>
<cfreturn a />
</cffunction>
</cfcomponent>
Here is the CFC call:
<cfset wsURL = " http://localhost:8500/someDirA/someDirB/userService.cfc?wsdl" />
<!--- This does NOT work --->
<cfscript>
users = CreateObject("webservice","#wsURL#");
a = users.getUsers();
</cfscript>
<cfdump var="#a#">
<!--- This DOES work --->
<cfscript>
users = CreateObject("component","someDirA.someDirB.userService");
a = users.getUsers();
</cfscript>
<cfdump var="#a#">
ERROR MSG:
Could not perform web service invocation "getUsers".
Here is the fault returned when invoking the web service operation:
AxisFault
faultCode: { http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXParseException: Premature end of file.
faultActor:
faultNode:
faultDetail:
{ http://xml.apache.org/axis/}stackTrace<img src="/webforums/forum/images/i/expressions/face-icon-small-blush.gif" border="0">rg.xml.sax.SAXParseException: Premature end of file.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(S...
If anyone can assist, this would be greatly appreciated.
Thanks
-ws
This has to be either my coding error (most likely), or a bug in CF.
We are using CF 7+. I "CAN" see the WSDL file in the URL. My query does return data from the db. I can get the "webservice" to work when I return a string, a structure, or a query object. When I am trying to return this array it fails. The actual error message is at the "very" bottom of this post. Also, both cfc's are in the same directory as the calling file which in this case is just an index.cfm page. I can get it to work as a webservice, but not when I return a datatype of "array". The other CFC user.cfc just has some getters and setters.
The code runs perfectly as a component. I can return the array fine, but when its a webservice, the code does not work.
Here is the CFC
<cfcomponent output="false" name="userService.cfc">
<cffunction name="getUsers" access="remote" returntype="array">
<cfset var q = "" />
<cfset var a = arrayNew(1) />
<cfset var u = "" />
<cfquery name="q" datasource="mydsn">
SELECT *
FROM t_User
</cfquery>
<cfloop query="q">
<cfscript>
u = createObject("component","User");
u.setId(q.id);
u.setFname(q.fname);
u.setLname(q.lname);
u.setEmail(q.email);
arrayAppend(a,u);
</cfscript>
</cfloop>
<cfreturn a />
</cffunction>
</cfcomponent>
Here is the CFC call:
<cfset wsURL = " http://localhost:8500/someDirA/someDirB/userService.cfc?wsdl" />
<!--- This does NOT work --->
<cfscript>
users = CreateObject("webservice","#wsURL#");
a = users.getUsers();
</cfscript>
<cfdump var="#a#">
<!--- This DOES work --->
<cfscript>
users = CreateObject("component","someDirA.someDirB.userService");
a = users.getUsers();
</cfscript>
<cfdump var="#a#">
ERROR MSG:
Could not perform web service invocation "getUsers".
Here is the fault returned when invoking the web service operation:
AxisFault
faultCode: { http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXParseException: Premature end of file.
faultActor:
faultNode:
faultDetail:
{ http://xml.apache.org/axis/}stackTrace<img src="/webforums/forum/images/i/expressions/face-icon-small-blush.gif" border="0">rg.xml.sax.SAXParseException: Premature end of file.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(S...
If anyone can assist, this would be greatly appreciated.
Thanks
-ws