Već danima pokušavam na netu da nadjem neki konkretan opis vezan za korišćenje user-defined tipova u SOAP razmenama i izgleda mi kao da je cela ta priča neka velika tajna :(
Da li neko ima neki primer iz koga se može razumeti kako se koriste kompleksni tipovi u PHP SOAP-u ili link ka nekoj dokumentaciji koja to objašnjava?
Da budem malo precizniji, moj problem je sledeći:
Definisao sam WSDL. Uspevam da pozovem server i da iz njega vratim StdClass object ili array ili bilo šta drugo i klijent će to primiti, ali pitanje je kako u serveru konstruisati odgovor koji odgovara WSDL-u kako bi bilo koji klijent koji ima pristup WSDL-u mogao da ga ispravno interpretira.
Bilo kakav savet je dobrodošao!!
Evo uprošćenog primera WSDL-a koji bih koristio:
Code:
<?xml version ='1.0' encoding ='UTF-8' ?>
<definitions name='CustData0'
targetNamespace='http://example.org/CustData0'
xmlns:tns=' http://example.org/CustData0 '
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns='http://schemas.xmlsoap.org/wsdl/'>
<!-- definicija komplexnog tipa -->
<types>
<schema targetNamespace="http://example.com/CustData0"
xmlns="http://www.w3.org/2000/10/XMLSchema">
<element name="personalInformation">
<complexType>
<all>
<element name="name" type="xsd:string"/>
<element name="title" type="xsd:string"/>
<element name="lang" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
</all>
</complexType>
</element>
</schema>
</types>
<!-- input -->
<message name='getCustData0Request'>
<part name='id' type='xsd:string'/>
</message>
<!-- output -->
<message name='getCustData0Response'>
<part name='codRet' type='xsd:string'/>
<part name='codeSic' type='xsd:string'/>
<part name='reponse' type='tns:personalInformation'/>
</message>
<portType name='CustData0PortType'>
<operation name='getCustData0'>
<input message='tns:getCustData0Request'/>
<output message='tns:getCustData0Response'/>
</operation>
</portType>
<binding name='CustData0Binding' type='tns:CustData0PortType'>
<soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='getCustData0'>
<soap:operation soapAction='urn:xmethods-delayed-quotes#getCustData0'/>
<input>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</input>
<output>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</output>
</operation>
</binding>
<service name='CustData0Service'>
<port name='CustData0Port' binding='CustData0Binding'>
<soap:address location='url location...'/>
</port>
</service>
</definitions>
<?xml version ='1.0' encoding ='UTF-8' ?>
<definitions name='CustData0'
targetNamespace='http://example.org/CustData0'
xmlns:tns=' http://example.org/CustData0 '
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns='http://schemas.xmlsoap.org/wsdl/'>
<!-- definicija komplexnog tipa -->
<types>
<schema targetNamespace="http://example.com/CustData0"
xmlns="http://www.w3.org/2000/10/XMLSchema">
<element name="personalInformation">
<complexType>
<all>
<element name="name" type="xsd:string"/>
<element name="title" type="xsd:string"/>
<element name="lang" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
</all>
</complexType>
</element>
</schema>
</types>
<!-- input -->
<message name='getCustData0Request'>
<part name='id' type='xsd:string'/>
</message>
<!-- output -->
<message name='getCustData0Response'>
<part name='codRet' type='xsd:string'/>
<part name='codeSic' type='xsd:string'/>
<part name='reponse' type='tns:personalInformation'/>
</message>
<portType name='CustData0PortType'>
<operation name='getCustData0'>
<input message='tns:getCustData0Request'/>
<output message='tns:getCustData0Response'/>
</operation>
</portType>
<binding name='CustData0Binding' type='tns:CustData0PortType'>
<soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='getCustData0'>
<soap:operation soapAction='urn:xmethods-delayed-quotes#getCustData0'/>
<input>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</input>
<output>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes' encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</output>
</operation>
</binding>
<service name='CustData0Service'>
<port name='CustData0Port' binding='CustData0Binding'>
<soap:address location='url location...'/>
</port>
</service>
</definitions>