|
| __construct ($name, $uri, $strategy=true) |
|
| setUri ($uri) |
|
| setComplexTypeStrategy ($strategy) |
|
| getComplexTypeStrategy () |
|
| addMessage ($name, $parts) |
|
| addPortType ($name) |
|
| addPortOperation ($portType, $name, $input=false, $output=false, $fault=false) |
|
| addBinding ($name, $portType) |
|
| addBindingOperation ($binding, $name, $input=false, $output=false, $fault=false) |
|
| addSoapBinding ($binding, $style='document', $transport='http://schemas.xmlsoap.org/soap/http') |
|
| addSoapOperation ($binding, $soap_action) |
|
| addService ($name, $port_name, $binding, $location) |
|
| addDocumentation ($input_node, $documentation) |
|
| addTypes ($types) |
|
| addType ($type) |
|
| getTypes () |
|
| getSchema () |
|
| toXML () |
|
| toDomDocument () |
|
| dump ($filename=false) |
|
| getType ($type) |
|
| addSchemaTypeSection () |
|
| addComplexType ($type) |
|
| addElement ($element) |
|
Definition at line 41 of file Wsdl.php.
◆ __construct()
__construct |
( |
|
$name, |
|
|
|
$uri, |
|
|
|
$strategy = true |
|
) |
| |
Constructor
- Parameters
-
- Todo:
- change DomDocument object creation from cparsing to construxting using API It also should authomatically escape $name and $uri values if necessary
Definition at line 83 of file Wsdl.php.
85 if ($uri instanceof Zend_Uri_Http) {
86 $uri = $uri->getUri();
94 $wsdl =
"<?xml version='1.0' ?> 95 <definitions name='$name' targetNamespace='$uri' 96 xmlns='http://schemas.xmlsoap.org/wsdl/' 98 xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' 99 xmlns:xsd='http://www.w3.org/2001/XMLSchema' 100 xmlns:soap-enc='http://schemas.xmlsoap.org/soap/encoding/' 101 xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'></definitions>";
102 $this->_dom =
new DOMDocument();
104 #require_once 'Zend/Server/Exception.php'; 107 $this->_wsdl = $this->_dom->documentElement;
static scan($xml, DOMDocument $dom=null)
setComplexTypeStrategy($strategy)
◆ addBinding()
addBinding |
( |
|
$name, |
|
|
|
$portType |
|
) |
| |
Add a binding element to WSDL
- Parameters
-
string | $name | Name of the Binding |
string | $type | name of the portType to bind |
- Returns
- object The new binding's XML_Tree_Node for use with addBindingOperation and addDocumentation
Definition at line 275 of file Wsdl.php.
277 $binding = $this->_dom->createElement(
'binding');
278 $binding->setAttribute(
'name',
$name);
279 $binding->setAttribute(
'type', $portType);
281 $this->_wsdl->appendChild($binding);
if(!isset($_GET['name'])) $name
◆ addBindingOperation()
addBindingOperation |
( |
|
$binding, |
|
|
|
$name, |
|
|
|
$input = false , |
|
|
|
$output = false , |
|
|
|
$fault = false |
|
) |
| |
Add an operation to a binding element
- Parameters
-
object | $binding | A binding XML_Tree_Node returned by addBinding |
array | $input | An array of attributes for the input element, allowed keys are: 'use', 'namespace', 'encodingStyle'. More Information |
array | $output | An array of attributes for the output element, allowed keys are: 'use', 'namespace', 'encodingStyle'. More Information |
array | $fault | An array of attributes for the fault element, allowed keys are: 'name', 'use', 'namespace', 'encodingStyle'. More Information |
- Returns
- object The new Operation's XML_Tree_Node for use with addSoapOperation and addDocumentation
Note. Do we really need name attribute to be also set at wsdl:fault node??? W3C standard doesn't mention it (http://www.w3.org/TR/wsdl#_soap:fault) But some real world WSDLs use it, so it may be required for compatibility reasons.
Definition at line 295 of file Wsdl.php.
297 $operation = $this->_dom->createElement(
'operation');
298 $operation->setAttribute(
'name',
$name);
300 if (is_array($input)) {
301 $node = $this->_dom->createElement(
'input');
302 $soap_node = $this->_dom->createElement(
'soap:body');
306 $node->appendChild($soap_node);
307 $operation->appendChild($node);
311 $node = $this->_dom->createElement(
'output');
312 $soap_node = $this->_dom->createElement(
'soap:body');
316 $node->appendChild($soap_node);
317 $operation->appendChild($node);
320 if (is_array($fault)) {
321 $node = $this->_dom->createElement(
'fault');
327 if (isset($fault[
'name'])) {
328 $node->setAttribute(
'name', $fault[
'name']);
331 $soap_node = $this->_dom->createElement(
'soap:fault');
335 $node->appendChild($soap_node);
336 $operation->appendChild($node);
339 $binding->appendChild($operation);
if(!isset($_GET['name'])) $name
◆ addComplexType()
Add a types data type definition
- Parameters
-
string | $type | Name of the class to be specified |
- Returns
- string XSD Type for the given PHP type
Definition at line 597 of file Wsdl.php.
605 $strategy->setContext($this);
607 return $strategy->addComplexType(
$type);
◆ addDocumentation()
addDocumentation |
( |
|
$input_node, |
|
|
|
$documentation |
|
) |
| |
Add a documentation element to any element in the WSDL.
Note that the WSDL specification uses 'document', but the WSDL schema uses 'documentation' instead. The WS-I Basic Profile 1.1 recommends using 'documentation'.
- Parameters
-
object | $input_node | An XML_Tree_Node returned by another method to add the documentation to |
string | $documentation | Human readable documentation for the node |
- Returns
- DOMElement The documentation element
Definition at line 426 of file Wsdl.php.
428 if ($input_node === $this) {
429 $node = $this->_dom->documentElement;
434 $doc = $this->_dom->createElement(
'documentation');
435 $doc_cdata = $this->_dom->createTextNode(str_replace(array(
"\r\n",
"\r"),
"\n", $documentation));
436 $doc->appendChild($doc_cdata);
438 if($node->hasChildNodes()) {
439 $node->insertBefore($doc, $node->firstChild);
441 $node->appendChild($doc);
◆ addElement()
Add an xsd:element represented as an array to the schema.
Array keys represent attribute names and values their respective value. The 'sequence', 'all' and 'choice' keys must have an array of elements as their value, to add them to a nested complexType.
Example: array( 'name' => 'MyElement', 'sequence' => array( array('name' => 'myString', 'type' => 'string'), array('name' => 'myInteger', 'type' => 'int') ) ); Resulting XML: <xsd:element name="MyElement"><xsd:complexType><xsd:sequence> <xsd:element name="myString" type="string"/> <xsd:element name="myInteger" type="int"/> </xsd:sequence></xsd:complexType></xsd:element>
- Parameters
-
array | $element | an xsd:element represented as an array |
- Returns
- string xsd:element for the given element array
Definition at line 663 of file Wsdl.php.
666 $elementXml = $this->_parseElement(
$element);
667 $schema->appendChild($elementXml);
◆ addMessage()
addMessage |
( |
|
$name, |
|
|
|
$parts |
|
) |
| |
Add a message element to the WSDL
- Parameters
-
string | $name | Name for the message |
array | $parts | An array of parts The array is constructed like: 'name of part' => 'part xml schema data type' or 'name of part' => array('type' => 'part xml schema type') or 'name of part' => array('element' => 'part xml element name') |
- Returns
- object The new message's XML_Tree_Node for use in addDocumentation
Definition at line 191 of file Wsdl.php.
193 $message = $this->_dom->createElement(
'message');
197 if (
sizeof($parts) > 0) {
199 $part = $this->_dom->createElement(
'part');
200 $part->setAttribute(
'name',
$name);
201 if (is_array(
$type)) {
203 $part->setAttribute($key,
$value);
206 $part->setAttribute(
'type',
$type);
212 $this->_wsdl->appendChild(
$message);
if(!isset($_GET['name'])) $name
◆ addPortOperation()
addPortOperation |
( |
|
$portType, |
|
|
|
$name, |
|
|
|
$input = false , |
|
|
|
$output = false , |
|
|
|
$fault = false |
|
) |
| |
Add an operation element to a portType element
- Parameters
-
object | $portType | a portType XML_Tree_Node, from addPortType |
string | $name | Operation name |
string | $input | Input Message |
string | $output | Output Message |
string | $fault | Fault Message |
- Returns
- object The new operation's XML_Tree_Node for use in addDocumentation
Definition at line 242 of file Wsdl.php.
244 $operation = $this->_dom->createElement(
'operation');
245 $operation->setAttribute(
'name',
$name);
247 if (is_string($input) && (strlen(trim($input)) >= 1)) {
248 $node = $this->_dom->createElement(
'input');
249 $node->setAttribute(
'message', $input);
250 $operation->appendChild($node);
253 $node= $this->_dom->createElement(
'output');
254 $node->setAttribute(
'message',
$output);
255 $operation->appendChild($node);
257 if (is_string($fault) && (strlen(trim($fault)) >= 1)) {
258 $node = $this->_dom->createElement(
'fault');
259 $node->setAttribute(
'message', $fault);
260 $operation->appendChild($node);
263 $portType->appendChild($operation);
if(!isset($_GET['name'])) $name
◆ addPortType()
Add a portType element to the WSDL
- Parameters
-
string | $name | portType element's name |
- Returns
- object The new portType's XML_Tree_Node for use in addPortOperation and addDocumentation
Definition at line 223 of file Wsdl.php.
225 $portType = $this->_dom->createElement(
'portType');
226 $portType->setAttribute(
'name',
$name);
227 $this->_wsdl->appendChild($portType);
if(!isset($_GET['name'])) $name
◆ addSchemaTypeSection()
This function makes sure a complex types section and schema additions are set.
- Returns
- Zend_Soap_Wsdl
Definition at line 579 of file Wsdl.php.
581 if ($this->_schema ===
null) {
582 $this->_schema = $this->_dom->createElement(
'xsd:schema');
583 $this->_schema->setAttribute(
'targetNamespace', $this->_uri);
584 $types = $this->_dom->createElement(
'types');
585 $types->appendChild($this->_schema);
586 $this->_wsdl->appendChild($types);
◆ addService()
addService |
( |
|
$name, |
|
|
|
$port_name, |
|
|
|
$binding, |
|
|
|
$location |
|
) |
| |
Add a service element to the WSDL
- Parameters
-
string | $name | Service Name |
string | $port_name | Name of the port for the service |
string | $binding | Binding for the port |
string | $location | SOAP Address for the service |
- Returns
- object The new service's XML_Tree_Node for use with addDocumentation
Definition at line 392 of file Wsdl.php.
394 if ($location instanceof Zend_Uri_Http) {
395 $location = $location->getUri();
397 $service = $this->_dom->createElement(
'service');
400 $port = $this->_dom->createElement(
'port');
401 $port->setAttribute(
'name', $port_name);
402 $port->setAttribute(
'binding', $binding);
404 $soap_address = $this->_dom->createElement(
'soap:address');
405 $soap_address->setAttribute(
'location', $location);
407 $port->appendChild($soap_address);
410 $this->_wsdl->appendChild(
$service);
if(!isset($_GET['name'])) $name
◆ addSoapBinding()
addSoapBinding |
( |
|
$binding, |
|
|
|
$style = 'document' , |
|
|
|
$transport = 'http://schemas.xmlsoap.org/soap/http' |
|
) |
| |
Add a SOAP binding element to a Binding element
- Parameters
-
object | $binding | A binding XML_Tree_Node returned by addBinding |
string | $style | binding style, possible values are "rpc" (the default) and "document" |
string | $transport | Transport method (defaults to HTTP) |
- Returns
- boolean
Definition at line 352 of file Wsdl.php.
354 $soap_binding = $this->_dom->createElement(
'soap:binding');
355 $soap_binding->setAttribute(
'style', $style);
356 $soap_binding->setAttribute(
'transport', $transport);
358 $binding->appendChild($soap_binding);
360 return $soap_binding;
◆ addSoapOperation()
addSoapOperation |
( |
|
$binding, |
|
|
|
$soap_action |
|
) |
| |
Add a SOAP operation to an operation element
- Parameters
-
object | $operation | An operation XML_Tree_Node returned by addBindingOperation |
string | $soap_action | SOAP Action |
- Returns
- boolean
Definition at line 370 of file Wsdl.php.
372 if ($soap_action instanceof Zend_Uri_Http) {
373 $soap_action = $soap_action->getUri();
375 $soap_operation = $this->_dom->createElement(
'soap:operation');
376 $soap_operation->setAttribute(
'soapAction', $soap_action);
378 $binding->insertBefore($soap_operation, $binding->firstChild);
380 return $soap_operation;
◆ addType()
Add a complex type name that is part of this WSDL and can be used in signatures.
- Parameters
-
- Returns
- Zend_Soap_Wsdl
Definition at line 469 of file Wsdl.php.
471 if(!in_array(
$type, $this->_includedTypes)) {
472 $this->_includedTypes[] =
$type;
◆ addTypes()
Add WSDL Types element
- Parameters
-
object | $types | A DomDocument|DomNode|DomElement|DomDocumentFragment with all the XML Schema types defined in it |
Definition at line 452 of file Wsdl.php.
454 if ($types instanceof DomDocument) {
455 $dom = $this->_dom->importNode($types->documentElement);
456 $this->_wsdl->appendChild($types->documentElement);
457 }
elseif ($types instanceof DomNode || $types instanceof DomElement || $types instanceof DomDocumentFragment ) {
458 $dom = $this->_dom->importNode($types);
459 $this->_wsdl->appendChild($dom);
elseif(isset( $params[ 'redirect_parent']))
◆ dump()
dump |
( |
|
$filename = false | ) |
|
Echo the WSDL as XML
- Returns
- boolean
Definition at line 526 of file Wsdl.php.
◆ getComplexTypeStrategy()
getComplexTypeStrategy |
( |
| ) |
|
◆ getSchema()
Return the Schema node of the WSDL
- Returns
- DOMElement
Definition at line 492 of file Wsdl.php.
494 if($this->_schema ==
null) {
498 return $this->_schema;
◆ getType()
Returns an XSD Type for the given PHP type
- Parameters
-
string | $type | PHP Type to get the XSD type for |
- Returns
- string
Definition at line 542 of file Wsdl.php.
544 switch (strtolower(
$type)) {
559 return 'xsd:boolean';
561 return 'soap-enc:Array';
565 return 'xsd:anyType';
◆ getTypes()
Return an array of all currently included complex types
- Returns
- array
Definition at line 482 of file Wsdl.php.
484 return $this->_includedTypes;
◆ setComplexTypeStrategy()
setComplexTypeStrategy |
( |
|
$strategy | ) |
|
Set a strategy for complex type detection and handling
- Todo:
- Boolean is for backwards compability with extractComplexType object var. Remove it in later versions.
- Parameters
-
- Returns
- Zend_Soap_Wsdl
Definition at line 144 of file Wsdl.php.
146 if($strategy ===
true) {
147 #require_once "Zend/Soap/Wsdl/Strategy/DefaultComplexType.php"; 149 }
else if($strategy ===
false) {
150 #require_once "Zend/Soap/Wsdl/Strategy/AnyType.php"; 152 }
else if(is_string($strategy)) {
154 $strategy =
new $strategy();
156 #require_once "Zend/Soap/Wsdl/Exception.php"; 158 sprintf(
"Strategy with name '%s does not exist.", $strategy
164 #require_once "Zend/Soap/Wsdl/Exception.php"; 167 $this->_strategy = $strategy;
◆ setUri()
Set a new uri for this WSDL
- Parameters
-
string | Zend_Uri_Http | $uri | |
- Returns
- Zend_Server_Wsdl
Definition at line 118 of file Wsdl.php.
120 if ($uri instanceof Zend_Uri_Http) {
121 $uri = $uri->getUri();
123 $oldUri = $this->_uri;
126 if($this->_dom !==
null) {
128 $xml = $this->_dom->saveXML();
129 $xml = str_replace($oldUri, $uri, $xml);
130 $this->_dom =
new DOMDocument();
static scan($xml, DOMDocument $dom=null)
◆ toDomDocument()
Return DOM Document
- Returns
- object DomDocum ent
Definition at line 516 of file Wsdl.php.
◆ toXML()
Return the WSDL as XML
- Returns
- string WSDL as XML
Definition at line 506 of file Wsdl.php.
508 return $this->_dom->saveXML();
◆ $_strategy
Strategy for detection of complex types
Definition at line 73 of file Wsdl.php.
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Soap/Wsdl.php