В настоящее время я создаю приложение Flex с бэкэндом PHP. Приложение flex должно взаимодействовать с бэкэндом с помощью Zend_AMF.
Я реализовал конечную точку Zend_AMF в качестве контроллера, поэтому он доступен через http://localhost/myapp/amf.
Я пытаюсь протестировать службу с помощью браузера службы с именем ZamfBrowser.
При подключении я получаю эту ошибку:
There was an error loading the server's info. Error: (mx.rpc.events::FaultEvent)#0
bubbles = false
cancelable = true
currentTarget = (mx.rpc.remoting.mxml::RemoteObject)#1
channelSet = (mx.messaging::ChannelSet)#2
authenticated = false
channelIds = (Array)#3
[0] (null)
channels = (Array)#4
[0] (mx.messaging.channels::AMFChannel)#5
authenticated = false
channelSets = (Array)#6
connected = false
connectTimeout = -1
enableSmallMessages = true
endpoint = "http://localhost/myapp/amf"
failoverURIs = (Array)#7
id = (null)
mpiEnabled = false
netConnection = (flash.net::NetConnection)#8
client = (mx.messaging.channels::AMFChannel)#5
connected = false
maxPeerConnections = 8
objectEncoding = 3
proxyType = "none"
uri = "http://localhost/myapp/amf"
piggybackingEnabled = false
polling = false
pollingEnabled = true
pollingInterval = 3000
protocol = "http"
reconnecting = false
recordMessageSizes = false
recordMessageTimes = false
requestTimeout = -1
uri = "http://localhost/myapp/amf"
url = "http://localhost/myapp/amf"
useSmallMessages = false
clustered = false
connected = false
currentChannel = (mx.messaging.channels::AMFChannel)#5
heartbeatInterval = 0
initialDestinationId = (null)
messageAgents = (Array)#9
[0] (mx.rpc::AsyncRequest)#10
authenticated = false
autoConnect = true
channelSet = (mx.messaging::ChannelSet)#2
clientId = (null)
connected = false
defaultHeaders = (null)
destination = "AMF"
id = "D8377B12-6625-6224-9ADD-26CFA97594DC"
priority = -1
reconnectAttempts = 0
reconnectInterval = 0
requestTimeout = -1
subtopic = ""
concurrency = "multiple"
convertParametersHandler = (null)
convertResultHandler = (null)
destination = "AMF"
endpoint = "http://localhost/myapp/amf"
getServices = (mx.rpc.remoting.mxml::Operation)#11
argumentNames = (Array)#12
arguments = (Object)#13
concurrency = "multiple"
lastResult = (null)
makeObjectsBindable = true
name = "getServices"
operationManager = (null)
properties = (null)
resultElementType = (null)
resultType = (null)
service = (mx.rpc.remoting.mxml::RemoteObject)#1
showBusyCursor = true
makeObjectsBindable = true
managers = (null)
operations = (Object)#14
getServices = (mx.rpc.remoting.mxml::Operation)#11
requestTimeout = -1
showBusyCursor = true
source = "ZendAmfServiceBrowser"
eventPhase = 2
fault = (mx.rpc::Fault)#15
content = (Object)#16
errorID = 0
faultCode = "Client.Error.MessageSend"
faultDetail = "Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: 'http://localhost/myapp/amf'"
faultString = "Send failed"
message = "faultCode:Client.Error.MessageSend faultString:'Send failed' faultDetail:'Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: 'http://localhost/myapp/amf''"
name = "Error"
rootCause = (mx.messaging.events::ChannelFaultEvent)#17
bubbles = false
cancelable = false
channel = (mx.messaging.channels::AMFChannel)#5
channelId = (null)
connected = false
currentTarget = (mx.messaging.channels::AMFChannel)#5
eventPhase = 2
faultCode = "Channel.Connect.Failed"
faultDetail = "NetConnection.Call.BadVersion: : url: 'http://localhost/myapp/amf'"
faultString = "error"
reconnecting = false
rejected = false
rootCause = (Object)#18
code = "NetConnection.Call.BadVersion"
description = ""
details = ""
level = "error"
target = (mx.messaging.channels::AMFChannel)#5
type = "channelFault"
headers = (null)
message = (mx.messaging.messages::ErrorMessage)#19
body = (Object)#16
clientId = (null)
correlationId = "60935430-9E15-0B99-3D33-26CFA976D93E"
destination = ""
extendedData = (null)
faultCode = "Client.Error.MessageSend"
faultDetail = "Channel.Connect.Failed error NetConnection.Call.BadVersion: : url: 'http://localhost/myapp/amf'"
faultString = "Send failed"
headers = (Object)#20
messageId = "BDB90F14-D0D5-FAFF-6A6C-26CFA9DE9C02"
rootCause = (mx.messaging.events::ChannelFaultEvent)#17
timestamp = 0
timeToLive = 0
messageId = "BDB90F14-D0D5-FAFF-6A6C-26CFA9DE9C02"
statusCode = 0
target = (mx.rpc.remoting.mxml::RemoteObject)#1
token = (mx.rpc::AsyncToken)#21
message = (mx.messaging.messages::RemotingMessage)#22
body = (Array)#23
clientId = (null)
destination = ""
headers = (Object)#24
messageId = "60935430-9E15-0B99-3D33-26CFA976D93E"
operation = "getServices"
source = "ZendAmfServiceBrowser"
timestamp = 0
timeToLive = 0
responders = (null)
result = (null)
type = "fault"
Я пытался найти решение для поиска в Google, но, похоже, не могу найти никаких причин, которые могут вызвать эту ошибку. Я проверил код php с включенным display_errors, и ошибок не было.
Если я захожу на свою конечную точку в браузере, я получаю приглашение сохранить файл приложения / amf. Открытие его показало конечную точку Zend Amf.
Я в растерянности относительно того, что еще может быть причиной ошибки.
Любые идеи приветствуются.
Редактировать: некоторый PHP-код. Я просто реализую Zend_AMF в контроллере
class AmfController extends BaseController{
public function __construct(){
$server = new Zend_Amf_Server();
$server->setProduction(false);
$server->setClass( 'ZendAmfServiceBrowser' );
ZendAmfServiceBrowser::setAmfServer($server);
echo($server->handle());
}
}
Редактировать: Чарльз. Я пытался использовать Чарльза с включенным прокси-сервером Windows, но он, похоже, ничего не захватывает из ZamfBrowser.
Если я захожу на конечную точку из Rowser, мне предлагается сохранить файл (сообщение amf). Вот вывод Чарльза:
GET /myapp/www/amf HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Cookie: SESSb4604b0fcf7c7bac0da8afac2a88b017=JxMrgUUT0rl6RnLAR3emeX9gaI_Dikm3DJ4oF2TW2vQ
Необработанный вывод (который не может быть декодирован как AMF):
HTTP/1.1 200 OK
Date: Thu, 14 Jul 2011 06:15:10 GMT
Server: Apache/2.2.17 (Win32) mod_fcgid/2.3.6
X-Powered-By: PHP/5.3.6
Cache-Control: no-cache, must-revalidate
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: application/x-amf
<p>Zend Amf Endpoint</p>