Пример #1
0
 /**
  * Performs some fixes on the XML request before sending it out.
  *
  * @param string $request the request to be modified
  * @param array $arguments the arguments passed to the SOAP method
  * @param array $headers the headers used in the request
  * @return string the XML request ready to be sent to the server
  */
 protected function PrepareRequest($request, array $arguments, array $headers)
 {
     $addXsiTypes = $this->user->GetForceAddXsiTypes();
     $fixer = new SoapRequestXmlFixer($addXsiTypes, false, true);
     return $fixer->FixXml($request, $arguments, $headers);
 }
Пример #2
0
 /**
  * Depending on the version of PHP, the xsi:types need to be added and empty
  * tags may need to be removed. The SoapRequestXmlFixer class can facilitate
  * these changes.
  * @param string $request the request to be modified
  * @param array $arguments the arguments passed to the SOAP method
  * @param array $headers the headers used in the request
  * @return string the XML request ready to be sent to the server
  * @access protected
  */
 protected function PrepareRequest($request, array $arguments, array $headers)
 {
     $addXsiTypes = FALSE;
     $removeEmptyElements = FALSE;
     $replaceReferences = FALSE;
     if (version_compare(PHP_VERSION, '5.2.0', '<')) {
         trigger_error('The minimum required version of this client library' . ' is 5.2.0.', E_USER_ERROR);
     }
     if (version_compare(PHP_VERSION, '5.2.6', '<') || PHP_OS == 'Darwin' && version_compare(PHP_VERSION, '5.3.0', '<')) {
         $addXsiTypes = TRUE;
     }
     $removeEmptyElements = version_compare(PHP_VERSION, '5.2.3', '<');
     $replaceReferences = version_compare(PHP_VERSION, '5.2.2', '>=');
     if ($addXsiTypes || $removeEmptyElements || $replaceReferences) {
         $fixer = new SoapRequestXmlFixer($addXsiTypes, $removeEmptyElements, $replaceReferences);
         return $fixer->FixXml($request, $arguments, $headers);
     } else {
         // Empty string is appended to "save" the XML from being deleted.
         return $request . '';
     }
 }