我使用apache 2.2.21和php 5.3.5这个问题 这是XMl的结束
</env:Body></env:Envelop
缺少'e&gt;' 我没有在谷歌找到任何东西。
由于
答案 0 :(得分:0)
您似乎需要在代码末尾添加e>
:
</env:Body></env:Envelope>
还有其他错误吗?
答案 1 :(得分:0)
这是解决问题的唯一方法:
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;
}