代码点火器 SOAP 服务器错误 - 保留的 XML - 已尝试修剪


Codeigniter SOAP Server Error - Reserved XML - already tried trim

我正在研究这个需要维护其 SOAP 服务的遗留系统,我目前正在尝试将其与代码点火器集成,在第 70 行解析 SOAP 有效负载时一直给我一个错误的 XML 错误:保留的 XML 名称我已经尝试了有人提到的修剪解决方案,但没有奏效。普通数组不会给我这个错误。只有多维数组。任何建议都将得到赞赏

<?php
class Employee_Trainings_Soap extends MY_Controller {
   public function __construct() {
       parent::__construct();
       $this->load->library("Soap_lib");
       $this->nusoap_server = new soap_server(); 
   }
   public function employee_detail() {   
       $namespace = 'http://localhost/employee_trainings_soap/employee_detail?wsdl';
       $this->nusoap_server->debug_flag = true;
       $this->nusoap_server->configureWSDL('EmployeeTrainings', $namespace);
       $this->nusoap_server->wsdl->schemaTargetNamespace = $namespace;
       $this->nusoap_server->wsdl->addComplexType('response', 'complexType', 'struct', 'all', '', array(
           "validOPIN" => array(
               "name" => "valid_OPIN",
               "type" => "xsd:string"
           ),
           "message" => array(
               "name" => "message",
               "type" => "xsd:string"
           )
       ));
       $this->nusoap_server->wsdl->addComplexType('responses', 'complexType', 'array', '', 'SOAP-ENC:Array', array(), array(
           array(
               "ref" => "SOAP-ENC:arrayType",
               "wsdl:arrayType" => "tns:response[]"
           )),
           "tns:response"
       ); 
       $this->nusoap_server->register('getEmployeeTrainings', array("id" => "xsd:string"), array('test'=>'tns:responses'),
           $namespace, $namespace."#getEmployeeTrainings", "rpc", "encoded",
           'Use this service to list notaries connected to the signed-in title company.'
       );
       function getEmployeeTrainings($id) {
           $data = array();
           $data[] =  array('valid_OPIN'=>'test','message'=>'test2');
           $data[] =  array('valid_OPIN'=>'test','message'=>'test2');
           //$data = array('valid_OPIN'=>'test','message'=>'test2');
           return array('test'=>$data);
       }
       $POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
       $this->nusoap_server->service($POST_DATA);
   }   
   function live_client_test() {
       $this->soapclient = new nusoap_client('http://localhost/employee_trainings_soap/employee_detail');
       $err = $this->soapclient->getError();
       if ($err) {
           echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
       }
       $result = $this->soapclient->call('getEmployeeTrainings', array('id' => 'test'));
       if ($this->soapclient->fault) {
           echo '<h2>Fault</h2><pre>';
           print_r($result);
           echo '</pre>';
       } else {
           $err = $this->soapclient->getError();
           if ($err) {                
               echo '<h2>Error</h2><pre>' . $err . '</pre>';
           } else {
               // Display the result
               echo '<h2>Result</h2><pre>';
               print_r($result);
               echo '</pre>';
           }
       }
   }
}

所以我发现了这个问题,这可能不是唯一的解决方案,而是我们发现对我们有用的解决方案。我们必须将 SOAP 服务从代码点火器中移除才能正常工作。当我们把服务带到Code Igniter之外的那一刻,它就起作用了。这可能是代码点火器的错误,也可能是我们使用它的方式的错误,但作为一种快速解决方案,它奏效了。此外,我们还发现,与XAMPP开发盒相比,它在Linux开发盒上效果更好。我希望这对可能遇到相同问题的其他任何人有所帮助。