📄 wsdl.php
字号:
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->getNamespac
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -