1

谢谢阅读。我在使用 php 中的 SOAPServer 类时遇到了一个大问题。

当我们进行测试时,我们有这个响应,效果很好:

    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:WSDL" 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:Body>
          <ns1:NotificacionClienteResponse>
             <NotificacionClienteReturn xsi:type="xsd:string"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
                <NotificacionCliente>
                   <RESULTADO>
                      <CODIGORETORNO>8</CODIGORETORNO>
                      <DESCRIPCIONRETORNO>Xml incorrecto</DESCRIPCIONRETORNO>
                   </RESULTADO>
                </NotificacionCliente>]]>
             </NotificacionClienteReturn>
          </ns1:NotificacionClienteResponse>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

但是当我们做同样的事情,但在其他服务器上,我们有这个响应:

    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:WSDL" 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:NotificacionClienteResponse>
               <NotificacionClienteReturn xsi:type="xsd:string">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
                   &lt;NotificacionCliente&gt;
                      &lt;RESULTADO&gt;
                         &lt;CODIGORETORNO&gt;8&lt;/CODIGORETORNO&gt;
                         &lt;DESCRIPCIONRETORNO&gt;Xml incorrecto&lt;/DESCRIPCIONRETORNO&gt;
                      &lt;/RESULTADO&gt;
                   &lt;/NotificacionCliente&gt;
                </NotificacionClienteReturn>
           </ns1:NotificacionClienteResponse>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope

正如您在第二个响应中看到的那样,有 3 个不同的问题:

  • 它用 < 和 > 代替 < 和 >
  • 在 xml 的末尾缺少 de >
  • 并且 xml 它没有格式化(我为你做的:))

服务器的相关资料:

  • 相同的 wsdl、Web 服务器、php_soap.dll、php.ini
  • 我们使用 iis v6 和 php v5.2.9-2
  • php 在两个服务器中都以这种方式调用 SOAPServer:

    新的 SOAPServer($Path, array('encoding'=>'ISO-8859-1'))

好吧,您可以告诉我们的任何信息或您可能认为值得一试的任何线索都可以告诉它...当然,如果您需要更多信息,也一样。

提前谢谢大家!

4

0 回答 0