Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[UPDATE] new WsdlClass methods

Adding two methods : getLastRequest and getLastResponse in order to get
respectively the last request and the last response as a DOMDocument or
as a formated XML string
  • Loading branch information...
commit 1f3451c7deb7eb56a8070bb138f468c83679a104 1 parent 2d3eea6
@mikaelcom authored
Showing with 53 additions and 0 deletions.
  1. +53 −0 WsdlClassFileTpl.php
View
53 WsdlClassFileTpl.php
@@ -233,6 +233,59 @@ public static function getDefaultWsdlOptions()
self::WSDL_USER_AGENT=>null);
}
/**
+ * Returns the last request content as a DOMDocument or as a formated XML String
+ * @see SoapClient::__getLastRequest()
+ * @uses PackageNameWsdlClass::getSoapClient()
+ * @uses PackageNameWsdlClass::getFormatedXml()
+ * @uses SoapClient::__getLastRequest()
+ * @param bool $_asDomDocument
+ * @return DOMDocument|string
+ */
+ public function getLastRequest($_asDomDocument = false)
+ {
+ if(self::getSoapClient())
+ return self::getFormatedXml(self::getSoapClient()->__getLastRequest(),$_asDomDocument);
+ return null;
+ }
+ /**
+ * Returns the last response content as a DOMDocument or as a formated XML String
+ * @see SoapClient::__getLastResponse()
+ * @uses PackageNameWsdlClass::getSoapClient()
+ * @uses PackageNameWsdlClass::getFormatedXml()
+ * @uses SoapClient::__getLastResponse()
+ * @param bool $_asDomDocument
+ * @return DOMDocument|string
+ */
+ public function getLastResponse($_asDomDocument = false)
+ {
+ if(self::getSoapClient())
+ return self::getFormatedXml(self::getSoapClient()->__getLastResponse(),$_asDomDocument);
+ return null;
+ }
+ /**
+ * Returns a XML string content as a DOMDocument or as a formated XML string
+ * @uses DOMDocument::loadXML()
+ * @uses DOMDocument::saveXML()
+ * @param string $_string
+ * @param bool $_asDomDocument
+ * @return DOMDocument|string|null
+ */
+ public function getFormatedXml($_string,$_asDomDocument = false)
+ {
+ if(class_exists('DOMDocument'))
+ {
+ $dom = new DOMDocument('1.0','UTF-8');
+ $dom->formatOutput = true;
+ $dom->preserveWhiteSpace = false;
+ $dom->resolveExternals = false;
+ $dom->substituteEntities = false;
+ $dom->validateOnParse = false;
+ if($dom->loadXML($_string))
+ return $_asDomDocument?$dom:$dom->saveXML();
+ }
+ return $_asDomDocument?null:$_string;
+ }
+ /**
* Method alias to count
* @uses PackageNameWsdlClass::count()
* @return int
Please sign in to comment.
Something went wrong with that request. Please try again.