3 Replies Latest reply on Jul 23, 2006 5:35 PM by jeffdonthemic

    BUG? CF7.0.2, Webservices


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


      Here is the CFC call:

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

      <!--- This does NOT work --->
      users = CreateObject("webservice","#wsURL#");
      a = users.getUsers();

      <cfdump var="#a#">

      <!--- This DOES work --->
      users = CreateObject("component","someDirA.someDirB.userService");
      a = users.getUsers();

      <cfdump var="#a#">

      ERROR MSG:
      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<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.


        • 1. Re: BUG? CF7.0.2, Webservices
          The problem might be that you need to expose information about your "User" type. Make sure your "User" component has cfproperty tags defining the fields that you set into it (id, fname, lname, email).
          Also whenever our webservices return an array of a custom type (like "User"), we also put in the webservice component a function called "get<custom component>Type" (e.g. "getUserType") with a returntype of "User" which just creates a "User" component and returns it. This will cause details about the "User" type to be included in the WSDL which then allows the custom type to be handled/parsed more appropriately by clients of the webservice.

          • 2. Re: BUG? CF7.0.2, Webservices
            Fernis Level 3
            I don't know if this helps your case, but I've run into several clear bugs in CFMX 7.0.1 and CFMX7.0.2(beta 3) with web services. It's about registering and invoking the web services, since they run okay on WebLogic 8.1SP5, and are thoroughly multiplatform-tested (Java, Jsp, .NET). The web services are purely J2EE/Java-based, no CF involved.

            Case 1:
            You register a web-service A on server A - which works. Then you try to register an identical web service (of course with a different alias/name) on server B, but no, it doesn't work without restarting the CF Server first.

            Case 2:
            Let's clear all the web services and restart CF Server again. Now, to verify the behaviour, let's register a web service on machine B. OK, fine. And let's register again the first web service on Server A. Won't work without restarting CF.

            Case 3:
            Having restarted CF several times, registering the two (actually three now web services, calling any method from server A works. Let's try to call any method from B or C. Crash. Stack trace. Boom.

            Case 4, 5.... Let's start invoking from B or C. The first invoked server always works, the rest don't. Have to restart CF always between the invocations.

            It's driving me nuts, rendering the whole web services feature partially unusable with ColdFusion.

            I've left a few bug reports to Adobe a couple weeks ago, so sopefully we'll see a hotfix or something in the near future.

            If you recognized any of these scenarios in Your case, you might want to suspect CF. Tell us was it in your code?
            • 3. Re: BUG? CF7.0.2, Webservices
              I'm having the same problem as outlined above with the same error message. I'm returning an array of complex Java types, not CFCs. It works well when returning a string or int.

              I'm running 7.0.2. Any ideas since this makes the web service unusable for CF.