PHP soap服务器双重编码html字符串

PHP soap服务器双重编码html字符串,php,html,soap,encode,Php,Html,Soap,Encode,我的php soap Web服务存在双重编码字符串的问题。例如,如果我尝试返回字符串O'Test,我得到的是O&;载脂蛋白;测试。我希望看到的是O'测试。似乎发生的事情是&本身正在被编码 我已经查看了phpinfo()返回的内容(这是php版本5.1.6),但没有看到任何明显的内容 我初始化soap服务器的代码使用数组自动初始化函数和类型,但这是我所做工作的要点: $server = new soap_server(); $server->configureWSDL('s

我的php soap Web服务存在双重编码字符串的问题。例如,如果我尝试返回字符串
O'Test
,我得到的是
O&;载脂蛋白;测试
。我希望看到的是
O'测试
。似乎发生的事情是
&
本身正在被编码

我已经查看了
phpinfo()
返回的内容(这是php版本5.1.6),但没有看到任何明显的内容

我初始化soap服务器的代码使用数组自动初始化函数和类型,但这是我所做工作的要点:

$server = new soap_server();

$server->configureWSDL('server', 'urn:sg');

$server->wsdl->addComplexType( 'testCall', 'complexType', 'struct', 'all', '', array( 'name' => 'testName', 'type' => 'xsd:string' ) );

$server->register( $fname,
array( 'request' => 'tns:TestCallRequest' ),
array( 'return' => 'tns:TestCallResponse' ),
'urn:sg',
'urn:sg#testCall' );

$server->service($HTTP_RAW_POST_DATA);
下面是上面用
$fname
表示的函数:

function testCall() {
    $result = array();

    $result[testName] = 'O\'Test';

    return $result;
}
以下是我从客户机角度看到的soap请求和响应:

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:sg"><soapenv:Header/><soapenv:Body><urn:testCall soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><urn:TestCallRequest></urn:TestCallRequest></urn:testCall></soapenv:Body></soapenv:Envelope>

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:sg"><SOAP-ENV:Body><ns1:TestCallResponse xmlns:ns1="urn:sg"><return xsi:type="tns:TestCallResponse"><testName xsi:type="xsd:string">O&amp;apos;Test</testName></return></ns1:TestCallResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

O&;载脂蛋白;试验

您是否检查了原始响应?你看到&;载脂蛋白;或&apos;在原始反应中&载脂蛋白;是表示撇号的有效XML实体。您能看到嵌入在这个问题中的完整soap请求和响应吗?在响应中,您可以在“testName”标记中看到我得到的原始响应。这是“O&;apos;测试”。此外,我还将编辑帖子并添加我在soap服务器上注册的实际函数…现在我看到了它-我认为编辑修复了它。:)