Skip to main content
March 18, 2010
Question

Component define data types for Webservices [Incomplete Documentation]

  • March 18, 2010
  • 2 replies
  • 692 views

I been looking around the web and in safari for a good answer to this question I have about the documentation found at


http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=webservices_20.html


When I try and recreate these examples I get this error.


The component definition file for component 'name[]' cannot be found on this server.


Does anyone know where I can find a zip file of this example. I am having a bear of time getting array of types to return from a coldfusion webservice and hope to at the very least recreate what is found in the documentation. I know it must be something very simple that isn't clear in the documentation so any help would be great.

-Luke

    This topic has been closed for replies.

    2 replies

    ilssac
    Inspiring
    March 22, 2010

    Do you have a file named "name.cfc" somewhere accessible to the code that is trying to make an array of these objects?

    March 22, 2010

    Ok, So I got simple with this.

    I made a directory called dashboardwebservice/testme

    and I put in there two files.

    <!--- webservice2.cfc --->

    <cfcomponent style="document">   

      <cffunction
    name="allNames" returnType="name[]" access="remote" output="false">
        <cfset var returnarray = ArrayNew(1)>
        <cfset var temp = "">
        <cfloop index="loopi" from="1" to="5">
           <cfobject component="name" name="tempname">
           <cfset tempname.Firstname = "Firstname">
           <cfset tempname.Lastname = "LastName#loopi#">
           <cfset temp = ArrayAppend(returnarray, tempname)>
         </cfloop>
         <cfreturn returnarray>
        </cffunction>
       
    </cfcomponent>

    and

    <!--- webservice2.cfc --->

    <cfcomponent>
        <cfproperty name="Firstname" type="string">
        <cfproperty name="Lastname" type="string">
    </cfcomponent>

    This creates the error.

    Component not found

    The component definition file for component 'dashboardwebservice.testme.name[]' cannot be found on this server.

    I don't think it knows how to create the description for the web request because it is looking for a array of that object.

    ilssac
    Inspiring
    March 23, 2010

    The "type" of a CFC component is the file name of the component.

    So if you want to make an array of components of type name, i.e. returnType="name[]" Then you need a file called name.cfc in your file structure that can be found by the CF server.

    OR

    If you want to name your object webservice2.cfc you would need to be creating an array of 'webservice2' components.  i.e returnType="webservice2[]"

    March 19, 2010

    If no one has a zip file of working code. Does anyone have a book or website example that works doing something similiar?

    March 22, 2010

    Still searching on this.. am I in the correct form?

    I will happly post back the answer when found.