CF WEBSERVICES  BUG?  Can't return an array from a CFC?

Posted on 2006-05-21
Medium Priority
Last Modified: 2013-12-24

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 dat.a  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".

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
            <cfloop query="q">
                        u = createObject("component","User");
            <cfreturn a />

Here is the CFC call:

<cfset wsURL = "http://localhost:8500/someDirA/someDirB/userService.cfc?wsdl" />

      users = CreateObject("webservice","#wsURL#");
      a = users.getUsers();

<cfdump var="#a#">

Could not perform web service invocation "getUsers".  
Here is the fault returned when invoking the web service operation:

 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultString: org.xml.sax.SAXParseException: Premature end of file.
      {http://xml.apache.org/axis/}stackTrace:org.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.



Question by:Westside2004
1 Comment

Accepted Solution

ExpertAdmin earned 2000 total points
ID: 16756180
This is just a guess, but if you are using Internet Explorer to test the WSDL, you may be missing a syntax problem that exists in the return XML. IE is famous for "nice" rendering where a closing tag is omitted. I would test it with Firefox or Opera and see if it still looks the same. I have a feeling this will show you where the problem is.


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
What You Need to Know when Searching for a Webhost Provider
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question