SOAP-ERROR:解析架构:无法导入架构。命名空间不能与封闭模式' targetNamespace'匹配。

时间:2014-09-02 13:00:20

标签: php zend-framework soap wsdl

我需要使用之前准备好的Zend_Soap_Server和WSDL来运行SOAP服务器。但是,当我尝试这样做时:

$server = new Zend_Soap_Server($wsdlUrl);
$server->setClass('Logic_WebService_Test');
$server->handle();

我收到错误:

  

SOAP-ERROR:解析架构:无法导入架构。命名空间不能   匹配封闭模式'targetNamespace'

这是我的WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<!-- version="1.0" comment="" -->
<wsdl:definitions
    targetNamespace="http://ws.orange.pl/mo-sms-service-ws"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:apachesoap="http://xml.apache.org/xml-soap"
    xmlns:impl="http://ws.orange.pl/mo-sms-service-ws"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
        ------------------------------------------------------------------------------------------
        Contract interface documentation
        --------------------------------
        Document release: V1_0
        Author (entity): AMG.net
        Creation date: 01/10/2013
        Description: mo-sms-service-ws contract interface
        ------------------------------------------------------------------------------------------
        Changes history
        ---------------
        Version Date Comments
        V1_0 01/10/2013 WSDL contract
        ------------------------------------------------------------------------------------------
    </wsdl:documentation>
    <wsdl:types>
        <schema elementFormDefault="qualified"
            targetNamespace="http://ws.orange.pl/mo-sms-service-ws"
            xmlns="http://www.w3.org/2001/XMLSchema"
            xmlns:apachesoap="http://xml.apache.org/xml-soap"
            xmlns:impl="http://ws.orange.pl/mo-sms-service-ws"
            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

            <xsd:import namespace="http://ws.orange.pl/mo-sms-service-ws" />
            <element name="DeliverShortMessage">
                <complexType>
                    <sequence>
                        <element name="sms" type="impl:SMSMessage" />
                    </sequence>
                </complexType>
            </element>
            <element name="DeliverShortMessageResponse">
                <complexType>
                    <sequence>
                        <element name="DeliverShortMessageReturn" nillable="true" type="xsd:boolean" />
                    </sequence>
                </complexType>
            </element>
            <element name="DeliverNotification">
                <complexType>
                    <sequence>
                        <element name="sms" type="impl:SMSNotification" />
                    </sequence>
                </complexType>
            </element>
            <element name="DeliverNotificationResponse">
                <complexType>
                    <sequence>
                        <element name="DeliverNotificationReturn" nillable="true" type="xsd:boolean" />
                    </sequence>
                </complexType>
            </element>
        </schema>
        <schema elementFormDefault="qualified"
            targetNamespace="http://ws.orange.pl/mo-sms-service-ws"
            xmlns="http://www.w3.org/2001/XMLSchema"
            xmlns:apachesoap="http://xml.apache.org/xml-soap"
            xmlns:impl="http://ws.orange.pl/mo-sms-service-ws"
            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
            <complexType name="SMSMessage">
                <sequence>
                    <element name="recipient" minOccurs="1" type="xsd:string" />
                    <element name="recipientAlias" minOccurs="0" type="xsd:string" />
                    <element name="originator" minOccurs="1" type="xsd:string" />
                    <element name="content" minOccurs="1" type="xsd:string" />
                    <element name="transactionId" minOccurs="1" type="xsd:string" />
                    <element name="timestamp" minOccurs="0" type="xsd:string" />
                </sequence>
            </complexType>
            <complexType name="SMSNotification">
                <sequence>
                    <element name="recipient" minOccurs="0" type="xsd:string" />
                    <element name="originator" minOccurs="0" type="xsd:string" />
                    <element name="transactionId" minOccurs="1" type="xsd:string" />
                    <element name="status" minOccurs="1" type="xsd:string" />
                    <element name="errorCode" minOccurs="0" type="xsd:string" />
                    <element name="content" minOccurs="0" type="xsd:string" />
                    <element name="timestamp" minOccurs="0" type="xsd:string" />
                </sequence>
            </complexType>
        </schema>
    </wsdl:types>
    <wsdl:message name="DeliverShortMessageRequest">
        <wsdl:part element="impl:DeliverShortMessage" name="parameters" />
    </wsdl:message>
    <wsdl:message name="DeliverShortMessageResponse">
        <wsdl:part element="impl:DeliverShortMessageResponse" name="parameters" />
    </wsdl:message>
    <wsdl:message name="DeliverNotificationRequest">
        <wsdl:part element="impl:DeliverNotification" name="parameters" />
    </wsdl:message>
    <wsdl:message name="DeliverNotificationResponse">
        <wsdl:part element="impl:DeliverNotificationResponse" name="parameters" />
    </wsdl:message>
    <wsdl:portType name="MoSmsServiceWs">
        <wsdl:operation name="DeliverShortMessage">
            <wsdl:input message="impl:DeliverShortMessageRequest" name="DeliverShortMessageRequest" />
            <wsdl:output message="impl:DeliverShortMessageResponse" name="DeliverShortMessageResponse" />
        </wsdl:operation>
        <wsdl:operation name="DeliverNotification">
            <wsdl:input message="impl:DeliverNotificationRequest" name="DeliverNotificationRequest" />
            <wsdl:output message="impl:DeliverNotificationResponse" name="DeliverNotificationResponse" />
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="MoSmsServiceWsSoapBinding" type="impl:MoSmsServiceWs">
        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="DeliverShortMessage">
            <wsdlsoap:operation soapAction="http://ws.orange.pl/mo-sms-service-ws/delivershortmessage" />
            <wsdl:input name="DeliverShortMessageRequest">
                <wsdlsoap:body use="literal" />
            </wsdl:input>
            <wsdl:output name="DeliverShortMessageResponse">
                <wsdlsoap:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
        <wsdl:operation name="DeliverNotification">
            <wsdlsoap:operation soapAction="http://ws.orange.pl/mo-sms-service-ws/delivernotification" />
            <wsdl:input name="DeliverNotificationRequest">
                <wsdlsoap:body use="literal" />
            </wsdl:input>
            <wsdl:output name="DeliverNotificationResponse">
                <wsdlsoap:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="MoSmsService">
        <wsdl:port binding="impl:MoSmsServiceWsSoapBinding" name="MoSmsServiceWs">
            <wsdlsoap:address location="http://ws.orange.pl/mo-sms-service-ws/MoSmsServiceWs" />
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

它出了什么问题?

1 个答案:

答案 0 :(得分:0)

问题在于这一行:

<xsd:import namespace="http://ws.orange.pl/mo-sms-service-ws" />

它尝试导入递归命名空间&#34; http://ws.orange.pl/mo-sms-service-ws&#34;,这不是由PHP处理的。

就我而言,删除这一行有帮助。