/**
  * Constructor initializing the wsdl generator context.
  *
  * @param string $name      The webservice name
  * @param string $namespace The targetnamespace of the wsdl document
  * @param string $location  The endpoint location of the webservice
  * @param bool   $default   Indicates if the webservice is the default one
  */
 public function __construct($name, $namespace, $location = null, $default = true)
 {
     $this->name = $name;
     $this->namespace = ckXsdNamespace::set('tns', $this->normalizeNamespaceUri($namespace));
     $this->location = $location;
     $this->default = $default;
 }
 public static function create($name)
 {
     if (isset(self::$ALIAS[$name])) {
         $name = self::$ALIAS[$name];
     }
     return new ckXsdSimpleType($name, ckXsdNamespace::get('xsd'));
 }
 public function serialize(DOMDocument $document)
 {
     $xsd = ckXsdNamespace::get('xsd');
     $node = $document->createElementNS($xsd->getUrl(), $xsd->qualify($this->getNodeName()));
     $node->setAttribute('name', $this->getName());
     $node->setAttribute('type', $this->getType()->getQualifiedName());
     return $node;
 }
Ejemplo n.º 4
0
 public function serialize(DOMDocument $document)
 {
     $wsdl = ckXsdNamespace::get('wsdl');
     $node = $document->createElementNS($wsdl->getUrl(), $wsdl->qualify($this->getNodeName()));
     $node->setAttribute('name', $this->getName());
     foreach ($this->getParts() as $part) {
         $node->appendChild($part->serialize($document));
     }
     return $node;
 }
 /**
  * Creates a new array type object, if the given type name is one of an array type.
  *
  * @param string $name The name of an array type
  *
  * @return ckXsdArrayType The array type object
  */
 public static function create($name)
 {
     if (self::isArrayType($name)) {
         $elementTypeName = substr($name, 0, -strlen(self::ARRAY_SUFFIX));
         $elementType = ckXsdType::get($elementTypeName);
         if (!is_null($elementType)) {
             return new ckXsdArrayType(ckString::ucfirst($elementType->getName()) . self::NAME_SUFFIX, ckXsdNamespace::get('tns'), $elementType);
         }
     }
     return null;
 }
 public function serialize(DOMDocument $document)
 {
     $xsd = ckXsdNamespace::get('xsd');
     $node = $document->createElementNS($xsd->getUrl(), $xsd->qualify($this->getNodeName()));
     $node->setAttribute('name', $this->getName());
     $sequence = $document->createElementNS($xsd->getUrl(), $xsd->qualify('sequence'));
     foreach ($this->getElements() as $element) {
         $sequence->appendChild($element->serialize($document));
     }
     $node->appendChild($sequence);
     return $node;
 }
Ejemplo n.º 7
0
 public function serialize(DOMDocument $document)
 {
     $wsdl = ckXsdNamespace::get('wsdl');
     $node = $document->createElementNS($wsdl->getUrl(), $wsdl->qualify($this->getNodeName()));
     $node->setAttribute('name', $this->getName());
     if ($this->getIsHeader()) {
         $node->setAttribute('element', $this->getType()->getQualifiedName());
     } else {
         $node->setAttribute('type', $this->getType()->getQualifiedName());
     }
     return $node;
 }
 private function getSoapHeaderNode(DOMDocument $document, ckWsdlMessage $message, ckWsdlPart $part)
 {
     $soap = ckXsdNamespace::get('soap');
     $soapenc = ckXsdNamespace::get('soapenc');
     $tns = ckXsdNamespace::get('tns');
     $header_node = $document->createElementNS($soap->getUrl(), $soap->qualify('header'));
     $header_node->setAttribute('message', $tns->qualify($message->getName()));
     $header_node->setAttribute('part', $part->getName());
     $header_node->setAttribute('use', 'encoded');
     $header_node->setAttribute('namespace', $tns->getUrl());
     $header_node->setAttribute('encodingStyle', $soapenc->getUrl());
     return $header_node;
 }
 /**
  * @see ckDOMSerializable::serialize()
  */
 public function serialize(DOMDocument $document)
 {
     $wsdl = ckXsdNamespace::get('wsdl');
     $tns = ckXsdNamespace::get('tns');
     $soap = ckXsdNamespace::get('soap');
     $node = $document->createElementNS($wsdl->getUrl(), $wsdl->qualify($this->getNodeName()));
     $node->setAttribute('name', $this->getName());
     $node->setAttribute('binding', $tns->qualify($this->getBinding()->getName()));
     $address = $document->createElementNS($soap->getUrl(), $soap->qualify('address'));
     $address->setAttribute('location', $this->getLocation());
     $node->appendChild($address);
     return $node;
 }
Ejemplo n.º 10
0
 public function serialize(DOMDocument $document)
 {
     $xsd = ckXsdNamespace::get('xsd');
     $node = $document->createElementNS($xsd->getUrl(), $xsd->qualify($this->getNodeName()));
     $node->setAttribute('name', $this->getName());
     $attr = $document->createElementNS($xsd->getUrl(), $xsd->qualify('attribute'));
     $attr->setAttribute('ref', 'soapenc:arrayType');
     $attr->setAttribute('wsdl:arrayType', $this->getElementType()->getQualifiedName() . self::ARRAY_SUFFIX);
     $restriction = $document->createElementNS($xsd->getUrl(), $xsd->qualify('restriction'));
     $restriction->setAttribute('base', 'soapenc:Array');
     $restriction->appendChild($attr);
     $complexContent = $document->createElementNS($xsd->getUrl(), $xsd->qualify('complexContent'));
     $complexContent->appendChild($restriction);
     $node->appendChild($complexContent);
     return $node;
 }
 public function serialize(DOMDocument $document)
 {
     $wsdl = ckXsdNamespace::get('wsdl');
     $xsd = ckXsdNamespace::get('xsd');
     $tns = ckXsdNamespace::get('tns');
     $soapenc = ckXsdNamespace::get('soapenc');
     $node = $document->createElementNS($wsdl->getUrl(), $wsdl->qualify($this->getNodeName()));
     $node->setAttribute('xmlns', $wsdl->getUrl());
     $node->setAttribute('name', $this->getName());
     $node->setAttribute('targetNamespace', $tns->getUrl());
     // kind of hack to register all namespaces
     $node->setAttribute($tns->getXmlns(), $tns->getUrl());
     $node->setAttribute($soapenc->getXmlns(), $soapenc->getUrl());
     $schema_node = $document->createElementNS($xsd->getUrl(), $xsd->qualify('schema'));
     $schema_node->setAttribute('xmlns', $xsd->getUrl());
     $schema_node->setAttribute('targetNamespace', $tns->getUrl());
     foreach ($this->getTypes() as $type) {
         if ($type->getIsElement()) {
             $schema_node->appendChild($type->serializeElement($document));
         }
         $schema_node->appendChild($type->serialize($document));
     }
     $types_node = $document->createElementNS($wsdl->getUrl(), $wsdl->qualify('types'));
     $types_node->appendChild($schema_node);
     $node->appendChild($types_node);
     foreach ($this->getPortTypes() as $portType) {
         $node->appendChild($portType->serialize($document));
     }
     foreach ($this->getBindings() as $binding) {
         $node->appendChild($binding->serialize($document));
     }
     foreach ($this->getMessages() as $message) {
         $node->appendChild($message->serialize($document));
     }
     foreach ($this->getServices() as $service) {
         $node->appendChild($service->serialize($document));
     }
     return $node;
 }
Ejemplo n.º 12
0
 /**
  * @see ckDOMSerializable::serialize()
  */
 public function serialize(DOMDocument $document)
 {
     $wsdl = ckXsdNamespace::get('wsdl');
     $node = $document->createElementNS($wsdl->getUrl(), $wsdl->qualify($this->getNodeName()));
     $node->setAttribute('name', $this->getName());
     $attr = 'type';
     $suffix = '';
     if ($this->getType() instanceof ckXsdComplexType && $this->isHeader()) {
         $attr = 'element';
         $suffix = ckXsdComplexType::ELEMENT_SUFFIX;
     }
     $node->setAttribute($attr, $this->getType()->getQualifiedName() . $suffix);
     return $node;
 }
 /**
  * Protected constructor initializing the simple xsd type with a given name.
  *
  * @param string $name The name of the simple xsd type
  */
 protected function __construct($name = null)
 {
     parent::__construct($name, ckXsdNamespace::get('xsd'));
 }
 /**
  * @see ckDOMSerializable::serialize()
  */
 public function serialize(DOMDocument $document)
 {
     $wsdl = ckXsdNamespace::get('wsdl');
     $tns = ckXsdNamespace::get('tns');
     $node = $document->createElementNS($wsdl->getUrl(), $wsdl->qualify($this->getNodeName()));
     $node->setAttribute('name', $this->getName());
     if (!is_null($this->getInput())) {
         $input_node = $document->createElementNS($wsdl->getUrl(), $wsdl->qualify('input'));
         $input_node->setAttribute('message', $tns->qualify($this->getInput()->getName()));
         $parts = $this->getInput()->getParts();
         if (!empty($parts)) {
             $node->setAttribute('parameterOrder', ckString::implode(' ', $parts));
         }
         $node->appendChild($input_node);
     }
     if (!is_null($this->getOutput())) {
         $output_node = $document->createElementNS($wsdl->getUrl(), $wsdl->qualify('output'));
         $output_node->setAttribute('message', $tns->qualify($this->getOutput()->getName()));
         $node->appendChild($output_node);
     }
     return $node;
 }
Ejemplo n.º 15
0
 public function serializeElement($document)
 {
     $xsd = ckXsdNamespace::get('xsd');
     $tns = ckXsdNamespace::get('tns');
     $node = $document->createElementNS($xsd->getUrl(), $xsd->qualify("element"));
     $node->setAttribute('name', $this->getName());
     $node->setAttribute('type', $tns->qualify($this->getName()));
     return $node;
 }
 public function __construct($name, $namespace, $endpoint)
 {
     $this->name = $name;
     $this->namespace = ckXsdNamespace::set('tns', $this->normalizeNamespaceUri($namespace));
     $this->endpoint = $endpoint;
 }
<?php

/**
 * This file is part of the ckWsdlGenerator
 *
 * @package   ckWsdlGenerator
 * @author    Christian Kerl <*****@*****.**>
 * @copyright Copyright (c) 2008, Christian Kerl
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
 * @version   SVN: $Id: ckXsdNamespace.class.php 12155 2008-10-12 22:18:08Z chrisk $
 */
ckXsdNamespace::set('xsd', 'http://www.w3.org/2001/XMLSchema');
ckXsdNamespace::set('soap', 'http://schemas.xmlsoap.org/wsdl/soap/');
ckXsdNamespace::set('soaphttp', 'http://schemas.xmlsoap.org/soap/http');
ckXsdNamespace::set('soapenc', 'http://schemas.xmlsoap.org/soap/encoding/');
ckXsdNamespace::set('wsdl', 'http://schemas.xmlsoap.org/wsdl/');
/**
 * ckXsdNamespace represents a xml namespace and provides a central xml namespace registry.
 *
 * @package    ckWsdlGenerator
 * @subpackage xsd
 * @author     Christian Kerl <*****@*****.**>
 */
class ckXsdNamespace
{
    /**
     * An array containing all registered namespaces.
     *
     * @var array
     */
    protected static $namespaceRegistry = array();
 /**
  * @see ckDOMSerializable::serialize()
  */
 public function serialize(DOMDocument $document)
 {
     $xsd = ckXsdNamespace::get('xsd');
     $node = $document->createElementNS($xsd->getUrl(), $xsd->qualify($this->getNodeName()));
     $node->setAttribute('name', $this->getName());
     $sequence = $document->createElementNS($xsd->getUrl(), $xsd->qualify('sequence'));
     foreach ($this->getElements() as $element) {
         $sequence->appendChild($element->serialize($document));
     }
     $node->appendChild($sequence);
     $element = new ckXsdComplexTypeElement($this->getName() . self::ELEMENT_SUFFIX, $this);
     $fragment = $document->createDocumentFragment();
     $fragment->appendChild($node);
     $fragment->appendChild($element->serialize($document));
     return $fragment;
 }