Visual studio code 如何将AMFPHP与Apache Royale一起使用
我在使用Visual studio code 如何将AMFPHP与Apache Royale一起使用,visual-studio-code,amfphp,apache-royale,Visual Studio Code,Amfphp,Apache Royale,我在使用SimpleRemoteObject时遇到问题。(sdk 0.9.6) 我的实际网站正在使用此代码调用Amfphp的远程功能: <mx:RemoteObject id="ro" source="aadmin" destination="amfphp"> <mx:method name="siteLogin" fault="{onRcv_siteLoginErr(event)}" result="{onRcv_siteLogin(event)}"/> <
SimpleRemoteObject
时遇到问题。(sdk 0.9.6)
我的实际网站正在使用此代码调用Amfphp的远程功能:
<mx:RemoteObject id="ro" source="aadmin" destination="amfphp">
<mx:method name="siteLogin" fault="{onRcv_siteLoginErr(event)}" result="{onRcv_siteLogin(event)}"/>
</mx:RemoteObject>
其中,siteLogin
是我在aadmin
类中调用的函数
运行此操作时,我遇到以下问题:
The class {Amf3Broker} could not be found under the class path {/home/www/amfphp/services/amfphp/Amf3Broker.php}
为什么会显示Amf3Broker?有人有使用amfphp
处理SimpleRemoteObject
的例子吗
我使用的服务器端
是否需要设置服务配置.xml
文件?如果是,如何将其与编译器一起使用?(我在编译器选项中尝试了“services”:“services config.xml”,但不起作用)
以下是我的service-config.xml:
<services-config>
<services>
<service id="amfphp-flashremoting-service" class="flex.messaging.services.RemotingService" messageTypes="flex.messaging.messages.RemotingMessage">
<destination id="amfphp">
<channels>
<channel ref="my-amfphp"/>
</channels>
<properties>
<source>*</source>
</properties>
</destination>
</service>
</services>
<channels>
<channel-definition id="my-amfphp" class="mx.messaging.channels.AMFChannel">
<endpoint uri="http://amfphp.myserver.com/gateway.php" class="flex.messaging.endpoints.AMFEndpoint"/>
<properties><add-no-cache-headers>false</add-no-cache-headers></properties>
</channel-definition>
</channels>
</services-config>
提前感谢您的帮助。根据我自己的经验,我知道正在使用的后端是Java和.NET(氟)AMFPHP也必须工作。其他人也尝试过,但几乎是在一年前,AMF还没有完全开发出来。目前,Royale中的AMF非常健壮,除了Vector和Dictionary之外,其他所有类型的AMF都能很好地工作(我想有一天它们会出现,但因为它们是AS3类型,所以现在优先级较低)
这里的主要内容是使用
MXRoyale
版本的RemoteObject
(mx:RemoteObject
仿真),因为这是最接近Flex-RemoteObject的。Network
lib中的其他类是更轻的类,它们作为beads实现,是第一个来到Royale的类。但至少在我的例子中,我切换到了mx:RemoteObject
,因此我可以确保其他人在相同的级别上工作。这里是一些在0.9.6SDK上测试过的工作代码(请注意,如果您有mx库问题,您必须使用配置flex
才能使用mx)。使用silexlabs的v1.9和v2.0 AMFPHP进行测试:
<fx:Declarations>
<mx:RemoteObject id="ro" result="onResult(event)" fault="onFault(event)" source="your-service-php-class"
endpoint = "https://www.your-amfphp-server.com/amfphp/gateway.php"
destination = "amfphp" />
</fx:Declarations>
[更新]
重要信息:请确保在应用程序中包含此项,否则将出现类似*无法找到类{Amf3Broker}的错误*
<mx:beads>
<js:ClassAliasBead />
</mx:beads>
[更新#2]
您想使用什么config royale
,但还想让MX库使用MX远程对象?以下是如何:
/onStatusî$flex.messaging.messages.ErrorMessage
correlationId faultCode@ faultDetailfaultStringvUndefined property: stdClass::$_explicitType .
<br>file: /home/www/mysite.com/amfphpv2/Plugins/AmfphpFlexMessaging/AmfphpFlexMessaging.php
<br>line: 113
<br>context: Array
(
[requestMessage] => Amfphp_Core_Amf_Message Object
(
[targetUri] => null
[responseUri] => /1
[data] => Array
(
[0] => stdClass Object
(
[body] => stdClass Object
(
)
[clientId] =>
[correlationId] =>
[destination] => amfphp
[headers] => stdClass Object
(
)
[messageId] => EF4BF9E3-5C02-1060-1FF3-5D9781F55A31
[operation] => 13
[timeToLive] => 0
[timestamp] => 0
)
)
)
[serviceRouter] => Amfphp_Core_Common_ServiceRouter Object
(
[serviceFolders] => Array
(
[0] => /home/www/mysite.com/amfphpv2/Core/../Services/
)
[serviceNames2ClassFindInfo] => Array
(
[AmfphpMonitorService] => Amfphp_Core_Common_ClassFindInfo Object
(
[absolutePath] => /home/www/mysite.com/amfphpv2/Plugins/AmfphpMonitor/AmfphpMonitorService.php
[className] => AmfphpMonitorService
)
[AmfphpDiscoveryService] => Amfphp_Core_Common_ClassFindInfo Object
(
[absolutePath] => /home/www/mysite.com/amfphpv2/Plugins/AmfphpDiscovery/AmfphpDiscoveryService.php
[className] => AmfphpDiscoveryService
)
)
[checkArgumentCount] => 1
)
[explicitTypeField] => _explicitType
)
rootCause
<fx:Declarations>
<mx:RemoteObject id="ro" result="onResult(event)" fault="onFault(event)" source="your-service-php-class"
endpoint = "https://www.your-amfphp-server.com/amfphp/gateway.php"
destination = "amfphp" />
</fx:Declarations>
ro.getOperation("your-php-function-to-call").send("your-param");
<mx:beads>
<js:ClassAliasBead />
</mx:beads>