用户
 找回密码
 入住 CI 中国社区
搜索
查看: 7216|回复: 8
收起左侧

[视图] webservice xml字符串被转义,如何解决

[复制链接]
发表于 2017-6-30 16:40:33 | 显示全部楼层 |阅读模式
现在有一个情况,php对接.net,返回给.net的XML字符串被转义了,“<” => "&alt;"这种,请问在php这边可以处理吗,让它们接收的值不被转义...急。。。。。
 楼主| 发表于 2017-6-30 16:46:25 | 显示全部楼层
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://api.zhonghui.estay.com" 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/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
        <ns1:OTA_HotelAvailRQResponse>
            <return xsi:type="xsd:string">&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;
&lt;OTA_HotelAvailRS xmlns=\"http://www.opentravel.org/OTA/2003/05\"&gt;&lt;Errors&gt;&lt;Error Code=-3&gt;房量不足,不能预订&lt;/Error&gt;&lt;/Errors&gt;&lt;/OTA_HotelAvailRS&gt;</return>
        </ns1:OTA_HotelAvailRQResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
发表于 2017-7-2 16:47:37 | 显示全部楼层
这个是用 CI 开发的吗
 楼主| 发表于 2017-7-2 21:06:54 | 显示全部楼层
Hex 发表于 2017-7-2 16:47
这个是用 CI 开发的吗

对,有解决方法吗
发表于 2017-7-3 10:24:33 | 显示全部楼层

贴你输出 XML 的代码看看,只要是你能控制的东西肯定能解决。。。。
 楼主| 发表于 2017-7-3 12:03:00 | 显示全部楼层
Hex 发表于 2017-7-3 10:24
贴你输出 XML 的代码看看,只要是你能控制的东西肯定能解决。。。。

直接返回的xml字符串,使用的Soap

$xml = '<OTA_HotelAvailRS xmlns="http://www.opentravel.org/OTA/2003/05"><Errors><Error Code="-1">1</Error></Errors>';         
return $xml;
发表于 2017-7-3 14:44:59 | 显示全部楼层
木浪——hd 发表于 2017-7-3 12:03
直接返回的xml字符串,使用的Soap

$xml = '1';         

你用的 CI 的 SOAP 类库?把代码都贴上来看看
 楼主| 发表于 2017-7-3 16:17:57 | 显示全部楼层
Hex 发表于 2017-7-3 14:44
你用的 CI 的 SOAP 类库?把代码都贴上来看看

不是CI的,用的也是nusoap,你是要看库代码吗
发表于 2017-7-3 19:15:42 | 显示全部楼层
木浪——hd 发表于 2017-7-3 16:17
不是CI的,用的也是nusoap,你是要看库代码吗

不是 CI 的那就得看看他怎么写的了,这个要具体分析,建议咨询开发者。

本版积分规则