diff options
Diffstat (limited to 'demos/soap/protected/pages')
-rw-r--r-- | demos/soap/protected/pages/Home.page | 20 | ||||
-rw-r--r-- | demos/soap/protected/pages/Home.php | 44 |
2 files changed, 64 insertions, 0 deletions
diff --git a/demos/soap/protected/pages/Home.page b/demos/soap/protected/pages/Home.page new file mode 100644 index 00000000..732022e9 --- /dev/null +++ b/demos/soap/protected/pages/Home.page @@ -0,0 +1,20 @@ +<html> +<head> + <title>TSoapService Demo</title> +</head> +<body> +<h1>TSoapService Demo</h1> +<p>Welcome to the TSoapService demo. See <a href="index.php?soap=SimpleService&wsdl">service description</a>.</p> + +<com:TForm> +<h2>Soap Calculator</h2> +<com:TTextBox ID="a" Columns="3"/> + <com:TTextBox ID="b" Columns="3"/> = <com:TTextBox ID="result" Columns="3"/> <com:TButton Text="Compute" OnClick="onCompute"/> + +<h2>Highlight source code</h2> +<com:TButton Text="Highlight this" OnClick="onHighlight"/> <br/> +<br/> +<com:TLabel ID="SourceCode"/> + +</com:TForm> +</body> +</html>
\ No newline at end of file diff --git a/demos/soap/protected/pages/Home.php b/demos/soap/protected/pages/Home.php new file mode 100644 index 00000000..98fbe6c6 --- /dev/null +++ b/demos/soap/protected/pages/Home.php @@ -0,0 +1,44 @@ +<?php + +class Home extends TPage { + + private $_client; + + public function onInit($param) { + // TODO: configure wsdl + $wsdl = 'http://localhost/prado/svn/trunk/demos/soap/index.php?soap=SimpleService&wsdl'; + $location = 'http://localhost/prado/svn/trunk/demos/soap/index.php?soap=SimpleService'; + // TODO: use TSoapClient + //$this->_client = new SoapClient($wsdl, array('soap_version' => SOAP_1_1, + //'use' => '', + // 'style' => '')); + + // TODO: use classmap + $this->_client = new SoapClient(null, array('location' => $location, 'uri' => 'urn:SimpleService', 'soap_version' => SOAP_1_2)); + } + + public function onCompute($sender, $param) { + $a = $this->a->Text; + $b = $this->b->Text; + + try { + $result = $this->_client->add($a, $b); + } catch(SoapFault $e) { // TODO: Prado wrapper for SoapFault (TSoapFaultException) + print $e; + } + //var_dump($result); + $this->result->Text = $result; + } + + public function onHighlight($sender, $param) { + try { + $result = $this->_client->__soapCall('highlight', array(file_get_contents(__FILE__))); + } catch(SoapFault $e) { // TODO: Prado wrapper for SoapFault (TSoapFaultException) + print $e; + } + $this->SourceCode->Text = $result; + } + +} + +?>
\ No newline at end of file |