Php Channel.Connect.Failed错误NetConnection.Call.BadVersion

Php Channel.Connect.Failed错误NetConnection.Call.BadVersion,php,mysql,apache-flex,serialization,flash-builder,Php,Mysql,Apache Flex,Serialization,Flash Builder,好吧,所以我一直在到处寻找,试图纠正这个问题,但我一直在寻找不同的答案,坦率地说,试图解决这个问题让我感到非常沮丧。让我发布一些代码供您查看: PHP脚本: public function addNewCompany(CompanyVO $item) { $stmt = mysqli_prepare($this->connection, "INSERT INTO `companies` ('companyName') VALUES (?);"); $this-&g

好吧,所以我一直在到处寻找,试图纠正这个问题,但我一直在寻找不同的答案,坦率地说,试图解决这个问题让我感到非常沮丧。让我发布一些代码供您查看:

PHP脚本:

public function addNewCompany(CompanyVO $item) 
{
    $stmt = mysqli_prepare($this->connection,
    "INSERT INTO `companies` ('companyName') VALUES (?);");
    $this->throwExceptionOnError();

    mysqli_bind_param($stmt, 's', $item->companyName);
    $this->throwExceptionOnError();

    mysqli_stmt_execute($stmt);
    $this->throwExceptionOnError();

    $autoid = mysqli_stmt_insert_id($stmt);
    mysqli_stmt_free_result($stmt);
    mysqli_close($this->connection);
    return $autoid;
}
MXML主应用程序的部分:

protected function companysignupsheet1_addCompanyEventHandler(event:AddCompanyEvent):void
        {
            companyservicero.addNewCompany({Data:event.companyData});
        } 

<s:RemoteObject id="companyservicero"
                    source="CompanyServices"
                    destination="addNewCompany"
                    endpoint = "http://localhost/PHP_RO/public/gateway.php"
                    result="companyservicero_resultHandler(event)"
                    fault="companyservicero_faultHandler(event)"/>
活动:

     package events
     {
    import flash.events.Event;


    import valueObjects.CompanyVO;

    public class AddCompanyEvent extends Event
    {

    public var companyData:CompanyVO;

    public function AddCompanyEvent(type:String, companyData:CompanyVO)
    {
        super(type);
        this.companyData = companyData;
    }
}
}
如果我需要发布更多,我会很高兴这样做。另外-我知道尝试以这种方式发送一个文本值有点过头了,但是当我让它工作时,将会有更多的内容-我只是想把重点放在问题所在。哦,我也不知道这是否有帮助……但是目前我可以从mySQL数据库中检索这些记录(虽然我不是通过RemoteObject的方式),我还可以使用上面PHP的旧拖放(连接到数据/服务)功能添加到同一个表中(尽管使用硬编码的信息(即CompanyName=testtest))

为了结束这一切,我在前面没有为参数定义数据类型时:

public function addNewCompany($item){.....
对于addNewCompany,它确实在数据库中添加了一条记录,尽管它是空的,并且它仍然会弹出一条错误消息,显示整个Channel.Connect等等……现在在Zend Server的日志中,它表示数据正在stdClass包装器中传输,并且在CompanyVO数据类型中需要它

我对这一切感到非常失望-我已经被这类问题困扰了2-3天,我放弃了!请帮助。非常感谢您的时间和帮助

-CS

编辑-更多信息

GATEWAY.PHP

<?php
ini_set("display_errors", 1);
$dir = dirname(__FILE__);
$webroot = $_SERVER['DOCUMENT_ROOT'];
$configfile = "$dir/amf_config.ini";
$servicesdir = $dir.'/../services';
$librarydir = $dir.'/../library';
//default zend install directory
$zenddir = $webroot.'/ZendFramework/library';
//Load ini file and locate zend directory
if (file_exists($configfile)) {
    $arr = parse_ini_file($configfile, true);
    if (isset($arr['zend']['webroot'])) {
        $webroot = $arr['zend']['webroot'];
        $zenddir = $webroot.'/ZendFramework/library';
    }
    if (isset($arr['zend']['zend_path'])) {
        $zenddir = $arr['zend']['zend_path'];
    }
    if (isset($arr['zend']['library'])) {
        $librarydir = $arr['zend']['library'];
    }
    if (isset($arr['zend']['services'])) {
        $servicesdir = $arr['zend']['services'];
    }
}
// Setup include path
// add zend directory, library and services to include path
set_include_path(get_include_path()
    .PATH_SEPARATOR.$zenddir
.PATH_SEPARATOR.$librarydir
.PATH_SEPARATOR.$servicesdir);
// Initialize Zend Framework loader
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true)-                          >suppressNotFoundWarnings(true);
// Load configuration
$default_config = new Zend_Config(array("production" => false), true);
$default_config->merge(new Zend_Config_Ini($configfile, 'zendamf'));
$default_config->setReadOnly();
$amf = $default_config->amf;
// Store configuration in the registry
Zend_Registry::set("amf-config", $amf);
// Initialize AMF Server
$server = new Zend_Amf_Server();
$server->setProduction($amf->production);
if (isset($amf->directories)) {
    $dirs = $amf->directories->toArray();
    foreach ($dirs as $dir) {
        if ($dir == "./") {
            $server->addDirectory($webroot);
        } else 
            if (realpath("{$webroot}/{$dir}")) {
                $server->addDirectory("{$webroot}/{$dir}");
            } else 
                if (realpath($dir)) {
                    $server->addDirectory(realpath($dir));
                }
    }
}
// Initialize introspector for non-production
if (! $amf->production) {
    $server->setClass('Zend_Amf_Adobe_Introspector', '', 
    array("config" => $default_config, "server" => $server));
    $server->setClass('Zend_Amf_Adobe_DbInspector', '', 
    array("config" => $default_config, "server" => $server));
}
// Handle request
echo $server->handle();

Channel.Connect.Failed error NetConnection.Call.BadVersion通常发生在PHP向amf响应回显错误或警告时。Flex会收到一条amf消息,并附加类似“警告X行出现错误”的内容,因此无法解析该消息。
在Flash Builder中打开网络监视器并查看最新的原始响应。您将看到使用html标记格式化的错误。

在Flash Builder中打开网络监视器并查看最新的原始响应。您将看到使用html标记格式化的错误。

发布您的服务配置/频道定义xml请?我不知道它在哪里。我已经在我的系统上搜索了它。唯一的一个我可以找到gateway.php和amf_config。也许你正在寻找其中的一个…?我会发布它们,看看它们是否是。更新:查看发送到php脚本的原始视图是:ServiceRequest:addNewCompany;RemoteService;addNewCompany(mx.messaging.messages::RemotingMessage)#0 body=(数组)#1[0](对象)#2 CompanyVO=(valueObjects::CompanyVO)#3 companyName=“asdf”clientId=(null)destination=“”headers=(Object)#4 DSRemoteCredentials=“”DSRemoteCredentialsCharset=(null)messageId=“54D01758-6CE2-C4FC-58DF-340A73ABC0A7”operation=“addNewCompany”source=“CompanyServices”timestamp=0 timeToLive=0发布您的服务配置/频道定义xml请?我不知道它在哪里。我已经在我的系统上搜索了它。唯一的一个我可以找到gateway.php和amf_config。也许你正在寻找其中的一个…?我会发布它们,看看它们是否是。更新:查看发送到php脚本的原始视图是:ServiceRequest:addNewCompany;RemoteService;addNewCompany(mx.messaging.messages::RemotingMessage)#0 body=(数组)#1[0](对象)#2 CompanyVO=(valueObjects::CompanyVO)#3 companyName=“asdf”clientId=(null)destination=“”headers=(Object)#4 DSRemoteCredentials=“”DSRemoteCredentialsCharset=(null)messageId=“54D01758-6CE2-C4FC-58DF-340A73ABC0A7”operation=“addNewCompany”source=“CompanyServices”timestamp=0 timeToLive=0
<?php
ini_set("display_errors", 1);
$dir = dirname(__FILE__);
$webroot = $_SERVER['DOCUMENT_ROOT'];
$configfile = "$dir/amf_config.ini";
$servicesdir = $dir.'/../services';
$librarydir = $dir.'/../library';
//default zend install directory
$zenddir = $webroot.'/ZendFramework/library';
//Load ini file and locate zend directory
if (file_exists($configfile)) {
    $arr = parse_ini_file($configfile, true);
    if (isset($arr['zend']['webroot'])) {
        $webroot = $arr['zend']['webroot'];
        $zenddir = $webroot.'/ZendFramework/library';
    }
    if (isset($arr['zend']['zend_path'])) {
        $zenddir = $arr['zend']['zend_path'];
    }
    if (isset($arr['zend']['library'])) {
        $librarydir = $arr['zend']['library'];
    }
    if (isset($arr['zend']['services'])) {
        $servicesdir = $arr['zend']['services'];
    }
}
// Setup include path
// add zend directory, library and services to include path
set_include_path(get_include_path()
    .PATH_SEPARATOR.$zenddir
.PATH_SEPARATOR.$librarydir
.PATH_SEPARATOR.$servicesdir);
// Initialize Zend Framework loader
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance()->setFallbackAutoloader(true)-                          >suppressNotFoundWarnings(true);
// Load configuration
$default_config = new Zend_Config(array("production" => false), true);
$default_config->merge(new Zend_Config_Ini($configfile, 'zendamf'));
$default_config->setReadOnly();
$amf = $default_config->amf;
// Store configuration in the registry
Zend_Registry::set("amf-config", $amf);
// Initialize AMF Server
$server = new Zend_Amf_Server();
$server->setProduction($amf->production);
if (isset($amf->directories)) {
    $dirs = $amf->directories->toArray();
    foreach ($dirs as $dir) {
        if ($dir == "./") {
            $server->addDirectory($webroot);
        } else 
            if (realpath("{$webroot}/{$dir}")) {
                $server->addDirectory("{$webroot}/{$dir}");
            } else 
                if (realpath($dir)) {
                    $server->addDirectory(realpath($dir));
                }
    }
}
// Initialize introspector for non-production
if (! $amf->production) {
    $server->setClass('Zend_Amf_Adobe_Introspector', '', 
    array("config" => $default_config, "server" => $server));
    $server->setClass('Zend_Amf_Adobe_DbInspector', '', 
    array("config" => $default_config, "server" => $server));
}
// Handle request
echo $server->handle();
[zend]
;set the absolute location path of webroot directory, example:
;Windows: C:\apache\www
;MAC/UNIX: /user/apache/www
 webroot = "C:/Zend/Apache2/htdocs"

;set the absolute location path of zend installation directory, example:
;Windows: C:\apache\PHPFrameworks\ZendFramework\library
;MAC/UNIX: /user/apache/PHPFrameworks/ZendFramework/library
zend_path ="C:/Zend/Apache2/htdocs/.metadata/.plugins/org.zend.php.framework.resource/resources/ZendFramework-1/library"
library ="C:/Zend/Apache2/htdocs/PHP_RO/library"
services ="C:/Zend/Apache2/htdocs/PHP_RO/services"

[zendamf]
amf.production = false
amf.directories[]=PHP_RO/services