this class can be used in two modes: 1. create an XML document from an array or object that is processed by other applications. That means, you can create a RDF document from an array in the following format: $data = array( "channel" => array( "title" => "Example RDF channel", "link" => "http://www.php-tools.de", "image" => array( "title" => "Example image", "url" => "http://www.php-tools.de/image.gif", "link" => "http://www.php-tools.de" ), array( "title" => "Example item", "link" => "http://example.com" ), array( "title" => "Another Example item", "link" => "http://example.org" ) ) ); to create a RDF document from this array do the following: require_once 'XML/Serializer.php'; $options = array( "indent" => "\t", // indent with tabs "linebreak" => "\n", // use UNIX line breaks "rootName" => "rdf:RDF", // root tag "defaultTagName" => "item" // tag for values with numeric keys ); $serializer = new XML_Serializer($options); $rdf = $serializer->serialize($data); You will get a complete XML document that can be processed like any RDF document. 2. this classes can be used to serialize any data structure in a way that it can later be unserialized again. XML_Serializer will store the type of the value and additional meta information in attributes of the surrounding tag. This meat information can later be used to restore the original data structure in PHP. If you want XML_Serializer to add meta information to the tags, add "typeHints" => true to the options array in the constructor. Future versions of this package will include an XML_Unserializer, that does the unserialization automatically for you.
Author: Stephan Schmidt (schst@php.net)
Inheritance: extends PEAR
コード例 #1
14
 /**
  * Test serializing an object, that supports __sleep
  */
 public function testSleep()
 {
     $obj = new MyClass('foo', 'bar');
     $s = new XML_Serializer($this->options);
     $s->serialize($obj);
     $this->assertEquals('<MyClass><foo>foo</foo></MyClass>', $s->getSerializedData());
 }
コード例 #2
0
ファイル: include.php プロジェクト: procivam/s-mir-new
/**
 * Генерация карты XML.
 */
function sitemap_outXML()
{
    A::$CACHE->page = null;
    require_once "modules/sitemap/sitemap.php";
    $checkeds = getTextOption(getSectionByModule('sitemap'), 'sections');
    $checkeds = !empty($checkeds) ? unserialize($checkeds) : array();
    A::$DB->query("SELECT * FROM " . DOMAIN . "_sections WHERE lang='" . LANG . "' OR lang='all' ORDER BY sort");
    while ($row = A::$DB->fetchRow()) {
        if (in_array($row['id'], $checkeds)) {
            if (function_exists($row['module'] . '_createMap')) {
                $section = DOMAIN . "_" . $row['lang'] . "_" . $row['name'];
                if ($caption = !empty($row['caption_' . LANG]) ? $row['caption_' . LANG] : $row['caption']) {
                    call_user_func($row['module'] . "_createMap", A::$MAINFRAME->treemap, $section, $caption);
                }
            }
        }
    }
    A::$DB->free();
    require_once 'XML/Serializer.php';
    $options = array(XML_SERIALIZER_OPTION_XML_DECL_ENABLED => true, XML_SERIALIZER_OPTION_XML_ENCODING => "utf-8", XML_SERIALIZER_OPTION_INDENT => "\t", XML_SERIALIZER_OPTION_LINEBREAKS => "\n", XML_SERIALIZER_OPTION_ROOT_NAME => 'urlset', XML_SERIALIZER_OPTION_ROOT_ATTRIBS => array('xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9'), XML_SERIALIZER_OPTION_DEFAULT_TAG => 'url');
    $serializer = new XML_Serializer($options);
    $data = array();
    sitemap_itemXML(A::$MAINFRAME->treemap, $data);
    $serializer->serialize($data);
    header("Content-type: text/xml; charset=utf-8");
    die($serializer->getSerializedData());
}
コード例 #3
0
ファイル: XmlView.obj.php プロジェクト: jrgns/backend-php
 public static function hook_output($to_print)
 {
     //Construct the object to output
     $object = new StdClass();
     $object->result = $to_print;
     $object->error = Backend::getError();
     $object->notice = Backend::getNotice();
     $object->success = Backend::getSuccess();
     $object->content = Backend::getContent();
     $last = '';
     while (ob_get_level() > self::$ob_level) {
         //Ending the ob_start from __construct
         $last .= ob_get_clean();
     }
     $object->output = $last;
     //Clean up
     Backend::setError();
     Backend::setNotice();
     Backend::setSuccess();
     //Return the XML
     $options = array(XML_SERIALIZER_OPTION_INDENT => "\t", XML_SERIALIZER_OPTION_RETURN_RESULT => true, XML_SERIALIZER_OPTION_DEFAULT_TAG => 'item', XML_SERIALIZER_OPTION_XML_DECL_ENABLED => true, XML_SERIALIZER_OPTION_XML_ENCODING => Controller::$view->charset, XML_SERIALIZER_OPTION_ROOT_NAME => 'XmlResult', XML_SERIALIZER_OPTION_TYPEHINTS => true);
     $serializer = new XML_Serializer($options);
     if ($result = @$serializer->serialize($object)) {
         return $result;
     } else {
         return null;
     }
 }
コード例 #4
0
 /**
  * Builds the response
  * 
  * @param type $type
  * @param type $objects
  * @param type $echoResponse
  * @param type $format
  * @return type
  */
 private static function _doResponse($type, $objects, $echoResponse, $format)
 {
     $ret = array();
     $ret['status'] = $type;
     if (is_array($objects)) {
         foreach ($objects as $k => $v) {
             $ret[$k] = $v;
         }
     } else {
         $ret[] = $objects;
     }
     switch ($format) {
         case 'xml':
             require_once 'XML/Serializer.php';
             $options = array("indent" => "    ", "linebreak" => "\n", "typeHints" => false, "addDecl" => true, "encoding" => "UTF-8", "rootName" => "data", "defaultTagName" => "item", "attributesArray" => "_attributes");
             $serializer = new \XML_Serializer($options);
             $rc = $serializer->serialize($ret);
             if ($rc !== TRUE) {
             }
             $ret = $serializer->getSerializedData();
             break;
         case 'json':
         default:
             $ret = json_encode($ret);
             break;
     }
     if ($echoResponse) {
         echo $ret;
     }
     return $ret;
 }
コード例 #5
0
 /**
  * SimpleXML
  */
 public function testSimpleXML()
 {
     $s = new XML_Serializer($this->options);
     $s->setOption(XML_SERIALIZER_OPTION_MODE, XML_SERIALIZER_MODE_SIMPLEXML);
     $s->serialize(array('foo' => array(1, 2, 3), 'bar' => array(1, 2, 3)));
     $this->assertEquals('<array><foo>1</foo><foo>2</foo><foo>3</foo><bar>1</bar><bar>2</bar><bar>3</bar></array>', $s->getSerializedData());
 }
コード例 #6
0
ファイル: Xml.php プロジェクト: rajnishp/bjs
 /**
  * @param $data
  * @param $clear_data Clear the data variable
  * @return unknown_type
  */
 function serialize(&$data, $clear_data = false, $rootName = 'root', $addDecl = TRUE)
 {
     //serialize an array
     $serializer_options = array('addDecl' => $addDecl, 'encoding' => 'ISO-8859-1', 'indent' => '  ', 'rootName' => $rootName, 'defaultTagName' => 'item');
     // Instantiate the serializer with the options
     $Serializer = new XML_Serializer($serializer_options);
     // Serialize the data structure
     try {
         //$this->logger->debug("Serializing into XML:".print_r($data, true));
         $status = $Serializer->serialize($data);
         //Clear the original data if set
         if ($clear_data) {
             $data = array();
         }
         //$this->logger->debug("Serialization Status: ".var_export($status, true));
         // Check whether serialization worked
         if (PEAR::isError($status)) {
             $this->logger->error("Error in XML serialization: " . var_export($status, true));
             die($status->getMessage());
         }
         //echo "here";//var_dump($Serializer);
         //echo "Status: $status";
     } catch (Exception $e) {
         $this->logger->error("Exception in serialization: " . var_export($e, true));
     }
     // Display the XML document
     return $Serializer->getSerializedData();
 }
コード例 #7
0
 /**
  * Simple namespace
  */
 public function testUri()
 {
     $s = new XML_Serializer($this->options);
     $s->setOption(XML_SERIALIZER_OPTION_NAMESPACE, array('foo', 'http://pear.php.net/XML_Serializer/foo'));
     $s->serialize(array('foo' => 'bar'));
     $this->assertEquals('<foo:array xmlns:foo="http://pear.php.net/XML_Serializer/foo"><foo:foo>bar</foo:foo></foo:array>', $s->getSerializedData());
 }
コード例 #8
0
 /**
  * Test indexed
  */
 public function testNumbered()
 {
     $s = new XML_Serializer($this->options);
     $data = array('foo' => array('atts' => array('one' => 1), 'content' => 'some data', 'bar', 'foo'));
     $s->serialize($data);
     $this->assertEquals('<array><foo one="1">some data<XML_Serializer_Tag>bar</XML_Serializer_Tag><XML_Serializer_Tag>foo</XML_Serializer_Tag></foo></array>', $s->getSerializedData());
 }
コード例 #9
0
ファイル: JSON2XML.php プロジェクト: awwthentic1234/hey
 public static function go($json, $attr = true, $rootAttr = array())
 {
     //----------------------------------------------------------
     $options = array();
     $options['addDecl'] = TRUE;
     $options['encoding'] = 'UTF-8';
     $options['indent'] = '  ';
     $options['rootName'] = 'root';
     $options['mode'] = 'simplexml';
     if ($attr) {
         $options['scalarAsAttributes'] = true;
     }
     $options['cdata'] = true;
     $options['rootAttributes'] = $rootAttr;
     //----------------------------------------------------------
     $serializer = new XML_Serializer($options);
     $obj = json_decode($json);
     //----------------------------------------------------------
     if ($serializer->serialize($obj)) {
         $xml = $serializer->getSerializedData();
         return $xml;
     } else {
         return null;
     }
 }
コード例 #10
0
ファイル: XMLFields.inc.php プロジェクト: radicaldesigns/amp
 function save($data)
 {
     require_once 'XML/Serializer.php';
     $xmlEngine = new XML_Serializer();
     $xmlresult = $xmlEngine->serialize($data);
     $locale = AMP_LOCAL_PATH . '/custom/' . $this->AMP_Object_Type . '_' . $this->DataDescription . '.xml';
     $this->saveFile($xmlEngine->getSerializedData(), $locale);
 }
コード例 #11
0
ファイル: init.php プロジェクト: sbeam/nimble
 public static function build($rootNode, $vals = null)
 {
     $xsz = new XML_Serializer(array('rootName' => $rootNode, 'mode' => 'simplexml'));
     $xsz->serialize($vals);
     $xml = $xsz->getSerializedData();
     Nimble::log($xml, PEAR_LOG_DEBUG);
     return $xml;
 }
コード例 #12
0
 /**
  * Test setting mixed default tags
  */
 public function testMixed()
 {
     $s = new XML_Serializer($this->options);
     $data = array('foos' => array(1, 2), 'bars' => array(1, 2), 'test');
     $s->setOption(XML_SERIALIZER_OPTION_DEFAULT_TAG, array('foos' => 'foo', '#default' => 'tag'));
     $s->serialize($data);
     $this->assertEquals('<array><foos><foo>1</foo><foo>2</foo></foos><bars><tag>1</tag><tag>2</tag></bars><tag>test</tag></array>', $s->getSerializedData());
 }
コード例 #13
0
 /**
  * Declaration and ID and system reference
  */
 public function testId()
 {
     $s = new XML_Serializer($this->options);
     $s->setOption(XML_SERIALIZER_OPTION_DOCTYPE_ENABLED, true);
     $s->setOption(XML_SERIALIZER_OPTION_DOCTYPE, array('uri' => 'http://pear.php.net/dtd/package-1.0', 'id' => '-//PHP//PEAR/DTD PACKAGE 1.0'));
     $s->serialize('string');
     $this->assertEquals('<!DOCTYPE string PUBLIC "-//PHP//PEAR/DTD PACKAGE 1.0" "http://pear.php.net/dtd/package-1.0"><string>string</string>', $s->getSerializedData());
 }
コード例 #14
0
ファイル: rest.php プロジェクト: 469306621/Languages
 /**
  * display
  *
  * Output our data array using the PEAR package XML_Serializer. This may
  * not be the optimal output you want for your REST API, but it should
  * display valid XML that can be easily consumed by anyone.
  *
  * @author Joe Stump <*****@*****.**>
  * @return void
  * @link http://pear.php.net/package/XML_Serializer
  */
 public function display()
 {
     $xml = new XML_Serializer();
     $xml->serialize($this->module->getData());
     header("Content-Type: text/xml");
     echo '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
     echo $xml->getSerializedData();
 }
 /**
  * Add encoding
  */
 public function testEncoding()
 {
     $s = new XML_Serializer($this->options);
     $s->setOption(XML_SERIALIZER_OPTION_XML_DECL_ENABLED, true);
     $s->setOption(XML_SERIALIZER_OPTION_XML_ENCODING, 'ISO-8859-1');
     $s->serialize('string');
     $this->assertEquals('<?xml version="1.0" encoding="ISO-8859-1"?><string>string</string>', $s->getSerializedData());
 }
コード例 #16
0
 /**
  * Test object
  */
 public function testNumberedObjects()
 {
     $s = new XML_Serializer($this->options);
     $s->setOption(XML_SERIALIZER_OPTION_CLASSNAME_AS_TAGNAME, true);
     $s->setOption(XML_SERIALIZER_OPTION_TAGMAP, array('stdClass' => 'foo'));
     $s->serialize(array(new stdClass(), new stdClass()));
     $this->assertEquals('<array><foo /><foo /></array>', strtolower($s->getSerializedData()));
 }
コード例 #17
0
    /**
     * Test a simple string
     */
    public function testUnixLinebreak()
    {
        $s = new XML_Serializer($this->options);
        $s->serialize(array('foo' => 'bar'));
        $this->assertEquals('<array>
<foo>bar</foo>
</array>', $s->getSerializedData());
    }
コード例 #18
0
ファイル: REST.php プロジェクト: joestump/framework
 /**
  * display
  *
  * Output our data array using the PEAR package XML_Serializer. This may
  * not be the optimal output you want for your REST API, but it should
  * display valid XML that can be easily consumed by anyone.
  *
  * @access public
  * @return void
  * @link http://pear.php.net/package/XML_Serializer
  */
 public function display()
 {
     $options = array(XML_SERIALIZER_OPTION_XML_DECL_ENABLED => true, XML_SERIALIZER_OPTION_XML_ENCODING => 'UTF-8', XML_SERIALIZER_OPTION_ROOT_NAME => 'result', XML_SERIALIZER_OPTION_TYPEHINTS => true, XML_SERIALIZER_OPTION_DEFAULT_TAG => 'item', XML_SERIALIZER_OPTION_INDENT => '    ');
     $xml = new XML_Serializer($options);
     $xml->serialize($this->module->getData());
     header("Content-Type: text/xml");
     echo '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
     echo $xml->getSerializedData();
 }
コード例 #19
0
 protected function write($filename, $data)
 {
     $serializer = new XML_Serializer(array('addDecl' => true, 'encoding' => 'ISO-8859-1', 'indent' => '  ', 'rootName' => 'form', 'defaultTagName' => 'tag'));
     $serializer->serialize($data);
     $xml = $serializer->getSerializedData();
     $fp = fopen($filename, 'w+');
     fputs($fp, $xml);
     fclose($fp);
 }
コード例 #20
0
    /**
     * Indent with tabs
     */
    public function testTabs()
    {
        $s = new XML_Serializer($this->options);
        $s->setOption(XML_SERIALIZER_OPTION_INDENT, "\t");
        $s->serialize(array('foo' => 'bar'));
        $this->assertEquals('<array>
	<foo>bar</foo>
</array>', $s->getSerializedData());
    }
コード例 #21
0
ファイル: Abstractid.php プロジェクト: adrianomelo5/magento
 public function __call($method, $args = array())
 {
     if (!Mage::getStoreConfig('allpago/clearsale/active')) {
         return false;
     }
     $entity_code = Mage::getStoreConfig('allpago/clearsale/ws_key');
     if (Mage::getStoreConfig('allpago/clearsale/ambiente') == 'producao') {
         $url = 'http://www.clearsale.com.br/integracaov2/service.asmx';
     } else {
         $url = 'http://homologacao.clearsale.com.br/integracaov2/service.asmx';
     }
     $serializer_options = array('addDecl' => false, 'encoding' => 'ISO-8859-1', 'indent' => '  ', 'rootName' => 'ClearID_Input', 'mode' => 'simplexml');
     if ($args) {
         $args = current($args);
     }
     if ($method == 'CheckOrderStatus') {
         $fields = array('entityCode' => urlencode($entity_code), 'pedidoID' => $args);
     } else {
         // Conversão de array para xml
         $serializer = new XML_Serializer($serializer_options);
         $status = $serializer->serialize($args);
         if (PEAR::isError($status)) {
             Mage::throwException($status->getMessage());
         }
         $xmlToSend = $serializer->getSerializedData();
         //Passagem de parametros para envio de acordo com manual de integração (EntityCode e xml)
         $fields = array('entityCode' => urlencode($entity_code), 'xmlDados' => $xmlToSend);
     }
     $fields_string = '';
     foreach ($fields as $key => $value) {
         $fields_string .= $key . '=' . $value . '&';
     }
     $time_start = microtime(true);
     $fields_string = substr_replace(rtrim($fields_string), '', -1);
     if (Mage::getStoreConfig('allpago/clearsale/debug')) {
         Mage::log($method . ': ' . print_r($fields_string, true), null, 'clearsale.log');
     }
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url . '/' . $method);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
     $curlresult = curl_exec($ch);
     $err = curl_error($ch);
     curl_close($ch);
     $xml = simplexml_load_string($curlresult);
     $xml = preg_replace('/(<\\?xml[^?]+?)utf-16/i', '$1utf-8', $xml);
     $xml = simplexml_load_string($xml);
     $this->processResult($method, $xml);
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     $info = array();
     $info['url'] = $url;
     $info['method'] = $method;
     $info['execution_time'] = $time;
 }
コード例 #22
0
ファイル: XMLEngine.inc.php プロジェクト: radicaldesigns/amp
 function save($data)
 {
     require_once 'XML/Serializer.php';
     $xmlEngine = new XML_Serializer(array(XML_SERIALIZER_OPTION_DEFAULT_TAG => 'values', XML_SERIALIZER_OPTION_INDENT => '    '));
     $xmlresult = $xmlEngine->serialize($data);
     $locale = AMP_LOCAL_PATH . '/custom/' . $this->describeFile('_');
     //$this->saveFile( $xmlEngine->getSerializedData(), AMP_pathFlip( $locale ));
     $this->saveFile($xmlEngine->getSerializedData(), $locale);
 }
コード例 #23
0
 /**
  * Object with null value
  */
 public function testObject()
 {
     $obj = new stdClass();
     $obj->foo = 'bar';
     $obj->null = null;
     $s = new XML_Serializer($this->options);
     $s->serialize($obj);
     $this->assertEquals('<stdClass><foo>bar</foo></stdClass>', $s->getSerializedData());
 }
コード例 #24
0
ファイル: RSS.inc.php プロジェクト: radicaldesigns/amp
 function execute()
 {
     $podcast = $this->podcast;
     $items = $podcast->getItems();
     $options = array(XML_SERIALIZER_OPTION_INDENT => "\t", XML_SERIALIZER_OPTION_XML_DECL_ENABLED => true, XML_SERIALIZER_OPTION_XML_ENCODING => 'utf-8', XML_SERIALIZER_OPTION_MODE => XML_SERIALIZER_MODE_SIMPLEXML, XML_SERIALIZER_OPTION_ROOT_NAME => 'rss', XML_SERIALIZER_OPTION_ROOT_ATTRIBS => array('version' => "2.0", 'xmlns:itunes' => 'http://www.itunes.com/dtds/podcast-1.0.dtd'), XML_SERIALIZER_OPTION_ATTRIBUTES_KEY => "_attributes", XML_SERIALIZER_OPTION_ENTITIES => XML_SERIALIZER_ENTITIES_NONE, XML_SERIALIZER_OPTION_ENCODE_FUNC => 'htmlspecialchars', XML_SERIALIZER_OPTION_IGNORE_NULL => true);
     $serializer = new XML_Serializer($options);
     $rss = array("channel" => array("title" => $podcast->getData('title'), "link" => $this->getLink($podcast), "description" => $podcast->getData('description'), "copyright" => $podcast->getData('copyright'), "generator" => $this->getGenerator(), "lastBuildDate" => date('D, j M Y G:i:s T', strtotime($podcast->lastBuildDate())), "language" => $podcast->getData('language'), "ttl" => $podcast->getData('ttl'), "itunes:summary" => $podcast->getData('description'), "itunes:subtitle" => $podcast->getData('subtitle'), "itunes:author" => $podcast->getData('author'), "itunes:keywords" => join(' ', $this->allKeywords($items)), "itunes:owner" => array("itunes:name" => $podcast->getData('author'), "itunes:email" => $podcast->getData('email')), "image" => ($url = $this->imageLink($podcast)) ? array("url" => $url, "title" => $podcast->getData('title'), "link" => $this->getLink($podcast)) : null, "itunes:image" => array("_attributes" => array("href" => $this->imageLink($podcast))), "itunes:category" => $this->categoriesToAttrArray($podcast->getData('category')), "item" => $this->itemSetToRSSArray($podcast->getItems())));
     $status = $serializer->serialize($rss);
     return $serializer->getSerializedData();
 }
コード例 #25
0
ファイル: XML.php プロジェクト: romeo14/pow
 /**
  * Signals that no more tokens are available
  *
  * @abstract
  * @access public
  */
 function finalize()
 {
     // call parent's finalize(), then serialize array into XML
     parent::finalize();
     $output = parent::getOutput();
     $serializer = new XML_Serializer($this->_serializer_options);
     $result = $serializer->serialize($output);
     if ($result === true) {
         $this->_output = $serializer->getSerializedData();
     }
 }
コード例 #26
0
function json_to_xml($json)
{
    get_lib("Serializer");
    $serializer = new XML_Serializer();
    $obj = json_decode($json);
    if ($serializer->serialize($obj)) {
        return $serializer->getSerializedData();
    } else {
        return null;
    }
}
コード例 #27
0
ファイル: XML.php プロジェクト: hutchike/YAWF
 /**
  * Serialize a data array as a text string of XML data
  *
  * @param Array $data the array of data to be serialized
  * @param Array $options an array of options overrides (optional)
  * @return String the data serialized as a text string of XML data
  */
 public static function serialize($data, $options = array())
 {
     load_plugin('XML/Serializer');
     $options = array_merge(self::$defaults, $options);
     $serializer = new XML_Serializer($options);
     $status = $serializer->serialize($data);
     if (PEAR::isError($status)) {
         throw new Exception($status->getMessage());
     }
     return $serializer->getSerializedData();
 }
コード例 #28
0
ファイル: Role.php プロジェクト: pathumf89/AAFrecovery
 public function asXML()
 {
     $seri_opt = array('indent' => '     ', 'rootName' => 'role', 'ignoreNull' => true);
     $seri = new \XML_Serializer($seri_opt);
     $res = $seri->serialize($this);
     if ($res === true) {
         return $seri->getSerializedData();
     } else {
         return false;
     }
 }
コード例 #29
0
ファイル: Attribute.php プロジェクト: pathumf89/AAFrecovery
 public function asXML()
 {
     $seri_opt = array('indent' => '     ', 'rootName' => 'entityResource', 'ignoreNull' => true, 'attributesArray' => '_attributes');
     $seri = new \XML_Serializer($seri_opt);
     $res = $seri->serialize($this);
     if ($res === true) {
         return $seri->getSerializedData();
     } else {
         return false;
     }
 }
コード例 #30
-11
ファイル: SOAPEncoder.php プロジェクト: jobinpankajan/WeGive
 public static function Encode($requestObject)
 {
     $soap = "";
     try {
         $writer = new XMLWriter();
         $writer->openMemory();
         $writer->startDocument();
         $writer->setIndent(4);
         $writer->startElement("soap:Envelope");
         $writer->writeAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
         $writer->writeAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
         $writer->writeAttribute("xmlns:soap", "http://schemas.xmlsoap.org/soap/envelope/");
         $writer->startElement("soap:Body");
         $options = array(XML_SERIALIZER_OPTION_INDENT => '    ', XML_SERIALIZER_OPTION_LINEBREAKS => "\n", XML_SERIALIZER_OPTION_DEFAULT_TAG => '', XML_SERIALIZER_OPTION_TYPEHINTS => false, XML_SERIALIZER_OPTION_IGNORE_NULL => true, XML_SERIALIZER_OPTION_CLASSNAME_AS_TAGNAME => true);
         $serializer = new XML_Serializer($options);
         $result = $serializer->serialize($requestObject);
         if ($result === true) {
             $xml = $serializer->getSerializedData();
             $xml = str_replace('<>', '', $xml);
             $xml = str_replace('</>', '', $xml);
         }
         $writer->writeRaw($xml);
         $writer->endElement();
         $writer->endElement();
         $writer->endDocument();
         $soap = $writer->flush();
         $soap = str_replace("<?xml version=\"1.0\"?>", "", $soap);
     } catch (Exception $ex) {
         throw new Exception("Error occurred while Soap encoding");
     }
     return $soap;
 }