2015-12-03 116 views
0

我已經在zend框架2中創建了一個Soap Web服務,這個WS作爲一個模塊在理論上工作正常,但我的客戶端無法讀取或得到響應。肥皂服務zf2返回無效xml

這是響應,我不確定這個響應是否確定,我的意思是爲什麼要顯示這種方式?

<?xml version="1.0" encoding="UTF-8"?> 
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://evaluaciones.dev.com/soporte?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:getCountUserByNameResponse><return xsi:type="xsd:int">687</return></ns1:getCountUserByNameResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> 

這是一個可以正常工作的WS響應。

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tid.pruebas.com/webservice-soporte-portal" 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:getCountUserByNameResponse> 
    <return xsi:type="xsd:int">1290</return> 
    </ns1:getCountUserByNameResponse> 
</SOAP-ENV:Body> 
</SOAP-ENV:Envelope> 

在這一點上,我只想知道這種情況是否會影響客戶端的響應解釋?

回答

0

兩個響應的結構完全相同,第一個沒有格式化。在創建XML時,PHP通常不關心換行符和空格,並且在讀取XML時它從不關心它。

因此,不,不格式化的XML永遠不會影響客戶端的解釋。

+0

我明白了,問題必須是客戶端,我認爲zfw版本可能會有所作爲,客戶端(2.0.3)的版本比WS(2.3.9)早。 – cenceros

+0

嗯,從這篇文章到今天,我再次遇到這個問題,在這種情況下,我把整個模塊到其他zf proyect和web服務實際工作,但在原來不是,我找不到問題,有人可以幫助我? – cenceros