I need to run SOAP server using Zend_Soap_Server and WSDL prepared before. However, when I try to do it with:
$server = new Zend_Soap_Server($wsdlUrl);
$server->setClass('Logic_WebService_Test');
$server->handle();
I get an error:
SOAP-ERROR: Parsing Schema: can't import schema. Namespace must not match the enclosing schema 'targetNamespace'
Here's my 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>
What's wrong with it?
Problem was in this line:
<xsd:import namespace="http://ws.orange.pl/mo-sms-service-ws" />
It tries to import recursively namespace "http://ws.orange.pl/mo-sms-service-ws", which is not handled by PHP.
In my case, removing of this line helped.