Zend Framework  3.0
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Wsdl Class Reference

Public Member Functions

 __construct ($name, $uri, ComplexTypeStrategy $strategy=null, array $classMap=[])
 
 getTargetNamespace ()
 Retrieve target namespace of the WSDL document.
 
 getClassMap ()
 Get the class map of php to wsdl mappings.
 
 setClassMap (array $classMap)
 Set the class map of php to wsdl mappings.
 
 setUri ($uri)
 Set a new uri for this WSDL.
 
 getUri ()
 Return WSDL uri.
 
 sanitizeUri ($uri)
 Function for sanitizing uri.
 
 setComplexTypeStrategy (ComplexTypeStrategy $strategy)
 Set a strategy for complex type detection and handling.
 
 getComplexTypeStrategy ()
 Get the current complex type strategy.
 
 addMessage ($messageName, $parts)
 Add a message element to the WSDL.
 
 addPortType ($name)
 Add a portType element to the WSDL.
 
 addPortOperation ($portType, $name, $input=false, $output=false, $fault=false)
 Add an operation element to a portType element.
 
 addBinding ($name, $portType)
 Add a binding element to WSDL.
 
 addBindingOperation ($binding, $name, $input=false, $output=false, $fault=false, $soapVersion=SOAP_1_1)
 Add an operation to a binding element.
 
 addSoapBinding ($binding, $style= 'document', $transport= 'http://schemas.xmlsoap.org/soap/http', $soapVersion=SOAP_1_1)
 Add a SOAP binding element to a Binding element.
 
 addSoapOperation ($operation, $soapAction, $soapVersion=SOAP_1_1)
 Add a SOAP operation to an operation element.
 
 addService ($name, $portName, $binding, $location, $soapVersion=SOAP_1_1)
 Add a service element to the WSDL.
 
 addDocumentation ($inputNode, $documentation)
 Add a documentation element to any element in the WSDL.
 
 addTypes (DOMNode $types)
 Add WSDL Types element.
 
 addType ($type, $wsdlType)
 Add a complex type name that is part of this WSDL and can be used in signatures.
 
 getTypes ()
 Return an array of all currently included complex types.
 
 getSchema ()
 Return the Schema node of the WSDL.
 
 toXML ()
 Return the WSDL as XML.
 
 toDomDocument ()
 Return DOM Document.
 
 dump ($filename=false)
 Echo the WSDL as XML.
 
 getType ($type)
 Returns an XSD Type for the given PHP type.
 
 addSchemaTypeSection ()
 This function makes sure a complex types section and schema additions are set.
 
 translateType ($type)
 Translate PHP type into WSDL QName.
 
 addComplexType ($type)
 Add a types data type definition.
 
 addElement ($element)
 Add an xsd:element represented as an array to the schema.
 

Public Attributes

const XML_NS = 'xmlns'
 #@+ XML Namespace uris and prefixes.
 
const XML_NS_URI = 'http://www.w3.org/2000/xmlns/'
 
const WSDL_NS = 'wsdl'
 
const WSDL_NS_URI = 'http://schemas.xmlsoap.org/wsdl/'
 
const SOAP_11_NS = 'soap'
 
const SOAP_11_NS_URI = 'http://schemas.xmlsoap.org/wsdl/soap/'
 
const SOAP_12_NS = 'soap12'
 
const SOAP_12_NS_URI = 'http://schemas.xmlsoap.org/wsdl/soap12/'
 
const SOAP_ENC_NS = 'soap-enc'
 
const SOAP_ENC_URI = 'http://schemas.xmlsoap.org/soap/encoding/'
 
const XSD_NS = 'xsd'
 
const XSD_NS_URI = 'http://www.w3.org/2001/XMLSchema'
 
const TYPES_NS = 'tns'
 

Protected Member Functions

 getDOMDocument ($name, $uri=null)
 Get the wsdl XML document with all namespaces and required attributes.
 
 parseElement ($element)
 Parse an xsd:element represented as an array into a DOMElement.
 
 sanitizeAttributeValueByName ($name, $value)
 Prepare attribute value for specific attributes.
 
 arrayToAttributes (\DOMNode $node, array $attributes, $withSanitizer=true)
 Convert associative array to attributes of given node.
 
 setAttributeWithSanitization (\DOMNode $node, $attributeName, $attributeValue)
 Set attribute to given node using sanitizeAttributeValueByName.
 
 setAttribute (\DOMNode $node, $attributeName, $attributeValue)
 Set attribute to given node.
 
 getSoapNamespaceUriByVersion ($soapVersion)
 Return soap namespace uri according to $soapVersion.
 

Protected Attributes

 $classMap = []
 
 $dom
 
 $includedTypes = []
 
 $schema = null
 
 $strategy = null
 Strategy for detection of complex types.
 
 $uri
 
 $wsdl
 

Constructor & Destructor Documentation

__construct (   $name,
  $uri,
ComplexTypeStrategy  $strategy = null,
array  $classMap = [] 
)
Parameters
string$nameName of the Web Service being Described
string | Uri$uriURI where the WSDL will be available
null | ComplexTypeStrategy$strategyStrategy for detection of complex types
null | array$classMapMap of PHP Class names to WSDL QNames
Exceptions
Exception\RuntimeException

Member Function Documentation

addBinding (   $name,
  $portType 
)

Add a binding element to WSDL.

Parameters
string$nameName of the Binding
string$portTypename of the portType to bind
Returns
DOMElement The new binding's XML_Tree_Node for use with addBindingOperation and addDocumentation
addBindingOperation (   $binding,
  $name,
  $input = false,
  $output = false,
  $fault = false,
  $soapVersion = SOAP_1_1 
)

Add an operation to a binding element.

Parameters
DOMElement$bindingA binding XML_Tree_Node returned by addBinding
string$name
array | bool$inputAn array of attributes for the input element, allowed keys are: 'use', 'namespace', 'encodingStyle'. More Information
array | bool$outputAn array of attributes for the output element, allowed keys are: 'use', 'namespace', 'encodingStyle'. More Information
array | bool$faultAn array with attributes for the fault element, allowed keys are: 'name', 'use', 'namespace', 'encodingStyle'. More Information
int$soapVersionSOAP version: SOAP_1_1 or SOAP_1_2, default: SOAP_1_1
Returns
DOMElement The new Operation's XML_Tree_Node for use with addSoapOperation and addDocumentation
addComplexType (   $type)

Add a types data type definition.

Parameters
string$typeName of the class to be specified
Returns
string XSD Type for the given PHP type
addDocumentation (   $inputNode,
  $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'.

See Also
http://www.w3.org/TR/wsdl#_documentation WSDL specification
http://schemas.xmlsoap.org/wsdl/ WSDL schema
http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#WSDL_documentation_Element WS-I Basic Profile 1.1
Parameters
DOMElement$inputNodeAn XML_Tree_Node returned by another method to add the documentation to
string$documentationHuman readable documentation for the node
Returns
DOMElement The documentation element
addElement (   $element)

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$elementan xsd:element represented as an array
Returns
string xsd:element for the given element array
addMessage (   $messageName,
  $parts 
)

Add a message element to the WSDL.

Parameters
string$messageNameName for the message
array$partsAn 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
DOMElement The new message's XML_Tree_Node for use in addDocumentation
addPortOperation (   $portType,
  $name,
  $input = false,
  $output = false,
  $fault = false 
)

Add an operation element to a portType element.

Parameters
DOMElement$portTypea portType XML_Tree_Node, from addPortType
string$nameOperation name
bool | string$inputInput Message
bool | string$outputOutput Message
bool | string$faultFault Message
Returns
DOMElement The new operation's XML_Tree_Node for use in addDocumentation
addPortType (   $name)

Add a portType element to the WSDL.

Parameters
string$nameportType element's name
Returns
DOMElement The new portType's XML_Tree_Node for use in addPortOperation and addDocumentation
addSchemaTypeSection ( )

This function makes sure a complex types section and schema additions are set.

Returns
self
addService (   $name,
  $portName,
  $binding,
  $location,
  $soapVersion = SOAP_1_1 
)

Add a service element to the WSDL.

Parameters
string$nameService Name
string$portNameName of the port for the service
string$bindingBinding for the port
string$locationSOAP Address for the service
int$soapVersionSOAP version: SOAP_1_1 or SOAP_1_2, default: SOAP_1_1
Returns
DOMElement The new service's XML_Tree_Node for use with addDocumentation
addSoapBinding (   $binding,
  $style = 'document',
  $transport = 'http://schemas.xmlsoap.org/soap/http',
  $soapVersion = SOAP_1_1 
)

Add a SOAP binding element to a Binding element.

Parameters
DOMElement$bindingA binding XML_Tree_Node returned by addBinding
string$stylebinding style, possible values are "rpc" (the default) and "document"
string$transportTransport method (defaults to HTTP)
int$soapVersionSOAP version: SOAP_1_1 or SOAP_1_2, default: SOAP_1_1
Returns
DOMElement
addSoapOperation (   $operation,
  $soapAction,
  $soapVersion = SOAP_1_1 
)

Add a SOAP operation to an operation element.

Parameters
DOMElement$operationAn operation XML_Tree_Node returned by addBindingOperation
string$soapActionSOAP Action
int$soapVersionSOAP version: SOAP_1_1 or SOAP_1_2, default: SOAP_1_1
Returns
DOMElement
addType (   $type,
  $wsdlType 
)

Add a complex type name that is part of this WSDL and can be used in signatures.

Parameters
string$type
string$wsdlType
Returns
self
addTypes ( DOMNode  $types)

Add WSDL Types element.

Parameters
DOMDocument | DOMNode | DOMElement | DOMDocumentFragment$typesA DOMDocument|DOMNode|DOMElement|DOMDocumentFragment with all the XML Schema types defined in it
arrayToAttributes ( \DOMNode  $node,
array  $attributes,
  $withSanitizer = true 
)
protected

Convert associative array to attributes of given node.

Optionally uses sanitizeAttributeValueByName.

Parameters
DOMNode$node
array$attributes
bool$withSanitizer
dump (   $filename = false)

Echo the WSDL as XML.

Parameters
bool$filename
Returns
bool
getClassMap ( )

Get the class map of php to wsdl mappings.

Returns
array
getComplexTypeStrategy ( )

Get the current complex type strategy.

Returns
ComplexTypeStrategy
getDOMDocument (   $name,
  $uri = null 
)
protected

Get the wsdl XML document with all namespaces and required attributes.

Parameters
string$uri
string$name
Returns
DOMDocument
getSchema ( )

Return the Schema node of the WSDL.

Returns
DOMElement
getSoapNamespaceUriByVersion (   $soapVersion)
protected

Return soap namespace uri according to $soapVersion.

Parameters
int$soapVersionSOAP_1_1 or SOAP_1_2 constants
Returns
string
Exceptions
Exception\InvalidArgumentException
getTargetNamespace ( )

Retrieve target namespace of the WSDL document.

Returns
string
getType (   $type)

Returns an XSD Type for the given PHP type.

Parameters
string$typePHP Type to get the XSD type for
Returns
string
getTypes ( )

Return an array of all currently included complex types.

Returns
array
getUri ( )

Return WSDL uri.

Returns
string
parseElement (   $element)
protected

Parse an xsd:element represented as an array into a DOMElement.

Parameters
array$elementan xsd:element represented as an array
Returns
DOMElement parsed element
Exceptions
Exception\RuntimeExceptionif $element is not an array
sanitizeAttributeValueByName (   $name,
  $value 
)
protected

Prepare attribute value for specific attributes.

Parameters
string$name
mixed$value
Returns
string safe value or original $value
sanitizeUri (   $uri)

Function for sanitizing uri.

Parameters
string | Uri$uri
Returns
string
Exceptions
Exception\InvalidArgumentException
setAttribute ( \DOMNode  $node,
  $attributeName,
  $attributeValue 
)
protected

Set attribute to given node.

Parameters
DOMNode$node
string$attributeName
mixed$attributeValue
setAttributeWithSanitization ( \DOMNode  $node,
  $attributeName,
  $attributeValue 
)
protected

Set attribute to given node using sanitizeAttributeValueByName.

Parameters
DOMNode$node
string$attributeName
mixed$attributeValue
setClassMap ( array  $classMap)

Set the class map of php to wsdl mappings.

Parameters
array$classMap
Returns
self
setComplexTypeStrategy ( ComplexTypeStrategy  $strategy)

Set a strategy for complex type detection and handling.

Parameters
ComplexTypeStrategy$strategy
Returns
self
setUri (   $uri)

Set a new uri for this WSDL.

Parameters
string | Uri$uri
Returns
self
toDomDocument ( )

Return DOM Document.

Returns
DOMDocument
toXML ( )

Return the WSDL as XML.

Returns
string WSDL as XML
translateType (   $type)

Translate PHP type into WSDL QName.

Parameters
string$type
Returns
string QName

Member Data Documentation

$classMap = []
protected
$dom
protected
$includedTypes = []
protected
$schema = null
protected
$strategy = null
protected

Strategy for detection of complex types.

$uri
protected
$wsdl
protected
const SOAP_11_NS = 'soap'
const SOAP_11_NS_URI = 'http://schemas.xmlsoap.org/wsdl/soap/'
const SOAP_12_NS = 'soap12'
const SOAP_12_NS_URI = 'http://schemas.xmlsoap.org/wsdl/soap12/'
const SOAP_ENC_NS = 'soap-enc'
const SOAP_ENC_URI = 'http://schemas.xmlsoap.org/soap/encoding/'
const TYPES_NS = 'tns'
const WSDL_NS = 'wsdl'
const WSDL_NS_URI = 'http://schemas.xmlsoap.org/wsdl/'
const XML_NS = 'xmlns'

#@+ XML Namespace uris and prefixes.

const XML_NS_URI = 'http://www.w3.org/2000/xmlns/'
const XSD_NS = 'xsd'
const XSD_NS_URI = 'http://www.w3.org/2001/XMLSchema'