这个是杀了我......
我正在学习用PHP开发SOAP服务器,而且我遇到了一个令人讨厌的问题,谷歌没有多大帮助,尽管问题上有很多问题......
在使用我认为是一个好的WSDL实例化SOAP CLIENT之后,第一次调用soap服务器上的现有函数会产生以下异常:
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路径会生成上面的异常 .
肥皂服务器代码如下,但由于没有请求/响应我不认为这是问题:
function testSoapService($ arg){return'' . $ arg . ''; } ini_set(“soap.wsdl_cache_enabled”,“0”); //禁用WSDL缓存,这样您就可以毫不费力地测试wsdl更改;在设置WSDL时注释掉 . $ server = new SoapServer(“”); $服务器 - >调用addFunction( “testSoapService”); $服务器 - >手柄();
搜索谷歌,一群人说这是一个糟糕的wsdl路径(在这种情况下不这么认为),或者服务器从网络服务器返回错误种类(404等)的HTML页面这一事实我也不认为是这种情况,因为请求/响应是空的 .
这是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>
有任何想法吗?
1 回答
您是否设置了
trace
选项设置为true
的客户端?您需要在dumpLastXXX方法起作用之前执行此操作 .