コード例 #1
0
ファイル: InputAnalyzer.php プロジェクト: izyumskiy/restsoap
 /**
  * @param string $xmlData
  * @return bool
  * @throws \Exception
  */
 private function isValidXmlRequest($xmlData)
 {
     $tpl = new Template\Templater();
     $xsl = $tpl->get(dirname(__FILE__) . '/../xsl/get_xsd_schema.xsl', []);
     $wsdlViewPath = $this->getWsdlParams('view_path');
     $wsdl = $tpl->get($wsdlViewPath . $this->getModuleName() . '.wsdl', []);
     $xslt = new Xslt\Transformer();
     $xmlObj = $xslt->transform($wsdl, $xsl);
     $xsd = $xmlObj->asXML();
     $result = $xslt->validateXmlByXsd($xmlData, $xsd);
     if ($result['validation'] === false) {
         throw new \Exception($result['errors'][0], self::ERROR_500);
     }
     return true;
 }
コード例 #2
0
ファイル: Mapper.php プロジェクト: izyumskiy/restsoap
 /**
  * Set SOAP mapping from WSDL to PHP
  *
  * @param $object
  */
 public function setWsdlSoapMap()
 {
     $tpl = new Template\Templater();
     $xsl = $tpl->get(dirname(__FILE__) . '/../xsl/get_soap_class.xsl', array());
     $wsdlContent = $tpl->get($this->getViewParameters('view_path') . $this->getWsdlTitle() . '.wsdl', $this->getViewParameters());
     $xslt = new Xslt\Transformer();
     $xml = $xslt->transform($wsdlContent, $xsl);
     $map = array('class' => (string) $xml->php_class, 'uri' => (string) $xml->uri);
     $this->setMap($map);
     return $this;
 }
コード例 #3
0
ファイル: Response.php プロジェクト: izyumskiy/restsoap
 /**
  *
  * @param string $outputType
  * @return Response
  */
 private function validateXmlResponse($outputType)
 {
     if ($outputType != self::RESP_XML) {
         return $this;
     }
     $tpl = new Template\Templater();
     $xsl = $tpl->get(dirname(__FILE__) . '/xsl/get_xsd_schema.xsl', []);
     $wsdl = $tpl->get($this->getWsdl() . '.wsdl', []);
     $xslt = new Xslt\Transformer();
     $xmlObj = $xslt->transform($wsdl, $xsl);
     $xsd = $xmlObj->asXML();
     $result = $xslt->validateXmlByXsd($this->getResponse(), $xsd);
     if ($result['validation'] === false) {
         throw new \Exception("Output error: " . $result['errors'][0], self::ERROR_500);
     }
     return $this;
 }
コード例 #4
0
 private function checkXmlRequestValidation($xmlData)
 {
     if (empty($xmlData)) {
         return true;
     }
     $tpl = new Template\Templater();
     $xsl = $tpl->get(dirname(__FILE__) . '/../xsl/get_xsd_schema.xsl');
     $wsdl = $tpl->get($this->getWsdlParams('view_path') . $this->getObjectName() . '.wsdl');
     $xslt = new Xslt\Transformer();
     $xmlObj = $xslt->transform($wsdl, $xsl);
     $xsd = $xmlObj->asXML();
     $result = $xslt->validateXmlByXsd($xmlData, $xsd);
     if ($result['validation'] === false) {
         throw new \Exception("Output error: " . $result['errors'][0], self::ERROR_500);
     }
     return true;
 }