コード例 #1
0
 protected function initializeConfig(SimpleXMLElement $xml)
 {
     if (!$xml->forms) {
         $xml->addChild("forms");
     }
     if (!$xml->loops) {
         $xml->addChild("loops");
     }
     if (!$xml->services) {
         $xml->addChild("services");
     }
     if (!$xml->hooks) {
         $xml->addChild("hooks");
     }
 }
コード例 #2
0
 /**
  * Sends an XML request to the SOAP server
  *
  * @param string $action The action you are performing, a soap method defined in the wsdl
  * @param array $attributes The attributes for the XML node that defines the action
  * @param array $params Request params
  *
  * @throws SoapException
  *
  * @return \SimpleXMLElement The response's Body tag
  *
  */
 public function request($action, $attributes = array(), $params = array())
 {
     // Sanity check to see if we have connected
     if (!$this->getCurlClient()) {
         throw new SoapException('No valid connection has been established, have you connected and authenticated with the ZCS Soap webservice?');
     }
     unset($this->message->children('soap', true)->Body);
     $body = $this->message->addChild('Body');
     $actionChild = $body->addChild($action, null, $this->namespace);
     foreach ($attributes as $key => $value) {
         if (is_array($value)) {
             $this->constructNodeWithAttrs($key, $value, $actionChild);
         } else {
             $actionChild->addAttribute($key, $value);
         }
     }
     $actionChild = self::formatRequestXml($params, $actionChild);
     if (self::$debug === true) {
         echo "<h2>REQUEST</h2></hr />";
         echo '<pre>', htmlentities(self::formatXml($this->getXml())), '</pre>';
         die;
     }
     $this->getCurlClient()->setOption(CURLOPT_POSTFIELDS, $this->getXml());
     return $this->handleResponse($this->getCurlClient()->execute());
 }
コード例 #3
0
 /**
  * @param \TheliaStudio\Parser\Entity\Route[] $routes
  * @param SimpleXMLElement                    $xml
  */
 protected function addRoutesToXml(array $routes, SimpleXMLElement $xml)
 {
     foreach ($routes as $route) {
         /** @var SimpleXmlElement $element */
         $element = $xml->addChild("route");
         $element->addAttribute("id", $route->getId());
         $element->addAttribute("path", $route->getPath());
         if ($route->getMethods()) {
             $element->addAttribute("methods", $route->getMethods());
         }
         foreach ($route->getDefaults() as $key => $value) {
             $default = $element->addChild("default", $value);
             $default->addAttribute("key", $key);
         }
         foreach ($route->getRequirements() as $key => $value) {
             $requirement = $element->addChild("requirement", $value);
             $requirement->addAttribute("key", $key);
         }
     }
 }