/** * Method to transform a type to publish it in the WSDL file * * @param array $field Field definition. * @param SimpleXMLElement &$sequence XML with the fields sequence * @param SimpleXMLElement &$typeSchema XML of the typeSchema in case new derived types need to be added * @param string $elementName Parent element name to add the new derived types with unique names * @param boolean $validateOptional Optional parameter to validate if the field is optional. Otherwise it's always set as required * @param array $extraFields Array of extra fields to process - in case of array types * @param SimpleXMLElmenet $complexArrays Complex arrays definitions * * @return void */ public function wsdlField($field, &$sequence, &$typeSchema, $elementName, $validateOptional = false, $extraFields = array(), $complexArrays = null) { parent::wsdlField($field, $sequence, $typeSchema, $elementName, $validateOptional); $this->element->addAttribute('type', 'tns:' . $elementName . '_' . $field['name']); if (!empty($extraFields)) { RApiSoapHelper::addElementFields($extraFields, $typeSchema, $elementName . '_' . $field['name'], false, '', $complexArrays); } }
/** * Method to transform a type to publish it in the WSDL file * * @param array $field Field definition. * @param SimpleXMLElement &$sequence XML with the fields sequence * @param SimpleXMLElement &$typeSchema XML of the typeSchema in case new derived types need to be added * @param string $elementName Parent element name to add the new derived types with unique names * @param boolean $validateOptional Optional parameter to validate if the field is optional. Otherwise it's always set as required * @param array $extraFields Array of extra fields to process - in case of array types * @param SimpleXMLElmenet $complexArrays Complex arrays definitions * * @return void */ public function wsdlField($field, &$sequence, &$typeSchema, $elementName, $validateOptional = false, $extraFields = array(), $complexArrays = null) { if (!isset($this->element)) { $this->element = $sequence->addChild('element', null, 'http://www.w3.org/2001/XMLSchema'); } if (!isset($this->element['minOccurs'])) { $this->element->addAttribute('minOccurs', $validateOptional && RApiHalHelper::isAttributeTrue($field, 'isRequiredField') || !$validateOptional ? '1' : '0'); } $this->element->addAttribute('maxOccurs', 'unbounded'); if (!isset($this->element['name']) && isset($field['name'])) { $this->element->addAttribute('name', $field['name']); } $this->element->addAttribute('type', 'tns:' . $elementName . '_' . $field['name']); if (!empty($extraFields)) { RApiSoapHelper::addElementFields($extraFields, $typeSchema, $elementName . '_' . $field['name'], true, '', $complexArrays); } }
/** * Add operation to a Wsdl document * * @param SimpleXMLElement &$wsdl Wsdl document * @param string $name Operation name * @param array $inputFields Message input fields * @param array $outputFields Message output fields * @param boolean $validateOptionalInput Optional parameter to validate if the inputs are optional or if they're set as required * @param boolean $validateOptionalOutput Optional parameter to validate if the outputs are optional or if they're set as required * * @return void */ public function addOperation(&$wsdl, $name, $inputFields, $outputFields, $validateOptionalInput = false, $validateOptionalOutput = false) { $this->addMessage($wsdl, $name . 'Request', $name); $this->addMessage($wsdl, $name . 'Response'); $this->addPortType($wsdl, $name); $this->addBinding($wsdl, $name); $complexArrays = isset($this->webserviceXml->complexArrays) ? $this->webserviceXml->complexArrays : null; RApiSoapHelper::addElementFields($inputFields, $this->typeSchema, '', $validateOptionalInput, $name, $complexArrays); RApiSoapHelper::addElementFields($outputFields, $this->typeSchema, '', $validateOptionalOutput, $name . 'Response', $complexArrays); }
/** * Add operation to a Wsdl document * * @param SimpleXMLElement &$wsdl Wsdl document * @param string $name Operation name * @param array $inputFields Message input fields * @param array $outputFields Message output fields * @param boolean $validateOptionalInput Optional parameter to validate if the inputs are optional or if they're set as required * @param boolean $validateOptionalOutput Optional parameter to validate if the outputs are optional or if they're set as required * * @return void */ public function addOperation(&$wsdl, $name, $inputFields, $outputFields, $validateOptionalInput = false, $validateOptionalOutput = false) { $this->addMessage($wsdl, $name . 'Request', $name); $this->addMessage($wsdl, $name . 'Response'); $this->addPortType($wsdl, $name); $this->addBinding($wsdl, $name); RApiSoapHelper::addElementFields($inputFields, $this->typeSchema, '', $validateOptionalInput, $name); RApiSoapHelper::addElementFields($outputFields, $this->typeSchema, '', $validateOptionalOutput, $name . 'Response'); }