⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wsdl.php.svn-base

📁 PHP 知识管理系统(基于树结构的知识管理系统), 英文原版的PHP源码。
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
    /**     * Given a datatype, what function handles the processing?     *     * This is used for doc/literal requests where we receive a datatype, and     * we need to pass it to a method in out server class.     *     * @param string $datatype     * @param string $namespace     * @return string     * @access public     */    function getDataHandler($datatype, $namespace)    {        // See if we have an element by this name.        if (isset($this->namespaces[$namespace])) {            $namespace = $this->namespaces[$namespace];        }        if (isset($this->ns[$namespace])) {            $nsp = $this->ns[$namespace];            //if (!isset($this->elements[$nsp]))            //    $nsp = $this->namespaces[$nsp];            if (isset($this->elements[$nsp][$datatype])) {                $checkmessages = array();                // Find what messages use this datatype.                foreach ($this->messages as $messagename => $message) {                    foreach ($message as $partname => $part) {                        if ($part['type'] == $datatype) {                            $checkmessages[] = $messagename;                            break;                        }                    }                }                // Find the operation that uses this message.                $dataHandler = null;                foreach($this->portTypes as $portname => $porttype) {                    foreach ($porttype as $opname => $opinfo) {                        foreach ($checkmessages as $messagename) {                            if ($opinfo['input']['message'] == $messagename) {                                return $opname;                            }                        }                    }                }            }        }        return null;    }    function getSoapAction($portName, $operation)    {        if ($this->__isfault()) {            return $this->__getfault();        }        if (!empty($this->bindings[$this->services[$this->service]['ports'][$portName]['binding']]['operations'][$operation]['soapAction'])) {            return $this->bindings[$this->services[$this->service]['ports'][$portName]['binding']]['operations'][$operation]['soapAction'];        }        return false;    }    function getNamespace($portName, $operation)    {        if ($this->__isfault()) {            return $this->__getfault();        }        if (!empty($this->bindings[$this->services[$this->service]['ports'][$portName]['binding']]['operations'][$operation]['input']['namespace'])) {            return $this->bindings[$this->services[$this->service]['ports'][$portName]['binding']]['operations'][$operation]['input']['namespace'];        }        return false;    }    function getNamespaceAttributeName($namespace)    {        /* If it doesn't exist at first, flip the array and check again. */        if (empty($this->ns[$namespace])) {            $this->ns = array_flip($this->namespaces);        }        /* If it doesn't exist now, add it. */        if (empty($this->ns[$namespace])) {            return $this->addNamespace($namespace);        }        return $this->ns[$namespace];    }    function addNamespace($namespace)    {        if (!empty($this->ns[$namespace])) {            return $this->ns[$namespace];        }        $n = count($this->ns);        $attr = 'ns' . $n;        $this->namespaces['ns' . $n] = $namespace;        $this->ns[$namespace] = $attr;        return $attr;    }    function _validateString($string)    {        return preg_match('/^[\w_:#\/]+$/', $string);    }    function _addArg(&$args, &$argarray, $argname)    {        if ($args) {            $args .= ', ';        }        $args .= '$' . $argname;        if (!$this->_validateString($argname)) {            return;        }        if ($argarray) {            $argarray .= ', ';        }        $argarray .= "'$argname' => $" . $argname;    }    function _elementArg(&$args, &$argarray, &$_argtype, $_argname)    {        $comments = '';        $el = $this->elements[$_argtype['namespace']][$_argtype['type']];        $tns = isset($this->ns[$el['namespace']])            ? $this->ns[$el['namespace']]            : $_argtype['namespace'];        if (!empty($el['complex']) ||            (isset($el['type']) &&             isset($this->complexTypes[$tns][$el['type']]))) {            // The element is a complex type.            $comments .= "        // {$_argtype['type']} is a ComplexType, refer to the WSDL for more info.\n";            $attrname = "{$_argtype['type']}_attr";            if (isset($el['type']) &&                isset($this->complexTypes[$tns][$el['type']]['attribute'])) {                $comments .= "        // {$_argtype['type']} may require attributes, refer to the WSDL for more info.\n";            }            $comments .= "        \${$attrname}['xmlns'] = '{$this->namespaces[$_argtype['namespace']]}';\n";            $comments .= "        \${$_argtype['type']} =& new SOAP_Value('{$_argtype['type']}', false, \${$_argtype['type']}, \$$attrname);\n";            $this->_addArg($args, $argarray, $_argtype['type']);            if (isset($el['type']) &&                isset($this->complexTypes[$tns][$el['type']]['attribute'])) {                if ($args) {                    $args .= ', ';                }                $args .= '$' . $attrname;            }        } elseif (isset($el['elements'])) {            foreach ($el['elements'] as $ename => $element) {                $comments .= "        \$$ename =& new SOAP_Value('{{$this->namespaces[$element['namespace']]}}$ename', '" .                    (isset($element['type']) ? $element['type'] : false) .                    "', \$$ename);\n";                $this->_addArg($args, $argarray, $ename);            }        } else {            $comments .= "        \$$_argname =& new SOAP_Value('{{$this->namespaces[$tns]}}$_argname', '{$el['type']}', \$$_argname);\n";            $this->_addArg($args, $argarray, $_argname);        }        return $comments;    }    function _complexTypeArg(&$args, &$argarray, &$_argtype, $_argname)    {        $comments = '';        if (isset($this->complexTypes[$_argtype['namespace']][$_argtype['type']])) {            $comments  = "        // $_argname is a ComplexType {$_argtype['type']},\n" .                "        // refer to wsdl for more info\n";            if (isset($this->complexTypes[$_argtype['namespace']][$_argtype['type']]['attribute'])) {                $comments .= "        // $_argname may require attributes, refer to wsdl for more info\n";            }            $wrapname = '{' . $this->namespaces[$_argtype['namespace']].'}' . $_argtype['type'];            $comments .= "        \$$_argname =& new SOAP_Value('$_argname', '$wrapname', \$$_argname);\n";        }        $this->_addArg($args, $argarray, $_argname);        return $comments;    }    /**     * Generates stub code from the WSDL that can be saved to a file or eval'd     * into existence.     */    function generateProxyCode($port = '', $classname = '')    {        if ($this->__isfault()) {            return $this->__getfault();        }        $multiport = count($this->services[$this->service]['ports']) > 1;        if (!$port) {            reset($this->services[$this->service]['ports']);            $port = current($this->services[$this->service]['ports']);        }        // XXX currently do not support HTTP ports        if ($port['type'] != 'soap') {            return null;        }        // XXX currentPort is BAD        $clienturl = $port['address']['location'];        if (!$classname) {            if ($multiport || $port) {                $classname = 'WebService_' . $this->service . '_' . $port['name'];            } else {                $classname = 'WebService_' . $this->service;            }            $classname = preg_replace('/[ .\-\(\)]+/', '_', $classname);        }        if (!$this->_validateString($classname)) {            return null;        }        if (is_array($this->proxy) && count($this->proxy)) {            $class = "class $classname extends SOAP_Client\n{\n" .            "    function $classname(\$path = '$clienturl')\n    {\n" .            "        \$this->SOAP_Client(\$path, 0, 0,\n" .            '                           array(';            foreach ($this->proxy as $key => $val) {                if (is_array($val)) {                    $class .= "'$key' => array(";                    foreach ($val as $key2 => $val2) {                        $class .= "'$key2' => '$val2', ";                    }                    $class .= ')';                } else {                    $class .= "'$key' => '$val', ";                }            }            $class .= "));\n    }\n";            $class = str_replace(', ))', '))', $class);        } else {            $class = "class $classname extends SOAP_Client\n{\n" .            "    function $classname(\$path = '$clienturl')\n    {\n" .            "        \$this->SOAP_Client(\$path, 0);\n" .            "    }\n";        }        // Get the binding, from that get the port type.        $primaryBinding = $port['binding'];        $primaryBinding = preg_replace("/^(.*:)/", '', $primaryBinding);        $portType = $this->bindings[$primaryBinding]['type'];        $portType = preg_replace("/^(.*:)/", '', $portType);        $style = $this->bindings[$primaryBinding]['style'];        // XXX currentPortType is BAD        foreach ($this->portTypes[$portType] as $opname => $operation) {            $binding = $this->bindings[$primaryBinding]['operations'][$opname];            if (isset($binding['soapAction'])) {                $soapaction = $binding['soapAction'];            } else {                $soapaction = null;            }            if (isset($binding['style'])) {                $opstyle = $binding['style'];            } else {                $opstyle = $style;            }            $use = $binding['input']['use'];            if ($use == 'encoded') {                $namespace = $binding['input']['namespace'];            } else {                $bindingType = $this->bindings[$primaryBinding]['type'];                $ns = $this->portTypes[$bindingType][$opname]['input']['namespace'];                $namespace = $this->namespaces[$ns];            }            $args = '';            $argarray = '';            $comments = '';            $wrappers = '';            foreach ($operation['input'] as $argname => $argtype) {                if ($argname == 'message') {                    foreach ($this->messages[$argtype] as $_argname => $_argtype) {                        if ($opstyle == 'document' && $use == 'literal' &&                            $_argtype['name'] == 'parameters') {                            // The type or element refered to is used for                            // parameters.                            $elattrs = null;                            $element = $_argtype['element'];                            $el = $this->elements[$_argtype['namespace']][$_argtype['type']];                            if ($el['complex']) {                                $namespace = $this->namespaces[$_argtype['namespace']];                                // XXX need to wrap the parameters in a                                // SOAP_Value.                            }                            if (isset($el['elements'])) {                                foreach ($el['elements'] as $elname => $elattrs) {                                    // Is the element a complex type?                                    if (isset($this->complexTypes[$elattrs['namespace']][$elname])) {                                        $comments .= $this->_complexTypeArg($args, $argarray, $_argtype, $_argname);                                    } else {                                        $this->_addArg($args, $argarray, $elname);                                    }                                }                            }                            if ($el['complex'] && $argarray) {                                $wrapname = '{' . $this->namespaces[$_argtype['namespace']].'}' . $el['name'];                                $comments .= "        \${$el['name']} =& new SOAP_Value('$wrapname', false, \$v = array($argarray));\n";                                $argarray = "'{$el['name']}' => \${$el['name']}";                            }                        } else {                            if (isset($_argtype['element'])) {                                // Element argument.                                $comments .= $this->_elementArg($args, $argarray, $_argtype, $_argtype['type']);                            } else {                                // Complex type argument.                                $comments .= $this->_complexTypeArg($args, $argarray, $_argtype, $_argname);                            }                        }                    }                }            }            // Validate entries.            // Operation names are function names, so try to make sure it's            // legal. This could potentially cause collisions, but let's try

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -