dongyimeng3764 2011-06-16 16:23
浏览 165
已采纳

PHP SoapClient __call()异常:SOAP不支持DTD

This one is killing me...

I'm learning to develop SOAP servers in PHP at the moment, and I'm running into an annoying problem and Google isn't helping much, despite plenty of hits on the problem in question...

After instantiating the SOAP CLIENT using a what I believe to be a good WSDL, the first call to an existing function on the soap server is generating the following Exception:

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/
)

Dumping the __getLastRequest(), __getLastResponse(), __getLastRequestHeaders(), and __getLastResponseHeaders() yield completely EMPTY results, so NOTHING is actually being sent/requested it appears.

Visiting the link to the WSDL returns the WSDL file contents as expected, and I know this works because altering the path to the WSDL returns a SOAP-ERROR: Parsing WSDL: Couldn't load exception, and putting it back to the actual WSDL path generates the exception above.

the soap server code is below, but since there's no request/response I don't think it's the issue:

function testSoapService($arg) { return ''.$arg.''; }

ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache so you can test wsdl changes without hassle; comment out when WSDL is set. $server = new SoapServer(""); $server->addFunction("testSoapService"); $server->handle();

Searching google, a mix of people are saying it's either a bad wsdl path (don't think so in this case), or the fact that the server is returning HTML pages of the error variety (404, etc) from the webserver, which I also don't think is the case because the requests/responses are empty.

Here's a copy of the WSDL contents, just in case it's useful:

<?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>

Any ideas?

  • 写回答

1条回答 默认 最新

  • douhuan9289 2011-06-16 16:30
    关注

    Dumping the __getLastRequest(), __getLastResponse(), __getLastRequestHeaders(), and __getLastResponseHeaders() yield completely EMPTY results, so NOTHING is actually being sent/requested it appears.

    Have you set up your client with the trace options set to true? You need to do this before the dumpLastXXX methods will work.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?