Public Member Functions | Data Fields

ilBMFWSDL_Parser Class Reference

Inheritance diagram for ilBMFWSDL_Parser:
Collaboration diagram for ilBMFWSDL_Parser:

Public Member Functions

 ilBMFWSDL_Parser ($uri, &$wsdl, $docs=false)
 constructor
 parse ($uri)
 startElement ($parser, $name, $attrs)
 start-element handler
 endElement ($parser, $name)
 end-element handler.
 characterData ($parser, $data)
 Element content handler.
 mergeUrl ($parsed, $path)
 $parsed is an array returned by parse_url().
 _normalize ($path_str)

Data Fields

 $currentMessage
 Define internal arrays of bindings, ports, operations, messages, etc.
 $currentOperation
 $currentPortType
 $currentBinding
 $currentPort
 $cache
 Parser vars.
 $tns = null
 $soapns = array('soap')
 $uri = ''
 $wsdl = null
 $status = ''
 $element_stack = array()
 $parentElement = ''
 $schema = ''
 $schemaStatus = ''
 $schema_stack = array()
 $currentComplexType
 $schema_element_stack = array()
 $currentElement

Detailed Description

Definition at line 1017 of file class.ilBMFWSDL.php.


Member Function Documentation

ilBMFWSDL_Parser::_normalize ( path_str  ) 

Definition at line 1824 of file class.ilBMFWSDL.php.

Referenced by mergeUrl().

    {
        $pwd = '';
        $strArr = preg_split('/(\/)/', $path_str, -1, PREG_SPLIT_NO_EMPTY);
        $pwdArr = '';
        $j = 0;
        for ($i = 0; $i < count($strArr); $i++) {
            if ($strArr[$i] != ' ..') {
                if ($strArr[$i] != ' .') {
                    $pwdArr[$j] = $strArr[$i];
                    $j++;
                }
            } else {
                array_pop($pwdArr);
                $j--;
            }
        }
        $pStr = implode('/', $pwdArr);
        $pwd = (strlen($pStr) > 0) ? ('/' . $pStr) : '/';
        return $pwd;
    }

Here is the caller graph for this function:

ilBMFWSDL_Parser::characterData ( parser,
data 
)

Element content handler.

Definition at line 1729 of file class.ilBMFWSDL.php.

References $data.

    {
        // Store the documentation in the WSDL file.
        if ($this->currentTag == 'documentation') {
            $data = trim(preg_replace('/\s+/', ' ', $data));
            if (!strlen($data)) {
                return;
            }

            switch ($this->status) {
            case 'service':
                $ptr =& $this->wsdl->services[$this->currentService];
                break;

            case 'portType':
                $ptr =& $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation];
                break;

            case 'binding':
                $ptr =& $this->wsdl->bindings[$this->currentBinding];
                break;

            case 'message':
                $ptr =& $this->wsdl->messages[$this->currentMessage];
                break;

            case 'operation':
                break;

            case 'types':
                if (isset($this->currentComplexType) &&
                    isset($this->wsdl->complexTypes[$this->schema][$this->currentComplexType])) {
                    if ($this->currentElement) {
                        $ptr =& $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['elements'][$this->currentElement];
                    } else {
                        $ptr =& $this->wsdl->complexTypes[$this->schema][$this->currentComplexType];
                    }
                }
                break;
            }

            if (isset($ptr)) {
                if (!isset($ptr['documentation'])) {
                    $ptr['documentation'] = '';
                } else {
                    $ptr['documentation'] .= ' ';
                }
                $ptr['documentation'] .= $data;
            }
        }
    }

ilBMFWSDL_Parser::endElement ( parser,
name 
)

end-element handler.

Definition at line 1682 of file class.ilBMFWSDL.php.

    {
        $stacksize = count($this->element_stack);
        if ($stacksize) {
            if ($this->element_stack[$stacksize - 1] == 'definitions') {
                $this->status = '';
            }
            array_pop($this->element_stack);
        }

        if (stristr($name, 'schema')) {
            array_pop($this->schema_stack);
            $this->schema = '';
        }

        if ($this->schema) {
            array_pop($this->schema_stack);
            if (count($this->schema_stack) <= 1) {
                /* Correct the type for sequences with multiple
                 * elements. */
                if (isset($this->currentComplexType) && isset($this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'])
                    && $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] == 'Array'
                    && array_key_exists('elements', $this->wsdl->complexTypes[$this->schema][$this->currentComplexType])
                    && count($this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['elements']) > 1) {
                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Struct';
                }
            }
            if (stristr($name, 'complexType')) {
                $this->currentComplexType = '';
                if (count($this->schema_element_stack)) {
                    $this->currentElement = array_pop($this->schema_element_stack);
                } else {
                    $this->currentElement = '';
                }
            } elseif (stristr($name, 'element')) {
                if (count($this->schema_element_stack)) {
                    $this->currentElement = array_pop($this->schema_element_stack);
                } else {
                    $this->currentElement = '';
                }
            }
        }
    }

ilBMFWSDL_Parser::ilBMFWSDL_Parser ( uri,
&$  wsdl,
docs = false 
)

constructor

Definition at line 1054 of file class.ilBMFWSDL.php.

References $uri, $wsdl, ilBMFBase::ilBMFBase(), and parse().

    {
        parent::ilBMFBase('WSDLPARSER');
        $this->cache =& new ilBMFWSDL_Cache($wsdl->cacheUse, $wsdl->cacheMaxAge);
        $this->uri = $uri;
        $this->wsdl = &$wsdl;
        $this->docs = $docs;
        $this->parse($uri);
    }

Here is the call graph for this function:

ilBMFWSDL_Parser::mergeUrl ( parsed,
path 
)

$parsed is an array returned by parse_url().

private

Definition at line 1786 of file class.ilBMFWSDL.php.

References $uri, and _normalize().

Referenced by startElement().

    {
        if (!is_array($parsed)) {
            return false;
        }

        $uri = '';
        if (!empty($parsed['scheme'])) {
            $sep = (strtolower($parsed['scheme']) == 'mailto' ? ':' : '://');
            $uri = $parsed['scheme'] . $sep;
        }

        if (isset($parsed['pass'])) {
            $uri .= "$parsed[user]:$parsed[pass]@";
        } elseif (isset($parsed['user'])) {
            $uri .= "$parsed[user]@";
        }

        if (isset($parsed['host'])) {
            $uri .= $parsed['host'];
        }
        if (isset($parsed['port'])) {
            $uri .= ":$parsed[port]";
        }
        if ($path[0] != '/' && isset($parsed['path'])) {
            if ($parsed['path'][strlen($parsed['path']) - 1] != '/') {
                $path = dirname($parsed['path']) . '/' . $path;
            } else {
                $path = $parsed['path'] . $path;
            }
            $path = $this->_normalize($path);
        }
        $sep = $path[0] == '/' ? '' : '/';
        $uri .= $sep . $path;

        return $uri;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

ilBMFWSDL_Parser::parse ( uri  ) 

Definition at line 1064 of file class.ilBMFWSDL.php.

References $uri, and ilBMFBase_Object::_raiseSoapFault().

Referenced by ilBMFWSDL_Parser().

    {
        // Check whether content has been read.
        $fd = $this->cache->get($uri, $this->wsdl->proxy);
        if (PEAR::isError($fd)) {
            return $this->_raiseSoapFault($fd);
        }

        // Create an XML parser.
        $parser = xml_parser_create();
        xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
        xml_set_object($parser, $this);
        xml_set_element_handler($parser, 'startElement', 'endElement');
        if ($this->docs) {
            xml_set_character_data_handler($parser, 'characterData');
        }

        if (!xml_parse($parser, $fd, true)) {
            $detail = sprintf('XML error on line %d: %s',
                              xml_get_current_line_number($parser),
                              xml_error_string(xml_get_error_code($parser)));
            return $this->_raiseSoapFault("Unable to parse WSDL file $uri\n$detail");
        }
        xml_parser_free($parser);
        return true;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

ilBMFWSDL_Parser::startElement ( parser,
name,
attrs 
)

start-element handler

Definition at line 1094 of file class.ilBMFWSDL.php.

References $location, $namespace, $parentElement, $uri, ilBMFBase_Object::_raiseSoapFault(), and mergeUrl().

    {
        // Get element prefix.
        $qname =& new QName($name);
        if ($qname->ns) {
            $ns = $qname->ns;
            if ($ns && ((!$this->tns && strcasecmp($qname->name, 'definitions') == 0) || $ns == $this->tns)) {
                $name = $qname->name;
            }
        }
        $this->currentTag = $qname->name;
        $this->parentElement = '';
        $stack_size = count($this->element_stack);
        if ($stack_size) {
            $this->parentElement = $this->element_stack[$stack_size - 1];
        }
        $this->element_stack[] = $this->currentTag;

        // Find status, register data.
        switch ($this->status) {
        case 'types':
            // sect 2.2 wsdl:types
            // children: xsd:schema
            $parent_tag = '';
            $stack_size = count($this->schema_stack);
            if ($stack_size) {
                $parent_tag = $this->schema_stack[$stack_size - 1];
            }

            switch ($qname->name) {
            case 'schema':
                // No parent should be in the stack.
                if (!$parent_tag || $parent_tag == 'types') {
                    if (array_key_exists('targetNamespace', $attrs)) {
                        $this->schema = $this->wsdl->getNamespaceAttributeName($attrs['targetNamespace']);
                    } else {
                        $this->schema = $this->wsdl->getNamespaceAttributeName($this->wsdl->tns);
                    }
                    $this->wsdl->complexTypes[$this->schema] = array();
                    $this->wsdl->elements[$this->schema] = array();
                }
                break;

            case 'complexType':
                if ($parent_tag == 'schema') {
                    $this->currentComplexType = $attrs['name'];
                    if (!isset($attrs['namespace'])) {
                        $attrs['namespace'] = $this->schema;
                    }
                    $this->wsdl->complexTypes[$this->schema][$this->currentComplexType] = $attrs;
                    if (array_key_exists('base', $attrs)) {
                        $qn =& new QName($attrs['base']);
                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = $qn->name;
                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['namespace'] = $qn->ns;
                    } else {
                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Struct';
                    }
                    $this->schemaStatus = 'complexType';
                } else {
                    $this->wsdl->elements[$this->schema][$this->currentElement]['complex'] = true;
                }
                break;

            case 'element':
                if (isset($attrs['type'])) {
                    $qn =& new QName($attrs['type']);
                    $attrs['type'] = $qn->name;
                    if ($qn->ns && array_key_exists($qn->ns, $this->wsdl->namespaces)) {
                        $attrs['namespace'] = $qn->ns;
                    }
                }

                $parentElement = '';
                $stack_size = count($this->schema_element_stack);
                if ($stack_size > 0) {
                    $parentElement = $this->schema_element_stack[$stack_size - 1];
                }

                if (isset($attrs['ref'])) {
                    $qn =& new QName($attrs['ref']);
                    $this->currentElement = $qn->name;
                } else {
                    $this->currentElement = $attrs['name'];
                }
                $this->schema_element_stack[] = $this->currentElement;
                if (!isset($attrs['namespace'])) {
                    $attrs['namespace'] = $this->schema;
                }

                if ($parent_tag == 'schema') {
                    $this->wsdl->elements[$this->schema][$this->currentElement] = $attrs;
                    $this->wsdl->elements[$this->schema][$this->currentElement]['complex'] = false;
                    $this->schemaStatus = 'element';
                } elseif ($this->currentComplexType) {
                    // we're inside a complexType
                    if ((isset($this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['order']) &&
                         $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['order'] == 'sequence')
                        && $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] == 'Array') {
                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['arrayType'] = isset($attrs['type']) ? $attrs['type'] : null;
                    }
                    $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['elements'][$this->currentElement] = $attrs;
                } else {
                    $this->wsdl->elements[$this->schema][$parentElement]['elements'][$this->currentElement] = $attrs;
                }
                break;

            case 'complexContent':
            case 'simpleContent':
                break;

            case 'extension':
            case 'restriction':
                if ($this->schemaStatus == 'complexType') {
                    if (!empty($attrs['base'])) {
                        $qn =& new QName($attrs['base']);
                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = $qn->name;

                        // Types that extend from other types aren't
                        // *of* those types. Reflect this by denoting
                        // which type they extend. I'm leaving the
                        // 'type' setting here since I'm not sure what
                        // removing it might break at the moment.
                        if ($qname->name == 'extension') {
                            $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['extends'] = $qn->name;
                        }
                    } else {
                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Struct';
                    }
                }
                break;

            case 'sequence':
                if ($this->schemaStatus == 'complexType') {
                    $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['order'] = $qname->name;
                    if (!isset($this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'])) {
                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Array';
                    }
                }
                break;

            case 'all':
                $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['order'] = $qname->name;
                if (!isset($this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'])) {
                    $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Struct';
                }
                break;

            case 'choice':
                $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['order'] = $qname->name;
                if (!isset($this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'])) {
                    $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Array';
                }

            case 'attribute':
                if ($this->schemaStatus == 'complexType') {
                    if (isset($attrs['name'])) {
                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['attribute'][$attrs['name']] = $attrs;
                    } else {
                        if (isset($attrs['ref'])) {
                            $q =& new QName($attrs['ref']);
                            foreach ($attrs as $k => $v) {
                                if ($k != 'ref' && strstr($k, $q->name)) {
                                    $vq =& new QName($v);
                                    if ($q->name == 'arrayType') {
                                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType][$q->name] = $vq->name. $vq->arrayInfo;
                                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['type'] = 'Array';
                                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType]['namespace'] = $vq->ns;
                                    } else {
                                        $this->wsdl->complexTypes[$this->schema][$this->currentComplexType][$q->name] = $vq->name;
                                    }
                                }
                            }
                        }
                    }
                }
                break;
            }

            $this->schema_stack[] = $qname->name;
            break;

        case 'message':
            // sect 2.3 wsdl:message child wsdl:part
            switch ($qname->name) {
            case 'part':
                $qn = null;
                if (isset($attrs['type'])) {
                    $qn =& new QName($attrs['type']);
                } elseif (isset($attrs['element'])) {
                    $qn =& new QName($attrs['element']);
                }
                if ($qn) {
                    $attrs['type'] = $qn->name;
                    $attrs['namespace'] = $qn->ns;
                }
                $this->wsdl->messages[$this->currentMessage][$attrs['name']] = $attrs;
                // error in wsdl

            case 'documentation':
                break;

            default:
                break;
            }
            break;

        case 'portType':
            // sect 2.4
            switch ($qname->name) {
            case 'operation':
                // attributes: name
                // children: wsdl:input wsdl:output wsdl:fault
                $this->currentOperation = $attrs['name'];
                $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation] = $attrs;
                break;

            case 'input':
            case 'output':
            case 'fault':
                // wsdl:input wsdl:output wsdl:fault
                // attributes: name message parameterOrder(optional)
                if ($this->currentOperation) {
                    if (isset($this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name])) {
                        $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name] = array_merge($this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name], $attrs);
                    } else {
                        $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name] = $attrs;
                    }
                    if (array_key_exists('message', $attrs)) {
                        $qn =& new QName($attrs['message']);
                        $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]['message'] = $qn->name;
                        $this->wsdl->portTypes[$this->currentPortType][$this->currentOperation][$name]['namespace'] = $qn->ns;
                    }
                }
                break;

            case 'documentation':
                break;

            default:
                break;
            }
            break;

        case 'binding':
            $ns = $qname->ns ? $this->wsdl->namespaces[$qname->ns] : SCHEMA_WSDL;
            switch ($ns) {
            case SCHEMA_SOAP:
                // this deals with wsdl section 3 soap binding
                switch ($qname->name) {
                case 'binding':
                    // sect 3.3
                    // soap:binding, attributes: transport(required), style(optional, default = document)
                    // if style is missing, it is assumed to be 'document'
                    if (!isset($attrs['style'])) {
                        $attrs['style'] = 'document';
                    }
                    $this->wsdl->bindings[$this->currentBinding] = array_merge($this->wsdl->bindings[$this->currentBinding], $attrs);
                    break;

                case 'operation':
                    // sect 3.4
                    // soap:operation, attributes: soapAction(required), style(optional, default = soap:binding:style)
                    if (!isset($attrs['style'])) {
                        $attrs['style'] = $this->wsdl->bindings[$this->currentBinding]['style'];
                    }
                    if (isset($this->wsdl->bindings[$this->currentBinding]['operations'][$this->currentOperation])) {
                        $this->wsdl->bindings[$this->currentBinding]['operations'][$this->currentOperation] = array_merge($this->wsdl->bindings[$this->currentBinding]['operations'][$this->currentOperation], $attrs);
                    } else {
                        $this->wsdl->bindings[$this->currentBinding]['operations'][$this->currentOperation] = $attrs;
                    }
                    break;

                case 'body':
                    // sect 3.5
                    // soap:body attributes:
                    // part - optional.  listed parts must appear in body, missing means all parts appear in body
                    // use - required. encoded|literal
                    // encodingStyle - optional.  space seperated list of encodings (uri's)
                    $this->wsdl->bindings[$this->currentBinding]
                                    ['operations'][$this->currentOperation][$this->opStatus] = $attrs;
                    break;

                case 'fault':
                    // sect 3.6
                    // soap:fault attributes: name use  encodingStyle namespace
                    $this->wsdl->bindings[$this->currentBinding]
                                    ['operations'][$this->currentOperation][$this->opStatus] = $attrs;
                    break;

                case 'header':
                    // sect 3.7
                    // soap:header attributes: message part use encodingStyle namespace
                    $this->wsdl->bindings[$this->currentBinding]
                                    ['operations'][$this->currentOperation][$this->opStatus]['headers'][] = $attrs;
                    break;

                case 'headerfault':
                    // sect 3.7
                    // soap:header attributes: message part use encodingStyle namespace
                    $header = count($this->wsdl->bindings[$this->currentBinding]
                                    ['operations'][$this->currentOperation][$this->opStatus]['headers'])-1;
                    $this->wsdl->bindings[$this->currentBinding]
                                    ['operations'][$this->currentOperation][$this->opStatus]['headers'][$header]['fault'] = $attrs;
                    break;

                case 'documentation':
                    break;

                default:
                    // error!  not a valid element inside binding
                    break;
                }
                break;

            case SCHEMA_WSDL:
                // XXX verify correct namespace
                // for now, default is the 'wsdl' namespace
                // other possible namespaces include smtp, http, etc. for alternate bindings
                switch ($qname->name) {
                case 'operation':
                    // sect 2.5
                    // wsdl:operation attributes: name
                    $this->currentOperation = $attrs['name'];
                    break;

                case 'output':
                case 'input':
                case 'fault':
                    // sect 2.5
                    // wsdl:input attributes: name
                    $this->opStatus = $qname->name;
                    break;

                case 'documentation':
                    break;

                default:
                    break;
                }
                break;

            case SCHEMA_WSDL_HTTP:
                switch ($qname->name) {
                case 'binding':
                    // sect 4.4
                    // http:binding attributes: verb
                    // parent: wsdl:binding
                    $this->wsdl->bindings[$this->currentBinding] = array_merge($this->wsdl->bindings[$this->currentBinding], $attrs);
                    break;

                case 'operation':
                    // sect 4.5
                    // http:operation attributes: location
                    // parent: wsdl:operation
                    $this->wsdl->bindings[$this->currentBinding]['operations']
                                                        [$this->currentOperation] = $attrs;
                    break;

                case 'urlEncoded':
                    // sect 4.6
                    // http:urlEncoded attributes: location
                    // parent: wsdl:input wsdl:output etc.
                    $this->wsdl->bindings[$this->currentBinding]['operations'][$this->opStatus]
                                                        [$this->currentOperation]['uri'] = 'urlEncoded';
                    break;

                case 'urlReplacement':
                    // sect 4.7
                    // http:urlReplacement attributes: location
                    // parent: wsdl:input wsdl:output etc.
                    $this->wsdl->bindings[$this->currentBinding]['operations'][$this->opStatus]
                                                        [$this->currentOperation]['uri'] = 'urlReplacement';
                    break;

                case 'documentation':
                    break;

                default:
                    // error
                    break;
                }

            case SCHEMA_MIME:
                // sect 5
                // all mime parts are children of wsdl:input, wsdl:output, etc.
                // unsuported as of yet
                switch ($qname->name) {
                case 'content':
                    // sect 5.3 mime:content
                    // <mime:content part="nmtoken"? type="string"?/>
                    // part attribute only required if content is child of multipart related,
                    //        it contains the name of the part
                    // type attribute contains the mime type
                case 'multipartRelated':
                    // sect 5.4 mime:multipartRelated
                case 'part':
                case 'mimeXml':
                    // sect 5.6 mime:mimeXml
                    // <mime:mimeXml part="nmtoken"?/>
                    //
                case 'documentation':
                    break;

                default:
                    // error
                    break;
                }

            case SCHEMA_DIME:
                // DIME is defined in:
                // http://gotdotnet.com/team/xml_wsspecs/dime/WSDL-Extension-for-DIME.htm
                // all DIME parts are children of wsdl:input, wsdl:output, etc.
                // unsuported as of yet
                switch ($qname->name) {
                case 'message':
                    // sect 4.1 dime:message
                    // appears in binding section
                    $this->wsdl->bindings[$this->currentBinding]['dime'] = $attrs;
                    break;

                default:
                    break;
                }

            default:
                break;
            }
            break;

        case 'service':
            $ns = $qname->ns ? $this->wsdl->namespaces[$qname->ns] : SCHEMA_WSDL;

            switch ($qname->name) {
            case 'port':
                // sect 2.6 wsdl:port attributes: name binding
                $this->currentPort = $attrs['name'];
                $this->wsdl->services[$this->currentService]['ports'][$this->currentPort] = $attrs;
                // XXX hack to deal with binding namespaces
                $qn =& new QName($attrs['binding']);
                $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['binding'] = $qn->name;
                $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['namespace'] = $qn->ns;
                break;

            case 'address':
                $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['address'] = $attrs;
                // what TYPE of port is it?  SOAP or HTTP?
                $ns = $qname->ns ? $this->wsdl->namespaces[$qname->ns] : SCHEMA_WSDL;
                switch ($ns) {
                case SCHEMA_WSDL_HTTP:
                    $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['type']='http';
                    break;

                case SCHEMA_SOAP:
                    $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['type']='soap';
                    break;

                default:
                    // Shouldn't happen, we'll assume SOAP.
                    $this->wsdl->services[$this->currentService]['ports'][$this->currentPort]['type']='soap';
                }

                break;

            case 'documentation':
                break;

            default:
                break;
            }
        }

        // Top level elements found under wsdl:definitions.
        switch ($qname->name) {
        case 'import':
            // sect 2.1.1 wsdl:import attributes: namespace location
            if ((isset($attrs['location']) || isset($attrs['schemaLocation'])) &&
                !isset($this->wsdl->imports[$attrs['namespace']])) {
                $uri = isset($attrs['location']) ? $attrs['location'] : $attrs['schemaLocation'];
                $location = @parse_url($uri);
                if (!isset($location['scheme'])) {
                    $base = @parse_url($this->uri);
                    $uri = $this->mergeUrl($base, $uri);
                }

                $this->wsdl->imports[$attrs['namespace']] = $attrs;
                $import_parser_class = get_class($this);
                $import_parser =& new $import_parser_class($uri, $this->wsdl, $this->docs);
                if ($import_parser->fault) {
                    unset($this->wsdl->imports[$attrs['namespace']]);
                    return false;
                }
                $this->currentImport = $attrs['namespace'];
            }
            // Continue on to the 'types' case - lack of break; is
            // intentional.

        case 'types':
            // sect 2.2 wsdl:types
            $this->status = 'types';
            break;

        case 'schema':
            // We can hit this at the top level if we've been asked to
            // import an XSD file.
            if (!empty($attrs['targetNamespace'])) {
                $this->schema = $this->wsdl->getNamespaceAttributeName($attrs['targetNamespace']);
            } else {
                $this->schema = $this->wsdl->getNamespaceAttributeName($this->wsdl->tns);
            }
            $this->wsdl->complexTypes[$this->schema] = array();
            $this->wsdl->elements[$this->schema] = array();
            $this->schema_stack[] = $qname->name;
            $this->status = 'types';
            break;

        case 'message':
            // sect 2.3 wsdl:message attributes: name children:wsdl:part
            $this->status = 'message';
            if (isset($attrs['name'])) {
                $this->currentMessage = $attrs['name'];
                $this->wsdl->messages[$this->currentMessage] = array();
            }
            break;

        case 'portType':
            // sect 2.4 wsdl:portType
            // attributes: name
            // children: wsdl:operation
            $this->status = 'portType';
            $this->currentPortType = $attrs['name'];
            $this->wsdl->portTypes[$this->currentPortType] = array();
            break;

        case 'binding':
            // sect 2.5 wsdl:binding attributes: name type
            // children: wsdl:operation soap:binding http:binding
            if ($qname->ns && $qname->ns != $this->tns) {
                break;
            }
            $this->status = 'binding';
            $this->currentBinding = $attrs['name'];
            $qn =& new QName($attrs['type']);
            $this->wsdl->bindings[$this->currentBinding]['type'] = $qn->name;
            $this->wsdl->bindings[$this->currentBinding]['namespace'] = $qn->ns;
            break;

        case 'service':
            // sect 2.7 wsdl:service attributes: name children: ports
            $this->currentService = $attrs['name'];
            $this->wsdl->services[$this->currentService]['ports'] = array();
            $this->status = 'service';
            break;

        case 'definitions':
            // sec 2.1 wsdl:definitions
            // attributes: name targetNamespace xmlns:*
            // children: wsdl:import wsdl:types wsdl:message wsdl:portType wsdl:binding wsdl:service
            $this->wsdl->definition = $attrs;
            foreach ($attrs as $key => $value) {
                if (strstr($key, 'xmlns:') !== false) {
                    $qn =& new QName($key);
                    // XXX need to refactor ns handling.
                    $this->wsdl->namespaces[$qn->name] = $value;
                    $this->wsdl->ns[$value] = $qn->name;
                    if ($key == 'targetNamespace' ||
                        strcasecmp($value,SOAP_SCHEMA) == 0) {
                        $this->soapns[] = $qn->name;
                    } else {
                        if (in_array($value, $this->_XMLSchema)) {
                            $this->wsdl->xsd = $value;
                        }
                    }
                }
            }
            if (isset($ns) && $ns) {
                $namespace = 'xmlns:' . $ns;
                if (!$this->wsdl->definition[$namespace]) {
                    return $this->_raiseSoapFault("parse error, no namespace for $namespace", $this->uri);
                }
                $this->tns = $ns;
            }
            break;
        }
    }

Here is the call graph for this function:


Field Documentation

ilBMFWSDL_Parser::$cache

Parser vars.

Definition at line 1033 of file class.ilBMFWSDL.php.

ilBMFWSDL_Parser::$currentBinding

Definition at line 1027 of file class.ilBMFWSDL.php.

ilBMFWSDL_Parser::$currentComplexType

Definition at line 1047 of file class.ilBMFWSDL.php.

ilBMFWSDL_Parser::$currentElement

Definition at line 1049 of file class.ilBMFWSDL.php.

ilBMFWSDL_Parser::$currentMessage

Define internal arrays of bindings, ports, operations, messages, etc.

Definition at line 1024 of file class.ilBMFWSDL.php.

ilBMFWSDL_Parser::$currentOperation

Definition at line 1025 of file class.ilBMFWSDL.php.

ilBMFWSDL_Parser::$currentPort

Definition at line 1028 of file class.ilBMFWSDL.php.

ilBMFWSDL_Parser::$currentPortType

Definition at line 1026 of file class.ilBMFWSDL.php.

ilBMFWSDL_Parser::$element_stack = array()

Definition at line 1041 of file class.ilBMFWSDL.php.

ilBMFWSDL_Parser::$parentElement = ''

Definition at line 1042 of file class.ilBMFWSDL.php.

Referenced by startElement().

ilBMFWSDL_Parser::$schema = ''

Definition at line 1044 of file class.ilBMFWSDL.php.

ilBMFWSDL_Parser::$schema_element_stack = array()

Definition at line 1048 of file class.ilBMFWSDL.php.

ilBMFWSDL_Parser::$schema_stack = array()

Definition at line 1046 of file class.ilBMFWSDL.php.

ilBMFWSDL_Parser::$schemaStatus = ''

Definition at line 1045 of file class.ilBMFWSDL.php.

ilBMFWSDL_Parser::$soapns = array('soap')

Definition at line 1036 of file class.ilBMFWSDL.php.

ilBMFWSDL_Parser::$status = ''

Definition at line 1040 of file class.ilBMFWSDL.php.

ilBMFWSDL_Parser::$tns = null

Definition at line 1035 of file class.ilBMFWSDL.php.

ilBMFWSDL_Parser::$uri = ''

Definition at line 1037 of file class.ilBMFWSDL.php.

Referenced by ilBMFWSDL_Parser(), mergeUrl(), parse(), and startElement().

ilBMFWSDL_Parser::$wsdl = null

Definition at line 1038 of file class.ilBMFWSDL.php.

Referenced by ilBMFWSDL_Parser().


The documentation for this class was generated from the following file: