* This source code was highlighted with Source Code Highlighter .
- require_once 'Zend / Soap / Client.php' ;
- $ wsdlUri = 'http: //localhost/soap-server.php? wsdl' ;
- try {
- $ client = new Zend_Soap_Client ($ wsdlUri);
- echo $ client-> showSomething ( 'test' , 46);
- echo '<br />' ;
- echo 'the end' ;
- } catch (Exception $ e) {
- echo 'Error:' . $ e-> getMessage ();
- }
* This source code was highlighted with Source Code Highlighter .
- require_once 'soap-server-model.php' ;
- $ wsdlUri = 'http: //localhost/soap-server.php? wsdl' ;
- if (isset ($ _ GET [ 'wsdl' ])) {
- require_once 'Zend / Soap / AutoDiscover.php' ;
- $ autodiscover = new Zend_Soap_AutoDiscover ();
- $ autodiscover-> setClass ( 'SoapModel' );
- $ autodiscover-> handle ();
- } else {
- require_once 'Zend / Soap / Server.php' ;
- $ soap = new Zend_Soap_Server ($ wsdlUri);
- $ soap-> setClass ( 'SoapModel' );
- $ soap-> handle ();
- }
* This source code was highlighted with Source Code Highlighter .
- class SoapModel
- {
- / **
- * Method for testing SOAP server with Zend_Soap_AutoDiscover
- *
- * param string $ word
- * param int $ num
- * return string
- * /
- public function showSomething ($ word, $ num)
- {
- return 'Server said:' . $ word. '' . $ num;
- }
- }
[soap]
soap.wsdl_cache_enabled = 0
soap.wsdl_cache_dir = "/ tmp"
soap.wsdl_cache_ttl = 18000
soap.wsdl_cache_limit = 0
* This source code was highlighted with Source Code Highlighter .
- <? xml version = "1.0" ? >
- < definitions xmlns = " schemas.xmlsoap.org/wsdl " xmlns: tns = " localhost / soap-server.php " xmlns: soap = " schemas.xmlsoap.org/wsdl/soap " xmlns: xsd = " www.w3. org / 2001 / XMLSchema " xmlns: soap-enc =" schemas.xmlsoap.org/soap/encoding " xmlns: wsdl =" schemas.xmlsoap.org/wsdl " name =" SoapModel " targetNamespace =" localhost / soap-server. php » >
- < types >
- < xsd: schema targetNamespace = " localhost / soap-server.php " />
- </ types >
- < portType name = "SoapModelPort" >
- < operation name = "showSomething" >
- < documentation > Method for testing SOAP server with Zend_Soap_AutoDiscover </ documentation >
- < input message = "tns: showSomethingIn" />
- < output message = "tns: showSomethingOut" />
- </ operation >
- </ portType >
- < binding name = "SoapModelBinding" type = "tns: SoapModelPort" >
- < soap: binding style = "rpc" transport = " schemas.xmlsoap.org/soap/http " />
- < operation name = "showSomething" > < soap: operation soapAction = " localhost / soap-server.php # showSomething " />
- < input >
- < soap: body use = "encoded" encodingStyle = " schemas.xmlsoap.org/soap/encoding " namespace = " localhost / soap-server.php " />
- </ input >
- < output >
- < soap: body use = "encoded" encodingStyle = " schemas.xmlsoap.org/soap/encoding " namespace = " localhost / soap-server.php " />
- </ output >
- </ operation >
- </ binding >
- < service name = "SoapModelService" >
- < port name = "SoapModelPort" binding = "tns: SoapModelBinding" >
- < soap: address location = " localhost / soap-server.php " />
- </ port >
- </ service >
- < message name = "showSomethingIn" >
- < part name = "word" type = "xsd: string" />
- < part name = "num" type = "xsd: int" />
- </ message >
- < message name = "showSomethingOut" >
- < part name = "return" type = "xsd: string" />
- </ message >
- </ definitions >
* This source code was highlighted with Source Code Highlighter .
- <? xml version = "1.0" ? >
- < definitions xmlns = " schemas.xmlsoap.org/wsdl " xmlns: tns = " localhost / soap-server.php " xmlns: soap = " schemas.xmlsoap.org/wsdl/soap " xmlns: xsd = " www.w3. org / 2001 / XMLSchema " xmlns: soap-enc =" schemas.xmlsoap.org/soap/encoding " xmlns: wsdl =" schemas.xmlsoap.org/wsdl " name =" SoapModel " targetNamespace =" localhost / soap-server. php » >
- < types >
- < xsd: schema targetNamespace = " localhost / soap-server.php " />
- </ types >
- < portType name = "SoapModelPort" >
- < operation name = "showSomething" >
- < documentation > showSomething </ documentation >
- < input message = "tns: showSomethingIn" />
- </ operation >
- </ portType >
- < binding name = "SoapModelBinding" type = "tns: SoapModelPort" >
- < soap: binding style = "rpc" transport = " schemas.xmlsoap.org/soap/http " />
- < operation name = "showSomething" >
- < soap: operation soapAction = " localhost / soap-server.php # showSomething " />
- < input >
- < soap: body use = "encoded" encodingStyle = " schemas.xmlsoap.org/soap/encoding " namespace = " localhost / soap-server.php " />
- </ input >
- </ operation >
- </ binding >
- < service name = "SoapModelService" >
- < port name = "SoapModelPort" binding = "tns: SoapModelBinding" >
- < soap: address location = " localhost / soap-server.php " />
- </ port >
- </ service >
- < message name = "showSomethingIn" >
- < part name = "word" type = "xsd: anyType" />
- < part name = "num" type = "xsd: anyType" />
- </ message >
- </ definitions >
ini_set ('eaccelerator.filter', '! soap-server-model.php');
./configure -–with-eaccelerator-doc-comment-inclusion
Source: https://habr.com/ru/post/122710/
All Articles