Example #1
0
 /**
  * ilBMFParser constructor
  *
  * @param string xml content
  * @param string xml character encoding, defaults to 'UTF-8'
  */
 function ilBMFParser(&$xml, $encoding = SOAP_DEFAULT_ENCODING, $attachments = null)
 {
     parent::ilBMFBase('Parser');
     $this->_setSchemaVersion(SOAP_XML_SCHEMA_VERSION);
     $this->attachments = $attachments;
     // Check the xml tag for encoding.
     if (preg_match('/<\\?xml[^>]+encoding\\s*?=\\s*?(\'([^\']*)\'|"([^"]*)")[^>]*?[\\?]>/', $xml, $m)) {
         $encoding = strtoupper($m[2] ? $m[2] : $m[3]);
     }
     // Determines where in the message we are
     // (envelope,header,body,method). Check whether content has
     // been read.
     if (!empty($xml)) {
         // Prepare the xml parser.
         $parser = xml_parser_create($encoding);
         xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
         xml_set_object($parser, $this);
         xml_set_element_handler($parser, 'startElement', 'endElement');
         xml_set_character_data_handler($parser, 'characterData');
         // Some lame soap implementations add null bytes at the
         // end of the soap stream, and expat choaks on that.
         if ($xml[strlen($xml) - 1] == 0) {
             $xml = trim($xml);
         }
         // Parse the XML file.
         if (!xml_parse($parser, $xml, true)) {
             $err = sprintf('XML error on line %d col %d byte %d %s', xml_get_current_line_number($parser), xml_get_current_column_number($parser), xml_get_current_byte_index($parser), xml_error_string(xml_get_error_code($parser)));
             $this->_raiseSoapFault($err, htmlspecialchars($xml));
         }
         xml_parser_free($parser);
     }
 }
 /**
  * ilBMFTransport_SMTP Constructor
  *
  * @param string $URL    mailto:address
  *
  * @access public
  */
 function ilBMFTransport_SMTP($URL, $encoding = 'US-ASCII')
 {
     parent::ilBMFBase('SMTP');
     $this->encoding = $encoding;
     $this->urlparts = @parse_url($URL);
     $this->url = $URL;
 }
Example #3
0
 /** Constructor
  *
  * @param  $objects Reference to the object or array of objects to parse
  * @param  $wsdl Reference to the ilBMFWSDL object to populate
  * @param  $targetNamespace The target namespace of schema types etc.
  * @param  $service_name Name of the WSDL <service>
  * @param  $service_desc Optional description of the WSDL <service>
  */
 function ilBMFWSDL_ObjectParser(&$objects, &$wsdl, $targetNamespace, $service_name, $service_desc = '')
 {
     parent::ilBMFBase('WSDLOBJECTPARSER');
     $this->wsdl =& $wsdl;
     // Set up the ilBMFWSDL object
     $this->_initialise($service_name);
     // Parse each web service object
     $wsdl_ref = is_array($objects) ? $objects : array(&$objects);
     foreach ($wsdl_ref as $ref_item) {
         if (!is_object($ref_item)) {
             return $this->_raiseSoapFault('Invalid web service object passed to object parser', 'urn:' . get_class($object));
         }
         if ($this->_parse($ref_item, $targetNamespace, $service_name) != true) {
             break;
         }
     }
     // Build bindings from abstract data.
     if ($this->fault == null) {
         $this->_generateBindingsAndServices($targetNamespace, $service_name, $service_desc);
     }
 }
Example #4
0
 /**
  * Serializes this value.
  *
  * @param ilBMFBase $serializer  A ilBMFBase instance or subclass to
  *                               serialize with.
  *
  * @return string  XML representation of $this.
  */
 function serialize(&$serializer)
 {
     return $serializer->_serializeValue($this->value, $this->name, $this->type, $this->namespace, $this->type_namespace, $this->options, $this->attributes, $this->arrayType);
 }
 /**
  * ilBMFTransport_HTTP Constructor
  *
  * @access public
  *
  * @param string $url       HTTP url to SOAP endpoint.
  * @param string $encoding  Encoding to use.
  */
 function ilBMFTransport_HTTP($url, $encoding = SOAP_DEFAULT_ENCODING)
 {
     parent::ilBMFBase('HTTP');
     $this->urlparts = @parse_url($url);
     $this->url = $url;
     $this->encoding = $encoding;
 }