title: Zend SOAP client integration
body: <p>I have third party soap service which needs to be called from Zend 2 application. They have given the client source code. I put it's creation and login code in <strong>global.php</strong> file as below. So client will be automatically created and available as a service. Login will occur if session is not found. </p>
  
  <p>Is it a good way ?</p>
  
  <p>This service is used only on some pages/modules of the site. As i feel, in this way client will login to the soap server even it has no use. </p>
  
  <pre><code>         'SfClient' =&gt; function($sm) {
              $config = $sm-&gt;get('config');
              $sf_wsdl = $config['salesforce']['wsdl'];
              $sf_username = $config['salesforce']['username'];
              $sf_password = $config['salesforce']['password'];
              $sf_token = $config['salesforce']['token'];
  
              try {
                  //Call Soap Client Builder
                  $builder = new \Salesforce\SoapClient\ClientBuilder(
                          $sf_wsdl, $sf_username, $sf_password, $sf_token
                  );
                  $client = $builder-&gt;build();
              } catch (\Exception $ex) {
                  \Zend\Debug\Debug::dump($ex);
              }
              return $client;
          },
  </code></pre>