异常信息:
[color=red]faultCode:Client.Error.MessageSend
faultString:'Send
failed' faultDetail:'Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404:
url: 'http://localhost:8000/WebContext/messagebroker/amf''[/color]
从异常信息中可以看出是 URL 的错误。
http://localhost:8000/[color=red]WebContext[/color]/messagebroker/amf
应该是:
http://localhost:8000/HolleWorld/messagebroker/amf
解决方法:
一、在RemoteObject标签中加入endpoint元素。
但是这样就使得在其他电脑上访问也会有问题。
二、通过URLUtil动态获得URL
将url绑定到endpint也可以解决这个问题。
三、修改FlexServer中的Context root。
项目名称-->右键选择properties-->选择Flex Server-->将Context root修改为项目名。
[color=red]faultCode:Client.Error.MessageSend
faultString:'Send
failed' faultDetail:'Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404:
url: 'http://localhost:8000/WebContext/messagebroker/amf''[/color]
从异常信息中可以看出是 URL 的错误。
http://localhost:8000/[color=red]WebContext[/color]/messagebroker/amf
应该是:
http://localhost:8000/HolleWorld/messagebroker/amf
解决方法:
一、在RemoteObject标签中加入endpoint元素。
<mx:RemoteObject destination="Hello" id="h" endpoint="http://localhost:8000/HelloWorld/messagebroker/amf">
<mx:method name="getMessage" result="show(event)"
fault="faultMsg(event)"/>
</mx:RemoteObject>
但是这样就使得在其他电脑上访问也会有问题。
二、通过URLUtil动态获得URL
var url:String = URLUtil.getServerNameWithPort(Application.application.url);
将url绑定到endpint也可以解决这个问题。
三、修改FlexServer中的Context root。
项目名称-->右键选择properties-->选择Flex Server-->将Context root修改为项目名。