I have a webservice that I invoke on the page using a CFC, from the cfc I <cfreturn var="xmlContent">
XmlContent being <cfset XmlContent = xmlParse(XmlContent)> the content of the xml is passed in this variable to the page that invokes the component, then on that page I am currently extracting the information from the xml variable to show results on the screen:
<cfset xmlTitleNode = XmlContent.xmlroot.XmlText.XmlText>
<cfset numberOfItems = #ArrayLen(xmlTitleNode)#>
<cfloop from="1" to="#numberOfItems#" index="i">
<cfset 1stItem = #xmlTitleNode.XmlAttributes.1stItem#>
<cfoutput>
#1stItem#
</cfoutput>
</cfloop>
This works very well for each page that needs results from the CFC, but I would like to add these to a CFC so I don't need to set them up on each output page:
#get1stItem()#
Is this possible? Am a little green around the gills when it comes to passing values back from CFC's so would appreciate some help here please. Am using CFMX 6.1
Thanks
MW
XmlContent being <cfset XmlContent = xmlParse(XmlContent)> the content of the xml is passed in this variable to the page that invokes the component, then on that page I am currently extracting the information from the xml variable to show results on the screen:
<cfset xmlTitleNode = XmlContent.xmlroot.XmlText.XmlText>
<cfset numberOfItems = #ArrayLen(xmlTitleNode)#>
<cfloop from="1" to="#numberOfItems#" index="i">
<cfset 1stItem = #xmlTitleNode.XmlAttributes.1stItem#>
<cfoutput>
#1stItem#
</cfoutput>
</cfloop>
This works very well for each page that needs results from the CFC, but I would like to add these to a CFC so I don't need to set them up on each output page:
#get1stItem()#
Is this possible? Am a little green around the gills when it comes to passing values back from CFC's so would appreciate some help here please. Am using CFMX 6.1
Thanks
MW