Actionscript 无法在FlexBuilder中获取RemoteObject调用以使用ColdFusion

Actionscript 无法在FlexBuilder中获取RemoteObject调用以使用ColdFusion,actionscript,coldfusion,flexbuilder,remoteobject,Actionscript,Coldfusion,Flexbuilder,Remoteobject,当我尝试在CFC中调用这个简单的函数时,在正确的远程设置下,我得到一个错误 “目标“ColdFusion”不存在,或者目标没有定义通道,并且应用程序没有定义任何默认通道。” 这是CFC,虽然我99%确定它不存在问题,但非常简单 <cfcomponent output="false"> <!--- Get Server Time ---> <cffunction name="getServerTime" access="remote" returnT

当我尝试在CFC中调用这个简单的函数时,在正确的远程设置下,我得到一个错误

“目标“ColdFusion”不存在,或者目标没有定义通道,并且应用程序没有定义任何默认通道。”

这是CFC,虽然我99%确定它不存在问题,但非常简单

<cfcomponent output="false">

    <!--- Get Server Time --->
    <cffunction name="getServerTime" access="remote" returnType="string">
       <cfreturn now() />
    </cffunction>

    <cffunction name="getString" access="remote" returnType="string">
        <cfreturn "hello......" />
    </cffunction>

</cfcomponent>

这是包含远程调用的main.mxml文件

<?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" viewSourceURL="srcview/index.html" applicationComplete="init()">

<mx:Script>
    <![CDATA[
        import mx.rpc.events.ResultEvent;
        import mx.controls.Alert;

        public function init():void{
          Alert.show(conn.getString());
        }

        public function eventResultHandler(event:ResultEvent):void{
            lblStringResult.text = event.result as String;                 
        }

    ]]>
</mx:Script>

<mx:RemoteObject id="conn" destination="ColdFusion" source="DemoCFC"
    result="eventResultHandler(event)" showBusyCursor="true" >
</mx:RemoteObject>


<mx:Label id="lblStringResult" y="10" horizontalCenter="0"/> 

<mx:Button label="Server Time?.." click="conn.getServerTime();" y="36" horizontalCenter="0" />

</mx:Application>

这是WEB-INF\flex文件夹根目录中的services.xml文件。我为这份冗长乏味的文件道歉,但我认为问题可能就在其中


假的
假的
真的
遥远的
真的
假的
假的
loadProxy
假的
假的
假的
真的
8.
假的
真的
遥远的
真的
假的
假的
loadProxy
假的
假的
假的
假的
假的
假的
真的
遥远的
真的
假的
假的
loadProxy
假的
假的
假的
真的
8.
[布莱兹]
假的
假的
假的
假的
终点*
服务*
配置
信息*
假的

这是远程处理config.xml文件

<?xml version="1.0" encoding="UTF-8"?>


*

当main.mxml文件编译并运行时,返回并显示对init()方法的调用,该方法使用远程对象连接调用getString()方法

警报框中的“[object AsyncToken]”。

如果单击该按钮,我将调用getServerTime()方法并尝试在mxml标签中显示服务器时间,但只获取

如果我浏览到,我会得到一个白色页面。根据我遇到的一些线程,这应该是一件好事,试图解决这个问题

main.mxml文件和cfc位于项目中的同一文件夹中。所以我知道远程电话正在寻找cfc


我很确定问题出在ColdFusion的配置中,因为这是一个非常简单的请求。

您上面的XML文件是services-config.XML,但是您在remoting-config.XML文件中设置了目标。。。见下文:

<service id="remoting-service" class="flex.messaging.services.RemotingService">
<adapters>
    <adapter-definition id="cf-object" class="railo.runtime.net.flex.RailoAdapter" default="true"/>
    <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter"/>
</adapters> 
<default-channels>
    <channel ref="my-cfamf"/>
    <channel ref="classic-cfamf"/>
</default-channels>

<destination id="ColdFusion">
    <channels>
        <channel ref="my-cfamf"/>
    </channels>
    <properties>
        <source>*</source>
        <!-- define the resolution rules and access level of the cfc being invoked -->
        <access>
            <!-- Use the ColdFusion mappings to find CFCs, by default only CFC files under your webroot can be found. -->
            <use-mappings>true</use-mappings>
            <!-- allow "public and remote" or just "remote" methods to be invoked -->
            <method-access-level>remote</method-access-level>
        </access>
        <property-case>
            <!-- cfc property names -->
            <force-cfc-lowercase>false</force-cfc-lowercase>
            <!-- Query column names -->
            <force-query-lowercase>false</force-query-lowercase>
            <!-- struct keys -->
            <force-struct-lowercase>false</force-struct-lowercase>
        </property-case>
    </properties>
</destination>
</service>

*
真的
遥远的
假的
假的
假的
检查WEB-INF/flex文件夹中的此文件,并确保已设置ColdFusion目标,并且已从上面的services-config.xml文件中设置了要使用的相应通道

很抱歉回复太长,但我想发布我的service-config.xml文件,以便您可以看到它们是如何协同工作的:

<services-config>

<services>
    <service-include file-path="remoting-config.xml" />
    <service-include file-path="proxy-config.xml" />
    <service-include file-path="messaging-config.xml" />        
</services>

<security>
    <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/>
</security>

<channels>

    <!-- CF -->
    <channel-definition id="my-cfamf" class="mx.messaging.channels.AMFChannel">
        <endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>
        <properties>
            <polling-enabled>false</polling-enabled>
            <serialization>
                <instantiate-types>false</instantiate-types>
            </serialization>
        </properties>
    </channel-definition>

    <channel-definition id="classic-cfamf" class="mx.messaging.channels.AMFChannel">
        <endpoint uri="http://{server.name}:{server.port}{context.root}/flashservices/gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>
        <properties>
            <polling-enabled>false</polling-enabled>
            <serialization>
                <instantiate-types>false</instantiate-types>
            </serialization>
        </properties>
    </channel-definition>

    <channel-definition id="cf-polling-amf" class="mx.messaging.channels.AMFChannel">
        <endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/cfamfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
        <properties>
            <polling-enabled>true</polling-enabled>
            <polling-interval-seconds>8</polling-interval-seconds>
            <serialization>
                <instantiate-types>false</instantiate-types>
            </serialization>
        </properties>
    </channel-definition>

    <channel-definition id="my-cfamf-secure" class="mx.messaging.channels.SecureAMFChannel">
        <endpoint uri="https://{server.name}:{server.port}{context.root}/flex2gateway/cfamfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
        <properties>
            <polling-enabled>false</polling-enabled>
            <add-no-cache-headers>false</add-no-cache-headers>
            <serialization>
                <instantiate-types>false</instantiate-types>
            </serialization>
        </properties>
    </channel-definition>

    <!-- Java -->
    <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
        <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
    </channel-definition>

    <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
        <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
        <properties>
            <add-no-cache-headers>false</add-no-cache-headers>
        </properties>
    </channel-definition>

    <channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
        <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
        <properties>
            <polling-enabled>true</polling-enabled>
            <polling-interval-seconds>4</polling-interval-seconds>
        </properties>
    </channel-definition>

    <channel-definition id="my-streaming-amf" class="mx.messaging.channels.StreamingAMFChannel">
      <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure/streamingamf" class="flex.messaging.endpoints.StreamingAMFEndpoint" /> 
      <properties>
        <idle-timeout-minutes>0</idle-timeout-minutes> 
        <max-streaming-clients>100</max-streaming-clients> 
        <server-to-client-heartbeat-millis>5000</server-to-client-heartbeat-millis> 
        <user-agent-settings>
          <user-agent match-on="MSIE" kickstart-bytes="2048" max-streaming-connections-per-session="5" /> 
          <user-agent match-on="Firefox" kickstart-bytes="2048" max-streaming-connections-per-session="5" /> 
          <user-agent match-on="Safari" kickstart-bytes="2048" max-streaming-connections-per-session="5" />
          <user-agent match-on="Opera" kickstart-bytes="2048" max-streaming-connections-per-session="5" />  
        </user-agent-settings>
      </properties>
    </channel-definition>

    <channel-definition id="java-http" class="mx.messaging.channels.HTTPChannel">
        <endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/http" class="flex.messaging.endpoints.HTTPEndpoint"/>
    </channel-definition>

    <channel-definition id="java-secure-http" class="mx.messaging.channels.SecureHTTPChannel">
        <endpoint uri="https://{server.name}:{server.port}{context.root}/flex2gateway/httpsecure" class="flex.messaging.endpoints.SecureHTTPEndpoint"/>
    </channel-definition>
</channels>

<logging>
    <target class="flex.messaging.log.ConsoleTarget" level="Error">
        <properties>
            <prefix>[BlazeDS] </prefix>
            <includeDate>false</includeDate>
            <includeTime>false</includeTime>
            <includeLevel>false</includeLevel>
            <includeCategory>false</includeCategory>
        </properties>
        <filters>
            <pattern>Endpoint.*</pattern>
            <pattern>Service.*</pattern>
            <pattern>Configuration</pattern>
        </filters>
    </target>
</logging>

<system>
    <redeploy>
        <enabled>false</enabled>
    </redeploy>
</system>

</services-config>

假的
假的
假的
假的
真的
8.
假的
假的
假的
假的
假的
真的
4.
0
100
5000
[布莱兹]
假的
假的
假的
假的
终点*
服务*
配置
假的

craig-感谢您的输入,这是services-config.xml文件。我添加了我当前的remote-services.xml文件。如您所见,services.config.xml文件(channel definition id=“my cfamf”)中有一个频道定义id,remote-config.xml文件()中有一个匹配的频道id。James-我是个白痴(大多数时候:)
<service id="remoting-service" class="flex.messaging.services.RemotingService">
<adapters>
    <adapter-definition id="cf-object" class="railo.runtime.net.flex.RailoAdapter" default="true"/>
    <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter"/>
</adapters> 
<default-channels>
    <channel ref="my-cfamf"/>
    <channel ref="classic-cfamf"/>
</default-channels>

<destination id="ColdFusion">
    <channels>
        <channel ref="my-cfamf"/>
    </channels>
    <properties>
        <source>*</source>
        <!-- define the resolution rules and access level of the cfc being invoked -->
        <access>
            <!-- Use the ColdFusion mappings to find CFCs, by default only CFC files under your webroot can be found. -->
            <use-mappings>true</use-mappings>
            <!-- allow "public and remote" or just "remote" methods to be invoked -->
            <method-access-level>remote</method-access-level>
        </access>
        <property-case>
            <!-- cfc property names -->
            <force-cfc-lowercase>false</force-cfc-lowercase>
            <!-- Query column names -->
            <force-query-lowercase>false</force-query-lowercase>
            <!-- struct keys -->
            <force-struct-lowercase>false</force-struct-lowercase>
        </property-case>
    </properties>
</destination>
</service>
<services-config>

<services>
    <service-include file-path="remoting-config.xml" />
    <service-include file-path="proxy-config.xml" />
    <service-include file-path="messaging-config.xml" />        
</services>

<security>
    <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/>
</security>

<channels>

    <!-- CF -->
    <channel-definition id="my-cfamf" class="mx.messaging.channels.AMFChannel">
        <endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>
        <properties>
            <polling-enabled>false</polling-enabled>
            <serialization>
                <instantiate-types>false</instantiate-types>
            </serialization>
        </properties>
    </channel-definition>

    <channel-definition id="classic-cfamf" class="mx.messaging.channels.AMFChannel">
        <endpoint uri="http://{server.name}:{server.port}{context.root}/flashservices/gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>
        <properties>
            <polling-enabled>false</polling-enabled>
            <serialization>
                <instantiate-types>false</instantiate-types>
            </serialization>
        </properties>
    </channel-definition>

    <channel-definition id="cf-polling-amf" class="mx.messaging.channels.AMFChannel">
        <endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/cfamfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
        <properties>
            <polling-enabled>true</polling-enabled>
            <polling-interval-seconds>8</polling-interval-seconds>
            <serialization>
                <instantiate-types>false</instantiate-types>
            </serialization>
        </properties>
    </channel-definition>

    <channel-definition id="my-cfamf-secure" class="mx.messaging.channels.SecureAMFChannel">
        <endpoint uri="https://{server.name}:{server.port}{context.root}/flex2gateway/cfamfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
        <properties>
            <polling-enabled>false</polling-enabled>
            <add-no-cache-headers>false</add-no-cache-headers>
            <serialization>
                <instantiate-types>false</instantiate-types>
            </serialization>
        </properties>
    </channel-definition>

    <!-- Java -->
    <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
        <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
    </channel-definition>

    <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
        <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
        <properties>
            <add-no-cache-headers>false</add-no-cache-headers>
        </properties>
    </channel-definition>

    <channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
        <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
        <properties>
            <polling-enabled>true</polling-enabled>
            <polling-interval-seconds>4</polling-interval-seconds>
        </properties>
    </channel-definition>

    <channel-definition id="my-streaming-amf" class="mx.messaging.channels.StreamingAMFChannel">
      <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure/streamingamf" class="flex.messaging.endpoints.StreamingAMFEndpoint" /> 
      <properties>
        <idle-timeout-minutes>0</idle-timeout-minutes> 
        <max-streaming-clients>100</max-streaming-clients> 
        <server-to-client-heartbeat-millis>5000</server-to-client-heartbeat-millis> 
        <user-agent-settings>
          <user-agent match-on="MSIE" kickstart-bytes="2048" max-streaming-connections-per-session="5" /> 
          <user-agent match-on="Firefox" kickstart-bytes="2048" max-streaming-connections-per-session="5" /> 
          <user-agent match-on="Safari" kickstart-bytes="2048" max-streaming-connections-per-session="5" />
          <user-agent match-on="Opera" kickstart-bytes="2048" max-streaming-connections-per-session="5" />  
        </user-agent-settings>
      </properties>
    </channel-definition>

    <channel-definition id="java-http" class="mx.messaging.channels.HTTPChannel">
        <endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/http" class="flex.messaging.endpoints.HTTPEndpoint"/>
    </channel-definition>

    <channel-definition id="java-secure-http" class="mx.messaging.channels.SecureHTTPChannel">
        <endpoint uri="https://{server.name}:{server.port}{context.root}/flex2gateway/httpsecure" class="flex.messaging.endpoints.SecureHTTPEndpoint"/>
    </channel-definition>
</channels>

<logging>
    <target class="flex.messaging.log.ConsoleTarget" level="Error">
        <properties>
            <prefix>[BlazeDS] </prefix>
            <includeDate>false</includeDate>
            <includeTime>false</includeTime>
            <includeLevel>false</includeLevel>
            <includeCategory>false</includeCategory>
        </properties>
        <filters>
            <pattern>Endpoint.*</pattern>
            <pattern>Service.*</pattern>
            <pattern>Configuration</pattern>
        </filters>
    </target>
</logging>

<system>
    <redeploy>
        <enabled>false</enabled>
    </redeploy>
</system>

</services-config>