Error with extended components and web services on CF7

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Error with extended components and web services on CF7

    I'm creating a base object then subclassing off of that using 'extends'. I
    then use the subclassed type to act as a return object in webservices. When i
    use the get methods created in the returned java object, i can access the
    sub-object elements, but the base object elements are returned as nulls. I
    wasn't seeing this behavior prior to the move to CF7. I can use invoke to call
    the object and everything returns fine, but when it goes through webservices,
    the values are gone. Anyone have any ideas - you should be able to recreate
    using the attached code. Thank You!



    <!--- baseObject.cfc --->
    <cfcomponent>
    <!--- some base properties --->
    <cfproperty name="TestID" type="numeric" hint="This is a test id">
    <cfproperty name="TestName" type="string" hint="This is a test name">
    </cfcomponent>

    <!--- extendedObject.cfc --->
    <cfcomponent extends="baseObject">
    <cfproperty name="TestColor" hint="This is some color" type="string">
    </cfcomponent>

    <!--- extendTest.cfc --->
    <cfcomponent name="extendTest">
    <cfset testFunc() />

    <cffunction name="testFunc" hint="this is a test func" access="remote"
    output="false" returntype="extendedObject">
    <cfset var newVar=structNew() />

    <cfset newVar.myObject = createObject("component", "extendedObject")>
    <cfset newVar.myObject.TestID="1234" />
    <cfset newVar.myObject.TestName="This is the test Name." />
    <cfset newVar.myObject.TestColor="Red" />
    <cfreturn newVar.myObject />
    </cffunction>

    </cfcomponent>

    <!--- extendExample.cfm --->
    <html>
    <head>
    <title>Extends Breaking</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>

    <cfinclude template="soapudfs.cfc">

    <cfinvoke component="extendTest"
    method="testFunc"
    returnVariable="thisTestFunc">

    <strong>This is a dump of the returnVariable and its data members from
    extendTest.testFunc - displays fine -</strong><br>
    <cfdump var="#thisTestFunc#"><br>
    <cfdump var="#thisTestFunc.TestColor#"><br>
    <cfdump var="#thisTestFunc.TestName#"><br>
    <cfdump var="#thisTestFunc.TestID#"><p>

    <cfscript>
    // Call Webservices
    myWebservice = createObject('webservice',
    'http://atdev.createit.com/break_extends/extendTest.cfc?wsdl');
    javaStruct=myWebservice.testFunc();
    </cfscript>

    <!--- the dump of the entire object works --->
    <strong>This is a dump of the struct that webservice.testFunc() returns -
    displays fine -</strong><br>
    <cfdump var="#javaStruct#"><p>

    <!--- the dump of the get method created for the extended object works --->
    <strong>This is a dump of the getTestColor method from the extended class
    - displays fine -</strong><br>
    <cfdump var="#javaStruct.getTestColor()#"><p>

    <cfoutput>
    <!--- the get method of the extended object works --->
    <strong>color displays</strong><br>
    The color is #javaStruct.getTestColor()#<p>

    <!--- the get methods of the base object don't work - they return null --->
    <strong>name and id don't</strong><br>
    The name is #javaStruct.getTestName()#<br>
    The id is #javaStruct.getTestID()#<p>
    </cfoutput>

    <!--- this errors with "Attribute validation error. The tag requires the
    attribute var." --->
    <strong>This is a dump of the getTestName and getTestID funcs from the
    base class - errors out</strong><br>
    <cfdump var="#javaStruct.getTestName()#"><br>
    <cfdump var="#javaStruct.getTestID()#"><br>

    </body>
    </html>

    rmminusrfslash Guest

  2. Similar Questions and Discussions

    1. #39532 [NEW]: Error in acess a private attribute in a extended method
      From: thiago dot henrique dot mata at gmail dot com Operating system: Windows Xp Professional PHP version: 5.2.0 PHP Bug Type: ...
    2. Identity while calling Components in Web Services
      Have you considered taking a different approach: use authorized SQL credentials to load and run the DTS package using DSO. You could insert code...
    3. Fonts installed via terminal services are not available to components
      I've just spent a couple days discovering a bug. I didnt know how to submit it to MS, so I'll just post it here. I had my host install a font on...
    4. Inspectable properties for Extended Components
      I am trying to create some V2 standard components by extending TextInput, Combobox and UIComponent. Are the inspectable properties expected to be...
    5. odd loading error, missing components on load
      I've a movie that has multiple frames as steps or processes. When the movie loads, most of the components of step 2 fail to load, and you can't...
  3. #2

    Default Error with extended components and web services on CF7

    I'm creating a base object then subclassing off of that using 'extends'. I
    then use the subclassed type to act as a return object in webservices. When i
    use the get methods created in the returned java object, i can access the
    sub-object elements, but the base object elements are returned as nulls. I
    wasn't seeing this behavior prior to the move to CF7. I can use invoke to call
    the object and everything returns fine, but when it goes through webservices,
    the values are gone. Anyone have any ideas - you should be able to recreate
    using the attached code. Thank You!

    <!--- baseObject.cfc --->
    <cfcomponent>
    <!--- some base properties --->
    <cfproperty name="TestID" type="numeric" hint="This is a test id">
    <cfproperty name="TestName" type="string" hint="This is a test name">
    </cfcomponent>

    <!--- extendedObject.cfc --->
    <cfcomponent extends="baseObject">
    <cfproperty name="TestColor" hint="This is some color" type="string">
    </cfcomponent>

    <!--- extendTest.cfc --->
    <cfcomponent name="extendTest">
    <cfset testFunc() />

    <cffunction name="testFunc" hint="this is a test func" access="remote"
    output="false" returntype="extendedObject">
    <cfset var newVar=structNew() />

    <cfset newVar.myObject = createObject("component", "extendedObject")>
    <cfset newVar.myObject.TestID="1234" />
    <cfset newVar.myObject.TestName="This is the test Name." />
    <cfset newVar.myObject.TestColor="Red" />
    <cfreturn newVar.myObject />
    </cffunction>

    </cfcomponent>

    <!--- extendExample.cfm --->
    <html>
    <head>
    <title>Extends Breaking</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body>

    <cfinclude template="soapudfs.cfc">

    <cfinvoke component="extendTest"
    method="testFunc"
    returnVariable="thisTestFunc">

    <strong>This is a dump of the returnVariable and its data members from
    extendTest.testFunc - displays fine -</strong><br>
    <cfdump var="#thisTestFunc#"><br>
    <cfdump var="#thisTestFunc.TestColor#"><br>
    <cfdump var="#thisTestFunc.TestName#"><br>
    <cfdump var="#thisTestFunc.TestID#"><p>

    <cfscript>
    // Call Webservices
    myWebservice = createObject('webservice',
    'http://www.yourdomain.com/break_extends/extendTest.cfc?wsdl');
    javaStruct=myWebservice.testFunc();
    </cfscript>

    <!--- the dump of the entire object works --->
    <strong>This is a dump of the struct that webservice.testFunc() returns -
    displays fine -</strong><br>
    <cfdump var="#javaStruct#"><p>

    <!--- the dump of the get method created for the extended object works --->
    <strong>This is a dump of the getTestColor method from the extended class
    - displays fine -</strong><br>
    <cfdump var="#javaStruct.getTestColor()#"><p>

    <cfoutput>
    <!--- the get method of the extended object works --->
    <strong>color displays</strong><br>
    The color is #javaStruct.getTestColor()#<p>

    <!--- the get methods of the base object don't work - they return null --->
    <strong>name and id don't</strong><br>
    The name is #javaStruct.getTestName()#<br>
    The id is #javaStruct.getTestID()#<p>
    </cfoutput>

    <!--- this errors with "Attribute validation error. The tag requires the
    attribute var." --->
    <strong>This is a dump of the getTestName and getTestID funcs from the
    base class - errors out</strong><br>
    <cfdump var="#javaStruct.getTestName()#"><br>
    <cfdump var="#javaStruct.getTestID()#"><br>

    </body>
    </html>

    rmminusrfslash Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139