コード例 #1
0
ファイル: SoapClient.php プロジェクト: goetas/webservices
 public function send(BindingOperation $bOperation, array $params, array $headers = array())
 {
     $xml = $this->buildMessage($params, $bOperation, $bOperation->getInput(), $headers);
     $response = $this->getTransport()->send($xml, $this->port, $bOperation);
     if ($outMessage = $bOperation->getOutput()) {
         try {
             $retDoc = new XMLDom();
             $retDoc->loadXMLStrict($response);
         } catch (\DOMException $e) {
             throw new \Exception("Wrong response, expected valid XML. Found '" . substr($response, 0, 2000) . "...'", 100, $e);
         }
         list($head, $body, $env) = $this->getEnvelopeParts($retDoc);
         $partsReturned = $this->decodeMessage($body, $bOperation, $outMessage);
         foreach ($partsReturned as $param) {
             if ($param instanceof SoapFault) {
                 throw $param;
             }
         }
         // @todo configurazione per i metodi che ritornano piu parti
         if (count($partsReturned) == 1) {
             return reset($partsReturned);
         } elseif (count($partsReturned) == 0) {
             return null;
         }
         return $partsReturned;
     }
 }
コード例 #2
0
ファイル: SoapServer.php プロジェクト: goetas/webservices
 public function handleServerError(\Exception $exception, Port $port)
 {
     $xml = new XMLDom();
     $envelope = $xml->addChildNS(static::NS_ENVELOPE, $xml->getPrefixFor(static::NS_ENVELOPE) . ':Envelope');
     $body = $envelope->addChildNS(static::NS_ENVELOPE, 'Body');
     $fault = $body->addChildNS(static::NS_ENVELOPE, 'Fault');
     $fault->addChild("faultcode", "soap:Server");
     $fault->addChild("faultstring", get_class($exception) . ": " . $exception->getMessage() . "\n" . $exception);
     return $this->createResponse($xml->saveXML(), 500);
 }
コード例 #3
0
ファイル: BasicTest.php プロジェクト: goetas/xmldom
 public function testAdapt()
 {
     $a = new \DOMDocument("1.0", "UTF-8");
     $a->load(__DIR__ . "/xml/no_ns.xml");
     $obj = \goetas\xml\XMLDom::adapt($a);
     $this->assertTrue($obj instanceof \goetas\xml\XMLDom);
     $this->assertContains("<testsuites>", $obj->saveXML());
 }
コード例 #4
0
ファイル: Wsdl.php プロジェクト: goetas/wsdl-reader
 protected function getXML($path)
 {
     $tmpPath = sys_get_temp_dir() . "/wsdl" . md5($path) . ".xml";
     $xml = new XMLDom();
     if (!$this->options->cache || !is_file($tmpPath) || time() - $this->options->cache > filemtime($tmpPath)) {
         $cnt = file_get_contents($path);
         if ($cnt) {
             file_put_contents($tmpPath, $cnt);
         }
     }
     $xml->loadXMLStrictFile($tmpPath);
     $xml->documentURI = $path;
     return $xml;
 }
コード例 #5
0
 public function GetCityWeatherByZIP()
 {
     try {
         $this->proxy->GetCityWeatherByZIP(array("zip" => 30020));
     } catch (\Exception $e) {
     }
     $xml = '
     <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:weat="http://ws.cdyne.com/WeatherWS/">
        <soap:Body>
           <weat:GetCityWeatherByZIP>
              <weat:ZIP>30020</weat:ZIP>
           </weat:GetCityWeatherByZIP>
        </soap:Body>
     </soap:Envelope>
     ';
     $this->assertEqualXML(XMLDom::loadXMLString($xml)->documentElement, $this->transport->getXmlNode()->documentElement);
 }
コード例 #6
0
ファイル: XPathTest.php プロジェクト: goetas/xmldom
 public function setUp()
 {
     $this->xml = new XMLDom();
     $this->xml->loadXMLStrictFile(__DIR__ . "/xml/soap.xml");
 }
コード例 #7
0
ファイル: FakeTransport.php プロジェクト: goetas/webservices
 /**
  * @return \goetas\xml\XMLDom
  */
 public function getXmlNode()
 {
     $dom = new XMLDom();
     $dom->loadXMLStrict($this->xml);
     return $dom;
 }