From 131fc7909ec0f821c4cc203a178e6ebdae001f2a Mon Sep 17 00:00:00 2001 From: Jonathan Maron Date: Tue, 8 Jun 2010 14:44:22 +0200 Subject: [PATCH] Harmonized method names. Corrected punctuation. --- .../Service/LiveDocx/AbstractLiveDocx.php | 30 +++++++++---------- library/Zend/Service/LiveDocx/MailMerge.php | 27 +++++++++-------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/library/Zend/Service/LiveDocx/AbstractLiveDocx.php b/library/Zend/Service/LiveDocx/AbstractLiveDocx.php index 059486d26ec..f6f5be1e3d4 100755 --- a/library/Zend/Service/LiveDocx/AbstractLiveDocx.php +++ b/library/Zend/Service/LiveDocx/AbstractLiveDocx.php @@ -136,12 +136,8 @@ public function __destruct() */ protected function _initSoapClient($endpoint) { - try { - $this->_soapClient = new Client(); - $this->_soapClient->setWsdl($endpoint); - } catch (\SoapFault $e) { // @todo -- which exception to catch here? - throw new Exception('Cannot connect to LiveDocx service at ' . $endpoint, 0, $e); - } + $this->_soapClient = new Client(); + $this->_soapClient->setWSDL($endpoint); } /** @@ -184,18 +180,18 @@ public function logIn() if (null === $this->getUsername()) { throw new Exception( - 'Username has not been set. To set username specify the options array in the constructor or call setUsername($username) after instantiation' + 'Username has not been set. To set username specify the options array in the constructor or call setUsername($username) after instantiation.' ); } if (null === $this->getPassword()) { throw new Exception( - 'Password has not been set. To set password specify the options array in the constructor or call setPassword($password) after instantiation' + 'Password has not been set. To set password specify the options array in the constructor or call setPassword($password) after instantiation.' ); } if (null === $this->getSoapClient()) { - $this->_initSoapClient($this->_wsdl); + $this->_initSoapClient($this->getWSDL()); } try { @@ -204,9 +200,9 @@ public function logIn() 'password' => $this->getPassword(), )); $this->_loggedIn = true; - } catch (Exception $e) { + } catch (\SoapFault $e) { throw new Exception( - 'Cannot login into LiveDocx service - username and/or password are invalid', 0, $e + 'Cannot login into LiveDocx service. Please check that your server can download the WSDL (' . $this->getWSDL() . ') and that your username and password are valid.', 0, $e ); } } @@ -229,7 +225,7 @@ public function logOut() $this->_loggedIn = false; } catch (Exception $e) { throw new Exception( - 'Cannot log out of LiveDocx service', 0, $e + 'Cannot log out of LiveDocx service.', 0, $e ); } } @@ -278,7 +274,7 @@ public function setPassword($password) * @return Zend\Service\AbstractLiveDocx * @since LiveDocx 1.0 */ - public function setWsdl($wsdl) + public function setWSDL($wsdl) { $this->_wsdl = $wsdl; return $this; @@ -320,9 +316,13 @@ public function getPassword() * @return Zend\Service\AbstractLiveDocx * @since LiveDocx 1.0 */ - public function getWsdl() + public function getWSDL() { - return $this->_wsdl; + if (null !== $this->getSoapClient()) { + return $this->getSoapClient()->getWSDL(); + } else { + return $this->_wsdl; + } } /** diff --git a/library/Zend/Service/LiveDocx/MailMerge.php b/library/Zend/Service/LiveDocx/MailMerge.php index bce31c2955e..964408bc67b 100755 --- a/library/Zend/Service/LiveDocx/MailMerge.php +++ b/library/Zend/Service/LiveDocx/MailMerge.php @@ -129,10 +129,11 @@ class MailMerge extends AbstractLiveDocx */ public function __construct($options = null) { - $this->_wsdl = self::WSDL; $this->_fieldValues = array(); $this->_blockFieldValues = array(); + $this->setWSDL(self::WSDL); + parent::__construct($options); } @@ -149,7 +150,7 @@ public function setLocalTemplate($filename) { if (!is_readable($filename)) { throw new Exception( - 'Cannot read local template from disk' + 'Cannot read local template from disk.' ); } @@ -162,7 +163,7 @@ public function setLocalTemplate($filename) )); } catch (Exception $e) { throw new Exception( - 'Cannot set local template', 0, $e + 'Cannot set local template.', 0, $e ); } @@ -188,7 +189,7 @@ public function setRemoteTemplate($filename) )); } catch (Exception $e) { throw new Exception( - 'Cannot set remote template', 0, $e + 'Cannot set remote template.', 0, $e ); } @@ -222,7 +223,7 @@ public function setFieldValues($values) )); } catch (Exception $e) { throw new Exception( - 'Cannot set field values', 0, $e + 'Cannot set field values.', 0, $e ); } @@ -267,7 +268,7 @@ public function setBlockFieldValues($blockName, $blockFieldValues) )); } catch (Exception $e) { throw new Exception( - 'Cannot set block field values', 0, $e + 'Cannot set block field values.', 0, $e ); } @@ -297,7 +298,7 @@ public function assign($field, $value = null) } } catch (Exception $e) { throw new Exception( - 'Cannot assign data to template', 0, $e + 'Cannot assign data to template.', 0, $e ); } @@ -354,7 +355,7 @@ public function setDocumentAccessPermissions($permissions, $password) )); } catch (Exception $e) { throw new Exception( - 'Cannot set document access permissions', 0, $e + 'Cannot set document access permissions.', 0, $e ); } @@ -383,7 +384,7 @@ public function createDocument() $this->getSoapClient()->CreateDocument(); } catch (Exception $e) { throw new Exception( - 'Cannot create document', 0, $e + 'Cannot create document.', 0, $e ); } } @@ -409,7 +410,7 @@ public function retrieveDocument($format) )); } catch (Exception $e) { throw new Exception( - 'Cannot retrieve document - call setLocalTemplate() or setRemoteTemplate() first', 0, $e + 'Cannot retrieve document - call setLocalTemplate() or setRemoteTemplate() first.', 0, $e ); } @@ -639,7 +640,7 @@ public function uploadTemplate($filename) { if (!is_readable($filename)) { throw new Exception( - 'Cannot read local template from disk' + 'Cannot read local template from disk.' ); } @@ -652,7 +653,7 @@ public function uploadTemplate($filename) )); } catch (Exception $e) { throw new Exception( - 'Cannot upload template', 0, $e + 'Cannot upload template.', 0, $e ); } } @@ -813,7 +814,7 @@ public function downloadSharedDocument($filename) )); } catch (Exception $e) { throw new Exception( - 'Cannot download shared document', 0, $e + 'Cannot download shared document.', 0, $e ); }