Exemple #1
0
 /**
  * SOAP_Transport_SMTP Constructor
  *
  * @param string $URL    mailto:address
  *
  * @access public
  */
 function SOAP_Transport_SMTP($URL, $encoding = 'US-ASCII')
 {
     parent::SOAP_Base('SMTP');
     $this->encoding = $encoding;
     $this->urlparts = @parse_url($URL);
     $this->url = $URL;
 }
Exemple #2
0
 /**
  * Returns a SOAP XML message that can be sent as a server response.
  *
  * @return string
  */
 function message($encoding = SOAP_DEFAULT_ENCODING)
 {
     $msg = new SOAP_Base();
     $params = array();
     $params[] = new SOAP_Value('faultcode', 'QName', 'SOAP-ENV:' . $this->code);
     $params[] = new SOAP_Value('faultstring', 'string', $this->message);
     $params[] = new SOAP_Value('faultactor', 'anyURI', $this->error_message_prefix);
     if (isset($this->backtrace)) {
         $params[] = new SOAP_Value('detail', 'string', $this->backtrace);
     } else {
         $params[] = new SOAP_Value('detail', 'string', $this->userinfo);
     }
     $methodValue = new SOAP_Value('{' . SOAP_ENVELOP . '}Fault', 'Struct', $params);
     $headers = null;
     return $msg->makeEnvelope($methodValue, $headers, $encoding);
 }
 /**
  * SOAP::Transport constructor
  *
  * @param string $url   soap endpoint url
  *
  * @access public
  */
 function SOAP_Transport($url, $debug = SOAP_DEBUG)
 {
     parent::SOAP_Base('TRANSPORT');
     /* only HTTP transport for now, later look at url for scheme */
     $this->debug_flag = $debug;
     $urlparts = @parse_url($url);
     if (strcasecmp($urlparts['scheme'], 'http') == 0 || strcasecmp($urlparts['scheme'], 'http') == 0) {
         include_once 'SOAP/Transport/HTTP.php';
         $this->transport = new SOAP_Transport_HTTP($url);
         return;
     } else {
         if (strcasecmp($urlparts['scheme'], 'mailto') == 0) {
             include_once 'SOAP/Transport/SMTP.php';
             $this->transport = new SOAP_Transport_SMTP($url);
             return;
         }
     }
     $this->errmsg = "No Transport for {$urlparts['scheme']}";
     $this->raiseSoapFault($this->errmsg);
 }
Exemple #4
0
 function SOAP_Server($options = null)
 {
     ini_set('track_errors', 1);
     parent::SOAP_Base('Server');
     if (is_array($options)) {
         if (isset($options['use'])) {
             $this->__options['use'] = $options['use'];
         }
         if (isset($options['style'])) {
             $this->__options['style'] = $options['style'];
         }
         if (isset($options['parameters'])) {
             $this->__options['parameters'] = $options['parameters'];
         }
     }
     // assume we encode with section 5
     $this->_section5 = true;
     if ($this->__options['use'] == 'literal') {
         $this->_section5 = false;
     }
 }
Exemple #5
0
 /** Constructor
  *
  * @param  $objects Reference to the object or array of objects to parse
  * @param  $wsdl Reference to the SOAP_WSDL 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 SOAP_WSDL_ObjectParser(&$objects, &$wsdl, $targetNamespace, $service_name, $service_desc = '')
 {
     parent::SOAP_Base('WSDLOBJECTPARSER');
     $this->wsdl =& $wsdl;
     // Set up the SOAP_WSDL 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);
     }
 }
Exemple #6
0
 /**
  * Serializes this value.
  *
  * @param SOAP_Base $serializer  A SOAP_Base 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);
 }
Exemple #7
0
 /**
  * Serializes this value.
  *
  * @param SOAP_Base $serializer  A SOAP_Base instance or subclass to
  *                               serialize with.
  *
  * @return string  XML representation of $this.
  */
 function serialize(&$serializer)
 {
     return $serializer->_serializeValue($this->value, $this->nqn, $this->tqn, $this->options, $this->attributes, $this->arrayType);
 }
Exemple #8
0
 /**
  * SOAP_Transport_HTTP Constructor
  *
  * @access public
  *
  * @param string $url       HTTP url to SOAP endpoint.
  * @param string $encoding  Encoding to use.
  */
 function SOAP_Transport_HTTP($url, $encoding = SOAP_DEFAULT_ENCODING)
 {
     parent::SOAP_Base('HTTP');
     $this->urlparts = @parse_url($url);
     $this->url = $url;
     $this->encoding = $encoding;
 }
 /**
  *
  *
  * @param    string  name of the soap-value <value_name>
  * @param    mixed   soap value type, if not set an automatic 
  * @param    int
  * @param    mixed
  * @param    mixed
  * @param    mixed
  * @global   $SOAP_typemap, $SOAP_namespaces
  */
 function SOAP_Value($name = '', $type = false, $value = -1, $methodNamespace = NULL, $type_namespace = NULL, $wsdl = NULL)
 {
     global $SOAP_typemap, $SOAP_namespaces;
     parent::SOAP_Base('Value');
     // detect type if not passed
     #print("Entering SOAP_Value - name: '$name' type: '$type' value: $value\n");
     $this->name = $name;
     $this->wsdl = $wsdl;
     $this->type = $this->_getSoapType($value, $type);
     #$this->debug("Entering SOAP_Value - name: '$name' type: '$type' value: $value");
     if ($methodNamespace) {
         $this->namespace = $methodNamespace;
         if (!isset($SOAP_namespaces[$methodNamespace])) {
             $SOAP_namespaces[$methodNamespace] = 'ns' . (count($SOAP_namespaces) + 1);
         }
         $this->prefix = $SOAP_namespaces[$methodNamespace];
     }
     // get type prefix
     if (strpos($type, ':') !== false) {
         $qname = new QName($type);
         $this->type = $qname->name;
         $this->type_prefix = $qname->ns;
     } elseif ($type_namespace) {
         if (!isset($SOAP_namespaces[$type_namespace])) {
             $SOAP_namespaces[$type_namespace] = 'ns' . (count($SOAP_namespaces) + 1);
         }
         $this->type_prefix = $SOAP_namespaces[$type_namespace];
         // if type namespace was not explicitly passed, and we're not in a method struct:
     } elseif (!$this->type_prefix && $type != 'Struct') {
         // try to get type prefix from typeMap
         if ($ns = $this->verifyType($this->type)) {
             $this->type_prefix = $SOAP_namespaces[$ns];
         } else {
             if ($methodNamespace) {
                 // else default to method namespace
                 $this->type_prefix = $SOAP_namespaces[$methodNamespace];
             }
         }
     }
     if (in_array($this->type, $SOAP_typemap[SOAP_XML_SCHEMA_VERSION])) {
         // scalar
         $this->type_code = SOAP_VALUE_SCALAR;
         $this->addScalar($value, $this->type, $name);
     } elseif (strcasecmp('Array', $this->type) == 0 || strcasecmp('ur-type', $this->type) == 0) {
         // array
         $this->type_code = SOAP_VALUE_ARRAY;
         $this->addArray($value);
     } elseif (stristr($this->type, 'Struct')) {
         // struct
         $this->type_code = SOAP_VALUE_STRUCT;
         $this->addStruct($value);
     } elseif (is_array($value)) {
         $this->type_code = SOAP_VALUE_STRUCT;
         $this->addStruct($value);
     } else {
         $this->type_code = SOAP_VALUE_SCALAR;
         $this->addScalar($value, 'string', $name);
     }
 }
 /**
  * SOAP_Client constructor
  *
  * @param string endpoint (URL)
  * @param boolean wsdl (true if endpoint is a wsdl file)
  * @param string portName
  * @access public
  */
 function SOAP_Client($endpoint, $wsdl = false, $portName = false)
 {
     parent::SOAP_Base('Client');
     $this->endpoint = $endpoint;
     $this->portName = $portName;
     // make values
     if ($wsdl) {
         $this->endpointType = 'wsdl';
         // instantiate wsdl class
         $this->wsdl = new SOAP_WSDL($this->endpoint);
         if ($this->wsdl->fault) {
             $this->raiseSoapFault($this->wsdl->fault);
         }
     }
 }
 /**
  * SOAP::Message constructor
  *
  * initializes a soap structure containing the method signature and parameters
  *
  * @param string $method                     soap data (in xml)
  * @param array(SOAP::Value) $params         soap data (in xml)
  * @param string $method_namespace           soap data (in xml)
  * @param array of string $new_namespaces    soap data (in xml)
  *
  * @access public
  */
 function SOAP_Message($method, $params, $method_namespace = 'http://testuri.org', $new_namespaces = NULL, $wsdl = NULL)
 {
     parent::SOAP_Base('Message');
     // make method struct
     $this->value = new SOAP_Value($method, 'Struct', $params, $method_namespace, NULL, $wsdl);
     if (is_array($new_namespaces)) {
         global $SOAP_namespaces;
         $i = count($SOAP_namespaces);
         foreach ($new_namespaces as $v) {
             $SOAP_namespaces[$v] = 'ns' . $i++;
         }
         $this->namespaces = $SOAP_namespaces;
     }
     $this->debug_data = 'entering SOAP_Message() with SOAP_Value ' . $this->value->name . "\n";
 }
Exemple #12
0
 function SOAP_Server($options = NULL)
 {
     ini_set('track_errors', 1);
     parent::SOAP_Base('Server');
     if (is_array($options)) {
         if (isset($options['use'])) {
             $this->__options['use'] = $options['use'];
         }
         if (isset($options['style'])) {
             $this->__options['style'] = $options['style'];
         }
         if (isset($options['parameters'])) {
             $this->__options['parameters'] = $options['parameters'];
         }
     }
     $this->_section5 = TRUE;
     // assume we encode with section 5
     if ($this->__options['use'] == 'literal') {
         $this->_section5 = FALSE;
     }
 }
Exemple #13
0
 function SOAP_WSDL_Parser($uri, &$wsdl)
 {
     parent::SOAP_Base('WSDLPARSER');
     $this->cache = new SOAP_WSDL_Cache();
     $this->uri = $uri;
     $this->wsdl =& $wsdl;
     $this->parse($uri);
 }
Exemple #14
0
 /**
  * SOAP_Transport_SMTP Constructor
  *
  * @param string $URL    mailto:address
  *
  * @access public
  */
 function SOAP_Transport_SMTP($URL)
 {
     parent::SOAP_Base('SMTP');
     $this->urlparts = @parse_url($URL);
     $this->url = $URL;
 }
Exemple #15
-1
 /**
  * Constructor.
  *
  * @param string $xml         XML content.
  * @param string $encoding    Character set encoding, defaults to 'UTF-8'.
  * @param array $attachments  List of attachments.
  */
 function SOAP_Parser($xml, $encoding = SOAP_DEFAULT_ENCODING, $attachments = null)
 {
     parent::SOAP_Base('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]);
     }
     // Determine 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 nul bytes at the end of the
         // SOAP stream, and expat chokes 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);
     }
 }