From f7c5eb1d28973e7380cc532c6347723b84ab19a5 Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 2 Jan 2007 01:06:20 +0000 Subject: Fixed SOAP demo. --- demos/soap/protected/application.xml | 14 +++-- demos/soap/protected/pages/Home.page | 50 ++++++++++++++--- demos/soap/protected/pages/Home.php | 63 +++++++++------------- demos/soap/protected/webservices/SimpleService.php | 11 ++-- 4 files changed, 79 insertions(+), 59 deletions(-) (limited to 'demos') diff --git a/demos/soap/protected/application.xml b/demos/soap/protected/application.xml index e59c5b84..a107e7a4 100644 --- a/demos/soap/protected/application.xml +++ b/demos/soap/protected/application.xml @@ -1,10 +1,8 @@ - - - - - - - - + + + + + + \ No newline at end of file diff --git a/demos/soap/protected/pages/Home.page b/demos/soap/protected/pages/Home.page index 732022e9..f0811b30 100644 --- a/demos/soap/protected/pages/Home.page +++ b/demos/soap/protected/pages/Home.page @@ -1,19 +1,53 @@ - + + + + - TSoapService Demo + + + + + +TSoapService Demo + +

TSoapService Demo

-

Welcome to the TSoapService demo. See service description.

+

+This demo shows basic usage of TSoapService which provides integrated +SOAP service for PRADO applications. +

+

+The demo includes both a SOAP server and a client (this page). +The SOAP server supports two operations which are provided by SimpleService class: +

+ +

+For more details about the server, see its +WSDL specification. +

-

Soap Calculator

- + = +

SOAP Calculator

+ + + = + + -

Highlight source code

-
+

Source Code Highlighter

+

+Click on the button below to show the highlighted source code of +this page class: +

+
- +
+ +
diff --git a/demos/soap/protected/pages/Home.php b/demos/soap/protected/pages/Home.php index 98fbe6c6..a52ea384 100644 --- a/demos/soap/protected/pages/Home.php +++ b/demos/soap/protected/pages/Home.php @@ -1,43 +1,30 @@ _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; - } +class Home extends TPage +{ + private $_client=null; + + protected function getSoapClient() + { + if($this->_client===null) + { + $wsdlUri=$this->Request->AbsoluteApplicationUrl.'?soap=calculator.wsdl'; + $this->_client=new SoapClient($wsdlUri); + } + return $this->_client; + } + + public function computeButtonClicked($sender,$param) + { + $number1=TPropertyValue::ensureInteger($this->Number1->Text); + $number2=TPropertyValue::ensureInteger($this->Number2->Text); + $this->AdditionResult->Text=$this->getSoapClient()->add($number1+$number2); + } + + public function highlightButtonClicked($sender, $param) + { + $this->HighlightResult->Text=$this->getSoapClient()->highlight(file_get_contents(__FILE__)); + } } diff --git a/demos/soap/protected/webservices/SimpleService.php b/demos/soap/protected/webservices/SimpleService.php index 9aecbfad..ca082152 100644 --- a/demos/soap/protected/webservices/SimpleService.php +++ b/demos/soap/protected/webservices/SimpleService.php @@ -1,8 +1,7 @@ \ No newline at end of file -- cgit v1.2.3