Пример #1
0
 /**
  * constructor
  */
 function soap_transport_http($url)
 {
     parent::nusoap_base();
     $this->setURL($url);
     ereg('\\$Revisio' . 'n: ([^ ]+)', $this->revision, $rev);
     $this->outgoing_headers['User-Agent'] = $this->title . '/' . $this->version . ' (' . $rev[1] . ')';
 }
Пример #2
0
	/**
	* constructor
    *
    * @param string $faultcode (SOAP-ENV:Client | SOAP-ENV:Server)
    * @param string $faultactor only used when msg routed between multiple actors
    * @param string $faultstring human readable error message
    * @param mixed $faultdetail detail, typically a string or array of string
	*/
	function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
		parent::nusoap_base();
		$this->faultcode = $faultcode;
		$this->faultactor = $faultactor;
		$this->faultstring = $faultstring;
		$this->faultdetail = $faultdetail;
	}
Пример #3
0
 /**
  * constructor
  *
  * @param string $faultcode (SOAP-ENV:Client | SOAP-ENV:Server)
  * @param string $faultactor only used when msg routed between multiple actors
  * @param string $faultstring human readable error message
  * @param mixed $faultdetail detail, typically a string or array of string
  */
 public function __construct($faultcode, $faultactor = '', $faultstring = '', $faultdetail = '')
 {
     parent::__construct();
     $this->faultcode = $faultcode;
     $this->faultactor = $faultactor;
     $this->faultstring = $faultstring;
     $this->faultdetail = $faultdetail;
 }
Пример #4
0
	/**
	* constructor
	*
	* @param    string $name optional name
	* @param    mixed $type optional type name
	* @param	mixed $value optional value
	* @param	mixed $element_ns optional namespace of value
	* @param	mixed $type_ns optional namespace of type
	* @param	mixed $attributes associative array of attributes to add to element serialization
	* @access   public
	*/
  	function soapval($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) {
		parent::nusoap_base();
		$this->name = $name;
		$this->type = $type;
		$this->value = $value;
		$this->element_ns = $element_ns;
		$this->type_ns = $type_ns;
		$this->attributes = $attributes;
    }
Пример #5
0
 public function __construct()
 {
     parent::__construct();
     //Setup del WSDL
     // $this->ws_script = ($this->ws_script)?$this->ws_script:'';
     $this->ws = new soap_server();
     $this->ws->configureWSDL('ws-server', $this->ws_script);
     $this->ws->wsdl->schemaTargetNamespace = $this->ws_script;
 }
Пример #6
0
 /**
  * constructor
  *
  * @param    string $name optional name
  * @param    mixed $type optional type name
  * @param	mixed $value optional value
  * @param	mixed $element_ns optional namespace of value
  * @param	mixed $type_ns optional namespace of type
  * @param	mixed $attributes associative array of attributes to add to element serialization
  * @access   public
  */
 function __construct($name = 'soapval', $type = false, $value = -1, $element_ns = false, $type_ns = false, $attributes = false)
 {
     parent::__construct();
     $this->name = $name;
     $this->type = $type;
     $this->value = $value;
     $this->element_ns = $element_ns;
     $this->type_ns = $type_ns;
     $this->attributes = $attributes;
 }
Пример #7
0
 /**
  * constructor
  *
  * @param string $faultcode (SOAP-ENV:Client | SOAP-ENV:Server)
  * @param string $faultactor only used when msg routed between multiple actors
  * @param string $faultstring human readable error message
  * @param mixed $faultdetail detail, typically a string or array of string
  */
 function nusoap_fault($faultcode, $faultactor = '', $faultstring = '', $faultdetail = '')
 {
     parent::nusoap_base();
     $this->faultcode = $faultcode;
     $this->faultactor = $faultactor;
     $this->faultstring = $faultstring;
     $this->faultdetail = $faultdetail;
     if (isset($var)) {
         return 'my mistake';
     }
 }
	/**
	* constructor
	*
	* @param string $url The URL to which to connect
	* @param array $curl_options User-specified cURL options
	* @param boolean $use_curl Whether to try to force cURL use
	* @access public
	*/
	function soap_transport_http($url, $curl_options = NULL, $use_curl = false){
		parent::nusoap_base();
		$this->debug("ctor url=$url use_curl=$use_curl curl_options:");
		$this->appendDebug($this->varDump($curl_options));
		$this->setURL($url);
		if (is_array($curl_options)) {
			$this->ch_options = $curl_options;
		}
		$this->use_curl = $use_curl;
		preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
		$this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')');
	}
Пример #9
0
 /**
  * constructor
  *
  * @param string $url The URL to which to connect
  * @param array $curl_options User-specified cURL options
  * @param boolean $use_curl Whether to try to force cURL use
  */
 public function __construct($url, $curl_options = null, $use_curl = false)
 {
     parent::__construct();
     $this->debug("ctor url={$url} use_curl={$use_curl} curl_options:");
     $this->appendDebug($this->varDump($curl_options));
     $this->setURL($url);
     if (is_array($curl_options)) {
         $this->ch_options = $curl_options;
     }
     $this->use_curl = $use_curl;
     preg_match('/\\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
     $this->setHeader('User-Agent', $this->title . '/' . $this->version . ' (' . $rev[1] . ')');
 }
Пример #10
0
 /**
  * constructor
  * the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.
  *
  * @param mixed $wsdl file path or URL (string), or wsdl instance (object)
  * @access   public
  */
 function soap_server($wsdl = false)
 {
     parent::nusoap_base();
     // turn on debugging?
     global $debug;
     global $_REQUEST;
     global $_SERVER;
     global $HTTP_SERVER_VARS;
     if (isset($debug)) {
         $this->debug_flag = $debug;
     } else {
         if (isset($_REQUEST['debug'])) {
             $this->debug_flag = $_REQUEST['debug'];
         } else {
             if (isset($_SERVER['QUERY_STRING'])) {
                 $qs = explode('&', $_SERVER['QUERY_STRING']);
                 foreach ($qs as $v) {
                     if (substr($v, 0, 6) == 'debug=') {
                         $this->debug_flag = substr($v, 6);
                     }
                 }
             } else {
                 if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
                     $qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']);
                     foreach ($qs as $v) {
                         if (substr($v, 0, 6) == 'debug=') {
                             $this->debug_flag = substr($v, 6);
                         }
                     }
                 }
             }
         }
     }
     // wsdl
     if ($wsdl) {
         if (is_object($wsdl) && get_class($wsdl) == 'wsdl') {
             $this->wsdl = $wsdl;
             $this->externalWSDLURL = $this->wsdl->wsdl;
             $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL);
         } else {
             $this->debug('Create wsdl from ' . $wsdl);
             $this->wsdl = new wsdl($wsdl);
             $this->externalWSDLURL = $wsdl;
         }
         $this->appendDebug($this->wsdl->getDebug());
         $this->wsdl->clearDebug();
         if ($err = $this->wsdl->getError()) {
             die('WSDL ERROR: ' . $err);
         }
     }
 }
Пример #11
0
    /**
     * constructor
     *
     * @param string $wsdl WSDL document URL
	 * @param string $proxyhost
	 * @param string $proxyport
	 * @param string $proxyusername
	 * @param string $proxypassword
	 * @param integer $timeout set the connection timeout
	 * @param integer $response_timeout set the response timeout
	 * @param array $curl_options user-specified cURL options
	 * @param boolean $use_curl try to use cURL
     * @access public
     */
    function wsdl($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){
		parent::nusoap_base();
		$this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
        $this->proxyhost = $proxyhost;
        $this->proxyport = $proxyport;
		$this->proxyusername = $proxyusername;
		$this->proxypassword = $proxypassword;
		$this->timeout = $timeout;
		$this->response_timeout = $response_timeout;
		if (is_array($curl_options))
			$this->curl_options = $curl_options;
		$this->use_curl = $use_curl;
		$this->fetchWSDL($wsdl);
    }
Пример #12
0
 /**
  * constructor
  * 
  * @param string $wsdl WSDL document URL
  * @param string $proxyhost
  * @param string $proxyport
  * @param string $proxyusername
  * @param string $proxypassword
  * @param integer $timeout set the connection timeout
  * @param integer $response_timeout set the response timeout
  * @param array $curl_options user-specified cURL options
  * @param boolean $use_curl try to use cURL
  * @access public 
  */
 function __construct($wsdl = '', $proxyhost = false, $proxyport = false, $proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $curl_options = null, $use_curl = false)
 {
     parent::__construct();
     $this->debug("ctor wsdl={$wsdl} timeout={$timeout} response_timeout={$response_timeout}");
     $this->proxyhost = $proxyhost;
     $this->proxyport = $proxyport;
     $this->proxyusername = $proxyusername;
     $this->proxypassword = $proxypassword;
     $this->timeout = $timeout;
     $this->response_timeout = $response_timeout;
     if (is_array($curl_options)) {
         $this->curl_options = $curl_options;
     }
     $this->use_curl = $use_curl;
     $this->fetchWSDL($wsdl);
 }
Пример #13
0
 /**
  * constructor
  *
  * @param string $schema
  *        	schema document URI
  * @param string $xml
  *        	xml document URI
  * @param string $namespaces
  *        	namespaces defined in enclosing XML
  * @access public
  */
 function nusoap_xmlschema($schema = '', $xml = '', $namespaces = array())
 {
     parent::nusoap_base();
     $this->debug('nusoap_xmlschema class instantiated, inside constructor');
     // files
     $this->schema = $schema;
     $this->xml = $xml;
     // namespaces
     $this->enclosingNamespaces = $namespaces;
     $this->namespaces = array_merge($this->namespaces, $namespaces);
     // parse schema file
     if ($schema != '') {
         $this->debug('initial schema file: ' . $schema);
         $this->parseFile($schema, 'schema');
     }
     // parse xml file
     if ($xml != '') {
         $this->debug('initial xml file: ' . $xml);
         $this->parseFile($xml, 'xml');
     }
 }
Пример #14
0
 /**
  * constructor
  *
  * @param    mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object)
  * @param    bool $wsdl optional, set to true if using WSDL
  * @param	int $portName optional portName in WSDL document
  * @param    string $proxyhost
  * @param    string $proxyport
  * @param	string $proxyusername
  * @param	string $proxypassword
  * @param	integer $timeout set the connection timeout
  * @param	integer $response_timeout set the response timeout
  * @access   public
  */
 function nusoap_client($endpoint, $wsdl = false, $proxyhost = false, $proxyport = false, $proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30)
 {
     parent::nusoap_base();
     $this->endpoint = $endpoint;
     $this->proxyhost = $proxyhost;
     $this->proxyport = $proxyport;
     $this->proxyusername = $proxyusername;
     $this->proxypassword = $proxypassword;
     $this->timeout = $timeout;
     $this->response_timeout = $response_timeout;
     $this->debug("ctor wsdl={$wsdl} timeout={$timeout} response_timeout={$response_timeout}");
     $this->appendDebug('endpoint=' . $this->varDump($endpoint));
     // make values
     if ($wsdl) {
         if (is_object($endpoint) && get_class($endpoint) == 'wsdl') {
             $this->wsdl = $endpoint;
             $this->endpoint = $this->wsdl->wsdl;
             $this->wsdlFile = $this->endpoint;
             $this->debug('existing wsdl instance created from ' . $this->endpoint);
             $this->checkWSDL();
         } else {
             $this->wsdlFile = $this->endpoint;
             $this->wsdl = null;
             $this->debug('will use lazy evaluation of wsdl from ' . $this->endpoint);
         }
         $this->endpointType = 'wsdl';
     } else {
         $this->debug("instantiate SOAP with endpoint at {$endpoint}");
         $this->endpointType = 'soap';
     }
 }
Пример #15
0
 /**
  * constructor
  *
  * @param    mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object)
  * @param    bool $wsdl optional, set to true if using WSDL
  * @param	int $portName optional portName in WSDL document
  * @param    string $proxyhost
  * @param    string $proxyport
  * @param	string $proxyusername
  * @param	string $proxypassword
  * @param	integer $timeout set the connection timeout
  * @param	integer $response_timeout set the response timeout
  * @access   public
  */
 function nusoapclient($endpoint, $wsdl = false, $proxyhost = false, $proxyport = false, $proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30)
 {
     parent::nusoap_base();
     //ADDED FOR SUGAR PROXY SUPPORT
     global $proxy_config;
     if (!$proxyhost) {
         if (empty($proxy_config)) {
             if (!empty($GLOBALS['db'])) {
                 require_once 'modules/Administration/Administration.php';
                 $proxy_config = new Administration();
                 $proxy_config->retrieveSettings('proxy');
             }
         }
         if (!empty($proxy_config)) {
             if (!empty($proxy_config->settings['proxy_on'])) {
                 $proxyhost = $proxy_config->settings['proxy_host'];
                 $proxyport = $proxy_config->settings['proxy_port'];
             }
             if (!empty($proxy_config->settings['proxy_auth'])) {
                 $proxyusername = $proxy_config->settings['proxy_username'];
                 $proxypassword = $proxy_config->settings['proxy_password'];
             }
         }
     }
     $this->endpoint = $endpoint;
     $this->proxyhost = $proxyhost;
     $this->proxyport = $proxyport;
     $this->proxyusername = $proxyusername;
     $this->proxypassword = $proxypassword;
     $this->timeout = $timeout;
     $this->response_timeout = $response_timeout;
     // make values
     if ($wsdl) {
         if (is_object($endpoint) && get_class($endpoint) == 'wsdl') {
             $this->wsdl = $endpoint;
             $this->endpoint = $this->wsdl->wsdl;
             $this->wsdlFile = $this->endpoint;
             $this->debug('existing wsdl instance created from ' . $this->endpoint);
         } else {
             $this->wsdlFile = $this->endpoint;
             // instantiate wsdl object and parse wsdl file
             $this->debug('instantiating wsdl class with doc: ' . $endpoint);
             $this->wsdl =& new wsdl($this->wsdlFile, $this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword, $this->timeout, $this->response_timeout);
         }
         $this->appendDebug($this->wsdl->getDebug());
         $this->wsdl->clearDebug();
         // catch errors
         if ($errstr = $this->wsdl->getError()) {
             $this->debug('got wsdl error: ' . $errstr);
             $this->setError('wsdl error: ' . $errstr);
         } elseif ($this->operations = $this->wsdl->getOperations()) {
             $this->debug('got ' . count($this->operations) . ' operations from wsdl ' . $this->wsdlFile);
             $this->endpointType = 'wsdl';
         } else {
             $this->debug('getOperations returned false');
             $this->setError('no operations defined in the WSDL document!');
         }
     } else {
         $this->debug("instantiate SOAP with endpoint at {$endpoint}");
         $this->endpointType = 'soap';
     }
 }
Пример #16
0
<?php

require_once 'util.php';
require_once '/usr/local/nusoap/lib/nusoap.php';
nusoap_base::setGlobalDebugLevel(0);
$wsdl = new nusoap_client('http://cdmo.baruch.sc.edu/webservices2/requests.cfc?wsdl');
$stations = explode('|', $_REQUEST['stations']);
$params = explode('|', $_REQUEST['params']);
$data = array();
for ($i = 0; $i < count($stations); $i++) {
    $result = $wsdl->call('exportSingleParamXML', array('tbl' => $stations[$i], 'numrecs' => '1', 'param' => $params[$i]));
    $col2idx = array();
    foreach ($result['nds']['data']['r'] as $r) {
        $d = array();
        // figure out the col mapping
        if (count($col2idx) == 0) {
            foreach ($r['c'] as $c) {
                array_push($col2idx, $c['!v']);
            }
        } else {
            foreach ($r['c'] as $c) {
                if (rtrim($c['!v']) != 'null') {
                    $d[$col2idx[count($d)]] = rtrim($c['!v']);
                }
            }
        }
    }
    $d['station'] = $stations[$i];
    array_push($data, $d);
}
date_default_timezone_set('UTC');
Пример #17
0
 function CI_Tsoap()
 {
     // tcpdf constructor
     parent::__construct();
 }
Пример #18
0
 function wsdl2nusoap($wsdl, $options = null)
 {
     parent::nusoap_base();
     $this->debug("Enter wsdl2nusoap ctor");
     if (is_object($wsdl) && get_class($wsdl) == 'wsdl') {
         $this->wsdl = $wsdl;
         $this->wsdlFile = $wsdl->wsdl;
         $this->debug('existing wsdl instance created from ' . $this->wsdlFile);
     } elseif (is_string($wsdl)) {
         $this->wsdl = null;
         $this->wsdlFile = $wsdl;
         $this->debug('will use lazy evaluation of wsdl from ' . $this->wsdlFile);
     } else {
         $this->debug('$wsdl parameter is not a wsdl instance or string');
         $this->setError('$wsdl parameter is not a wsdl instance or string');
     }
     if (is_null($options)) {
         $this->options = new wsdl2nusoap_options();
     } else {
         $this->options = $options;
     }
     $this->debug("Leave wsdl2nusoap ctor");
 }
Пример #19
0
 /**
  * constructor that actually does the parsing
  *
  * @param string $xml
  *        	SOAP message
  * @param string $encoding
  *        	character encoding scheme of message
  * @param string $method
  *        	method for which XML is parsed (unused?)
  * @param string $decode_utf8
  *        	whether to decode UTF-8 to ISO-8859-1
  * @access public
  */
 function nusoap_parser($xml, $encoding = 'UTF-8', $method = '', $decode_utf8 = true)
 {
     parent::nusoap_base();
     $this->xml = $xml;
     $this->xml_encoding = $encoding;
     $this->method = $method;
     $this->decode_utf8 = $decode_utf8;
     // Check whether content has been read.
     if (!empty($xml)) {
         // Check XML encoding
         $pos_xml = strpos($xml, '<?xml');
         if ($pos_xml !== FALSE) {
             $xml_decl = substr($xml, $pos_xml, strpos($xml, '?>', $pos_xml + 2) - $pos_xml + 1);
             if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) {
                 $xml_encoding = $res[1];
                 if (strtoupper($xml_encoding) != $encoding) {
                     $err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'";
                     $this->debug($err);
                     if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') {
                         $this->setError($err);
                         return;
                     }
                     // when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed
                 } else {
                     $this->debug('Charset from HTTP Content-Type matches encoding from XML declaration');
                 }
             } else {
                 $this->debug('No encoding specified in XML declaration');
             }
         } else {
             $this->debug('No XML declaration');
         }
         $this->debug('Entering nusoap_parser(), length=' . strlen($xml) . ', encoding=' . $encoding);
         // Create an XML parser - why not xml_parser_create_ns?
         $this->parser = xml_parser_create($this->xml_encoding);
         // Set the options for parsing the XML data.
         // xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
         xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
         xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->xml_encoding);
         // Set the object for the parser.
         xml_set_object($this->parser, $this);
         // Set the element handlers for the parser.
         xml_set_element_handler($this->parser, 'start_element', 'end_element');
         xml_set_character_data_handler($this->parser, 'character_data');
         // Parse the XML file.
         if (!xml_parse($this->parser, $xml, true)) {
             // Display an error message.
             $err = sprintf('XML error parsing SOAP payload on line %d: %s', xml_get_current_line_number($this->parser), xml_error_string(xml_get_error_code($this->parser)));
             $this->debug($err);
             $this->debug("XML payload:\n" . $xml);
             $this->setError($err);
         } else {
             $this->debug('in nusoap_parser ctor, message:');
             $this->appendDebug($this->varDump($this->message));
             $this->debug('parsed successfully, found root struct: ' . $this->root_struct . ' of name ' . $this->root_struct_name);
             // get final value
             $this->soapresponse = $this->message[$this->root_struct]['result'];
             // get header value
             if ($this->root_header != '' && isset($this->message[$this->root_header]['result'])) {
                 $this->soapheader = $this->message[$this->root_header]['result'];
             }
             // resolve hrefs/ids
             if (sizeof($this->multirefs) > 0) {
                 foreach ($this->multirefs as $id => $hrefs) {
                     $this->debug('resolving multirefs for id: ' . $id);
                     $idVal = $this->buildVal($this->ids[$id]);
                     if (is_array($idVal) && isset($idVal['!id'])) {
                         unset($idVal['!id']);
                     }
                     foreach ($hrefs as $refPos => $ref) {
                         $this->debug('resolving href at pos ' . $refPos);
                         $this->multirefs[$id][$refPos] = $idVal;
                     }
                 }
             }
         }
         xml_parser_free($this->parser);
     } else {
         $this->debug('xml was empty, didn\'t parse!');
         $this->setError('xml was empty, didn\'t parse!');
     }
 }
Пример #20
0
 protected function getClient()
 {
     if (!isset($this->client) || !$this->client) {
         nusoap_base::setGlobalDebugLevel(0);
         $wsdl_path = $this->getWSDLLocation();
         $cache = new nusoap_wsdlcache('/tmp', 86400);
         $wsdl = $cache->get($url);
         if (is_null($wsdl)) {
             $wsdl = new wsdl($wsdl_path, '', '', '', '', 5);
             $cache->put($wsdl);
         }
         $client = new nusoap_client($wsdl, 'wsdl');
         //$client = new nusoap_client($wsdl_path, true);
         $client->decode_utf8 = false;
         //$client->setDebugLevel(9);
         //$client->clearDebug();
         if ($client->getError()) {
             throw new Exception("Initialising soap client failed, invalid wsdl?");
         }
         $this->client = $client;
     }
     return $this->client;
 }
Пример #21
0
 /**
  * sets the global debug level, which applies to future instances
  *
  * @param	int	$level	Debug level 0-9, where 0 turns off
  * @access	public
  */
 function setGlobalDebugLevel($level)
 {
     //$GLOBALS['_transient']['static']['nusoap_base']['globalDebugLevel'] = $level;
     self::$globalDebugLevel = $level;
 }
Пример #22
0
 /**
  * constructor
  *
  * @param    mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object)
  * @param    mixed $wsdl optional, set to 'wsdl' or true if using WSDL
  * @param    string $proxyhost optional
  * @param    string $proxyport optional
  * @param	string $proxyusername optional
  * @param	string $proxypassword optional
  * @param	integer $timeout set the connection timeout
  * @param	integer $response_timeout set the response timeout
  * @param	string $portName optional portName in WSDL document
  * @access   public
  */
 function nusoap_client($endpoint, $wsdl = false, $proxyhost = false, $proxyport = false, $proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = '')
 {
     parent::nusoap_base();
     //ADDED FOR SUGAR PROXY SUPPORT
     global $proxy_config;
     if (!$proxyhost) {
         if (empty($proxy_config)) {
             if (!empty($GLOBALS['db'])) {
                 $proxy_config = Administration::getSettings('proxy');
             }
         }
         if (!empty($proxy_config)) {
             if (!empty($proxy_config->settings['proxy_on'])) {
                 $proxyhost = $proxy_config->settings['proxy_host'];
                 $proxyport = $proxy_config->settings['proxy_port'];
             }
             if (!empty($proxy_config->settings['proxy_auth'])) {
                 $proxyusername = $proxy_config->settings['proxy_username'];
                 $proxypassword = $proxy_config->settings['proxy_password'];
             }
         }
     }
     $this->endpoint = $endpoint;
     $this->proxyhost = $proxyhost;
     $this->proxyport = $proxyport;
     $this->proxyusername = $proxyusername;
     $this->proxypassword = $proxypassword;
     $this->timeout = $timeout;
     $this->response_timeout = $response_timeout;
     $this->portName = $portName;
     $this->debug("ctor wsdl={$wsdl} timeout={$timeout} response_timeout={$response_timeout}");
     $this->appendDebug('endpoint=' . $this->varDump($endpoint));
     // make values
     if ($wsdl) {
         if (is_object($endpoint) && get_class($endpoint) == 'wsdl') {
             $this->wsdl = $endpoint;
             $this->endpoint = $this->wsdl->wsdl;
             $this->wsdlFile = $this->endpoint;
             $this->debug('existing wsdl instance created from ' . $this->endpoint);
             $this->checkWSDL();
         } else {
             $this->wsdlFile = $this->endpoint;
             $this->wsdl = null;
             $this->debug('will use lazy evaluation of wsdl from ' . $this->endpoint);
         }
         $this->endpointType = 'wsdl';
     } else {
         $this->debug("instantiate SOAP with endpoint at {$endpoint}");
         $this->endpointType = 'soap';
     }
 }
Пример #23
0
 /**
  * constructor
  *
  * @param    mixed $endpoint SOAP server or WSDL URL (string), or wsdl instance (object)
  * @param    bool $wsdl optional, set to true if using WSDL
  * @param	int $portName optional portName in WSDL document
  * @param    string $proxyhost
  * @param    string $proxyport
  * @param	string $proxyusername
  * @param	string $proxypassword
  * @param	integer $timeout set the connection timeout
  * @param	integer $response_timeout set the response timeout
  * @access   public
  */
 function soapclient($endpoint, $wsdl = false, $proxyhost = false, $proxyport = false, $proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30)
 {
     parent::nusoap_base();
     $this->endpoint = $endpoint;
     $this->proxyhost = $proxyhost;
     $this->proxyport = $proxyport;
     $this->proxyusername = $proxyusername;
     $this->proxypassword = $proxypassword;
     $this->timeout = $timeout;
     $this->response_timeout = $response_timeout;
     // make values
     if ($wsdl) {
         if (is_object($endpoint) && get_class($endpoint) == 'wsdl') {
             $this->wsdl = $endpoint;
             $this->endpoint = $this->wsdl->wsdl;
             $this->wsdlFile = $this->endpoint;
             $this->debug('existing wsdl instance created from ' . $this->endpoint);
         } else {
             $this->wsdlFile = $this->endpoint;
             // instantiate wsdl object and parse wsdl file
             $this->debug('instantiating wsdl class with doc: ' . $endpoint);
             $this->wsdl =& new wsdl($this->wsdlFile, $this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword, $this->timeout, $this->response_timeout);
         }
         $this->appendDebug($this->wsdl->getDebug());
         $this->wsdl->clearDebug();
         // catch errors
         if ($errstr = $this->wsdl->getError()) {
             $this->debug('got wsdl error: ' . $errstr);
             $this->setError('wsdl error: ' . $errstr);
         } elseif ($this->operations = $this->wsdl->getOperations()) {
             $this->debug('got ' . count($this->operations) . ' operations from wsdl ' . $this->wsdlFile);
             $this->endpointType = 'wsdl';
         } else {
             $this->debug('getOperations returned false');
             $this->setError('no operations defined in the WSDL document!');
         }
     } else {
         $this->debug("instantiate SOAP with endpoint at {$endpoint}");
         $this->endpointType = 'soap';
     }
 }
Пример #24
0
 /**
  * constructor
  * 
  * @param string $wsdl WSDL document URL
  * @param string $proxyhost
  * @param string $proxyport
  * @param string $proxyusername
  * @param string $proxypassword
  * @param integer $timeout set the connection timeout
  * @param integer $response_timeout set the response timeout
  * @access public 
  */
 function wsdl($wsdl = '', $proxyhost = false, $proxyport = false, $proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30)
 {
     parent::nusoap_base();
     $this->wsdl = $wsdl;
     $this->proxyhost = $proxyhost;
     $this->proxyport = $proxyport;
     $this->proxyusername = $proxyusername;
     $this->proxypassword = $proxypassword;
     $this->timeout = $timeout;
     $this->response_timeout = $response_timeout;
     // parse wsdl file
     if ($wsdl != "") {
         $this->debug('initial wsdl URL: ' . $wsdl);
         $this->parseWSDL($wsdl);
     }
     // imports
     // TODO: handle imports more properly, grabbing them in-line and nesting them
     $imported_urls = array();
     $imported = 1;
     while ($imported > 0) {
         $imported = 0;
         // Schema imports
         foreach ($this->schemas as $ns => $list) {
             foreach ($list as $xs) {
                 $wsdlparts = parse_url($this->wsdl);
                 // this is bogusly simple!
                 foreach ($xs->imports as $ns2 => $list2) {
                     for ($ii = 0; $ii < count($list2); $ii++) {
                         if (!$list2[$ii]['loaded']) {
                             $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true;
                             $url = $list2[$ii]['location'];
                             if ($url != '') {
                                 $urlparts = parse_url($url);
                                 if (!isset($urlparts['host'])) {
                                     $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') . substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1) . $urlparts['path'];
                                 }
                                 if (!in_array($url, $imported_urls)) {
                                     $this->parseWSDL($url);
                                     $imported++;
                                     $imported_urls[] = $url;
                                 }
                             } else {
                                 $this->debug("Unexpected scenario: empty URL for unloaded import");
                             }
                         }
                     }
                 }
             }
         }
         // WSDL imports
         $wsdlparts = parse_url($this->wsdl);
         // this is bogusly simple!
         foreach ($this->import as $ns => $list) {
             for ($ii = 0; $ii < count($list); $ii++) {
                 if (!$list[$ii]['loaded']) {
                     $this->import[$ns][$ii]['loaded'] = true;
                     $url = $list[$ii]['location'];
                     if ($url != '') {
                         $urlparts = parse_url($url);
                         if (!isset($urlparts['host'])) {
                             $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') . substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1) . $urlparts['path'];
                         }
                         if (!in_array($url, $imported_urls)) {
                             $this->parseWSDL($url);
                             $imported++;
                             $imported_urls[] = $url;
                         }
                     } else {
                         $this->debug("Unexpected scenario: empty URL for unloaded import");
                     }
                 }
             }
         }
     }
     // add new data to operation data
     foreach ($this->bindings as $binding => $bindingData) {
         if (isset($bindingData['operations']) && is_array($bindingData['operations'])) {
             foreach ($bindingData['operations'] as $operation => $data) {
                 $this->debug('post-parse data gathering for ' . $operation);
                 $this->bindings[$binding]['operations'][$operation]['input'] = isset($this->bindings[$binding]['operations'][$operation]['input']) ? array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[$bindingData['portType']][$operation]['input']) : $this->portTypes[$bindingData['portType']][$operation]['input'];
                 $this->bindings[$binding]['operations'][$operation]['output'] = isset($this->bindings[$binding]['operations'][$operation]['output']) ? array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[$bindingData['portType']][$operation]['output']) : $this->portTypes[$bindingData['portType']][$operation]['output'];
                 if (isset($this->messages[$this->bindings[$binding]['operations'][$operation]['input']['message']])) {
                     $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[$this->bindings[$binding]['operations'][$operation]['input']['message']];
                 }
                 if (isset($this->messages[$this->bindings[$binding]['operations'][$operation]['output']['message']])) {
                     $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[$this->bindings[$binding]['operations'][$operation]['output']['message']];
                 }
                 if (isset($bindingData['style'])) {
                     $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style'];
                 }
                 $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : '';
                 $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[$bindingData['portType']][$operation]['documentation']) ? $this->portTypes[$bindingData['portType']][$operation]['documentation'] : '';
                 $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : '';
             }
         }
     }
 }
Пример #25
0
 /**
  * constructor
  * the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.
  *
  * @param mixed $wsdl file path or URL (string), or wsdl instance (object)
  * @access   public
  */
 function soap_server($wsdl = false)
 {
     parent::nusoap_base();
     // turn on debugging?
     global $debug;
     global $HTTP_SERVER_VARS;
     if (isset($_SERVER)) {
         $this->debug("_SERVER is defined:");
         $this->appendDebug($this->varDump($_SERVER));
     } elseif (isset($HTTP_SERVER_VARS)) {
         $this->debug("HTTP_SERVER_VARS is defined:");
         $this->appendDebug($this->varDump($HTTP_SERVER_VARS));
     } else {
         $this->debug("Neither _SERVER nor HTTP_SERVER_VARS is defined.");
     }
     if (isset($debug)) {
         $this->debug("In soap_server, set debug_flag={$debug} based on global flag");
         $this->debug_flag = $debug;
     } elseif (isset($_SERVER['QUERY_STRING'])) {
         $qs = explode('&', $_SERVER['QUERY_STRING']);
         foreach ($qs as $v) {
             if (substr($v, 0, 6) == 'debug=') {
                 $this->debug("In soap_server, set debug_flag=" . substr($v, 6) . " based on query string #1");
                 $this->debug_flag = substr($v, 6);
             }
         }
     } elseif (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
         $qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']);
         foreach ($qs as $v) {
             if (substr($v, 0, 6) == 'debug=') {
                 $this->debug("In soap_server, set debug_flag=" . substr($v, 6) . " based on query string #2");
                 $this->debug_flag = substr($v, 6);
             }
         }
     }
     // wsdl
     if ($wsdl) {
         $this->debug("In soap_server, WSDL is specified");
         if (is_object($wsdl) && get_class($wsdl) == 'wsdl') {
             $this->wsdl = $wsdl;
             $this->externalWSDLURL = $this->wsdl->wsdl;
             $this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL);
         } else {
             $this->debug('Create wsdl from ' . $wsdl);
             $this->wsdl = new wsdl($wsdl);
             $this->externalWSDLURL = $wsdl;
         }
         $this->appendDebug($this->wsdl->getDebug());
         $this->wsdl->clearDebug();
         if ($err = $this->wsdl->getError()) {
             die('WSDL ERROR: ' . $err);
         }
     }
 }
Пример #26
0
 /**
  * sets the global debug level, which applies to future instances
  *
  * @param	int	$level	Debug level 0-9, where 0 turns off
  * @access	public
  */
 function setGlobalDebugLevel($level)
 {
     self::$globalDebugLevel = $level;
 }