Friday 15 January 2016

Zend Soap Client and Server

Zend Soap Client and Server

Question: What is Zend\Soap\Client?
It is component which is used to send SOAP request messages to a Web service and to receive SOAP response messages from that Web service. Zend\Soap\Client takes two parameter $wsdl, $options.
$wsdl- the URI of a WSDL file.

Question: What options are available in Zend\Soap\Client?
  1. soap_version
  2. classmap
  3. encoding
  4. wsdl
  5. uri
  6. location
  7. style
  8. use
  9. login
  10. proxy credentials like proxy_host, proxy_port, proxy_login and proxy_password
  11. local_cert
  12. compression

Question: How to call Zend\Soap\Client? Give an Example?
$client = new Zend\Soap\Client("MySoapService.wsdl");
$result1 = $client->soapMethod(10);

Question: What is Zend\Soap\Server?
Zend\Soap\Server component works in the WSDL mode, it uses WSDL document to define server object behavior and transport layer.

Question: How to call Zend\Soap\Server for Non-WSDL Mode?
For WSDL Mode
$server = new Zend\Soap\Server('MySoapService.wsdl', $options);

For Non-WSDL Mode
$server = new Zend\Soap\Server(null, $options);

Question: Where is Zend_Rest in ZF2?
Zend_Rest component is removed from zf2. Now, If you want to call rest api, you can use Zend\Http\Client