Permalink
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...
mikaelcom committed Apr 8, 2013
1 parent 2d3eea6 commit 1f3451c7deb7eb56a8070bb138f468c83679a104
Showing with 53 additions and 0 deletions.
  1. +53 −0 WsdlClassFileTpl.php
@@ -232,6 +232,59 @@ public static function getDefaultWsdlOptions()
self::WSDL_URL=>null,
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()

0 comments on commit 1f3451c

Please sign in to comment.