【问题标题】:Missing close tag. SOAP缺少关闭标签。肥皂
【发布时间】:2015-11-30 16:10:56
【问题描述】:

我在使用 apache 2.2.21 和 php 5.3.5 时遇到了这个问题 XMl 到此结束

</env:Body></env:Envelop

缺少'e>' 我在谷歌上没有找到任何东西。

谢谢

【问题讨论】:

  • 您是否尝试添加它说您缺少的 2 个字符?

标签: php apache soap


【解决方案1】:

看来您需要在代码末尾添加e&gt;

</env:Body></env:Envelope>

是否还有其他问题无法正常工作?

【讨论】:

    【解决方案2】:

    这是修复它的唯一方法:

    class SoapClientParch extends SoapClient {
    
    function __construct($wsdl, $options) {
        parent::__construct($wsdl, $options);
    }
    
    public function __doRequest($req, $location, $action, $version = "SOAP_1_2", $one_way = 0) {
        $response = parent::__doRequest($req, $location, $action, $version, $one_way);
        $response = preg_replace('/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\xFE\xFF|\xFF\xFE|\xEF\xBB\xBF)/', "", $response);
        $response = mb_convert_encoding($response, "UTF-8", 'HTML-ENTITIES');
        return $response;
    }
    
    }
    

    完成代码:

    class soap {
    
    private $_soap;
    
    public function __construct($conn) {
        $this->_soap = $conn;
    }
    
    public function send_func() {
    
    
        $argumentos = func_get_args();
        $res = array();
    
        if (count($argumentos) == 1)
            $res = $this->_soap->$argumentos[0]();
        else if (count($argumentos) > 1) {
            $func = array_shift($argumentos);
            for ($x = 0; $x < count($argumentos); $x++) {
                $argumentos[$x] = "'" . $argumentos[$x] . "'";
            }
    
            eval('$res = $this->_soap->' . $func . '(' . implode(",", $argumentos) . ' ) ;');
        }
    
        return $res;
    }
    
    }
    
    class SoapClientParch extends SoapClient {
    
    function __construct($wsdl, $options) {
        parent::__construct($wsdl, $options);
    }
    
    public function __doRequest($req, $location, $action, $version = "SOAP_1_2", $one_way = 0) {
        $response = parent::__doRequest($req, $location, $action, $version, $one_way);
        $response = preg_replace('/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\xFE\xFF|\xFF\xFE|\xEF\xBB\xBF)/', "", $response);
        $response = mb_convert_encoding($response, "UTF-8", 'HTML-ENTITIES');
        /* if (substr($response, -1) != ">") {
          //  $response .= "e>";
          $response = str_replace('</env:Envelope>e>', '</env:Envelope>', $response);
          } */
        return $response;
    }
    
    }
    
    $conn = array();
    foreach ($_config['soap'] as $key => $val) {
    
    $conn = new SoapClientParch(
            $_config['soap'][$key]['wsdl'], array(
        "soap_version" => SOAP_1_2,
        "login" => $_config['soap'][$key]['login'],
        "password" => $_config['soap'][$key]['password'],
        "location" => $_config['soap'][$key]['location'],
        "uri" => $_config['soap'][$key]['uri']
            )
    );
    
    $_soap = new soap($conn);
    $global['_soap'][$key] = $_soap;
    }
    

    【讨论】:

      猜你喜欢
      • 2019-06-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多