Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
rmminusrfslash #1
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
-
#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: ... -
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... -
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... -
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... -
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... -
rmminusrfslash #2
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



Reply With Quote

