這一個是我的命......支持PHP SoapClient的__call()異常:DTD不由SOAP
我學習的那一刻開發的PHP SOAP服務器,我運行到一個惱人問題和谷歌並沒有太大的幫助,儘管在問題上有很多點擊...
使用我認爲是一個很好的WSDL實例化SOAP CLIENT之後,第一次調用肥皂服務器正在生成以下異常:
SoapFault Object
(
[message:protected] => DTD are not supported by SOAP
[string:private] =>
[code:protected] => 0
[file:protected] => /var/www/soapserver/soapServerTestClient.php
[line:protected] => 7
[trace:private] => Array
(
[0] => Array
(
[function] => __call
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] => testSoapService
[1] => Array
(
[0] => TESTSTRING
)
)
)
[1] => Array
(
[file] => /var/www/soapserver/soapServerTestClient.php
[line] => 7
[function] => testSoapService
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] => TESTSTRING
)
)
)
[faultstring] => DTD are not supported by SOAP
[faultcode] => Client
[faultcodens] => http://schemas.xmlsoap.org/soap/envelope/
)
傾倒__getLastRequest(),__getLastResponse(),__getLastRequestHeaders()和__getLastResponseHeaders()產生完全EMPTY結果,所以NOTHING實際上被髮送/請求它出現。
訪問到WSDL的鏈接會按預期返回WSDL文件內容,我知道這是有效的,因爲修改WSDL路徑返回SOAP-ERROR: Parsing WSDL: Couldn't load
異常,並將其返回到實際的WSDL路徑會生成上述異常。
SOAP服務器的代碼如下,但是因爲沒有請求/響應,我不認爲這是個問題: '$ ARG'
功能testSoapService($ ARG){ 回報 '' ; }
ini_set(「soap.wsdl_cache_enabled」, 「0」); //禁用WSDL緩存,以便 可以無憂無慮地測試wsdl更改;當WSDL被設置時, 註釋掉。 $ server =新的SoapServer(「」); $ server-> addFunction(「testSoapService」); $ server-> handle();
搜索谷歌,一羣人說它是一個不好的wsdl路徑(在這種情況下不這麼認爲),或者服務器正在返回錯誤變種的HTML頁面(404等)從網絡服務器,我也不認爲是這種情況,因爲請求/響應是空的。
這裏的WSDL內容的副本,以防萬一它是有用的:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:types>
<schema xmlns:rns="http://soap.jrimer-amp64/" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://soap.jrimer-amp64/" version="1.0" elementFormDefault="unqualified" attributeFormDefault="unqualified">
<complexType name="testSoapServiceRequest">
<sequence>
<element name="testKey" type="string"/>
</sequence>
</complexType>
<complexType name="testSoapServiceResponse">
<sequence>
<element name="result" type="string" minOccurs="1"/>
<element name="retStatus" type="rns:returnStatus"/>
</sequence>
</complexType>
<complexType name="returnStatus">
<sequence>
<element name="errorMessage" type="string" minOccurs="0"/>
<element name="errorCode" type="string" minOccurs="0"/>
</sequence>
<attribute name="success" type="boolean"/>
</complexType>
<element name="addRouterToCustomerAccountRequest" type="rns:addRouterToCustomerAccountRequest"/>
<element name="addRouterToCustomerAccountResponse" type="rns:addRouterToCustomerAccountResponse"/>
</schema>
</wsdl:types>
<wsdl:service name="XxxxxxSvc">
<wsdl:port name="XxxxxxSvc-Endpoint0" binding="tns:XxxxxxSvc-Endpoint0Binding">
<soap:address location="http://soap.jrimer-amp64"/>
</wsdl:port>
</wsdl:service>
<wsdl:portType name="portType">
<wsdl:operation name="testSoapService">
<wsdl:input message="tns:testSoapServiceRequest"/>
<wsdl:output message="tns:testSoapServiceResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="XxxxxxSvc-Endpoint0Binding" type="tns:portType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="testSoapService">
<soap:operation style="document" soapAction="http://soap.jrimer-amp64/XxxxxxSvc-SoapServer.php"/>
<wsdl:input>
<soap:body use="literal" parts="parameters"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" parts="parameters"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:message name="testSoapServiceRequest">
<wsdl:part name="parameters" element="ns0:testSoapServiceRequest"/>
</wsdl:message>
<wsdl:message name="testSoapServiceResponse">
<wsdl:part name="parameters" element="ns0:testSoapServiceResponse"/>
</wsdl:message>
任何想法?
當您使用瀏覽器訪問WSDL時,您會看到什麼? – ben 2011-06-16 16:29:02
我看到了WSDL XML內容 – Rimer 2011-06-16 19:41:58