WebSite-PHP Framework PHP
Mehrsprachig
Einfacher Ajax Modus
Kein HTML, kein JavaScript
URL Rewriting
Mails senden
Sitemap - RSS - Web service
Laden Sie WebSite-PHP FrameWork jetzt herunter
 


Loading
 


Webservice client with object

Tutorials

>

Tutorial Webservice

>

Webservice client with object


Helloworld-02-client: Tutorial der Komponente Webservice vom PHP FrameWork WebSite-PHP.

Webservice client with object:

stdClass Object
(
    [text] => It's my object
    [sub_object] => stdClass Object
        (
            [sub_text] => It's my object [sub_object]
        )

)

It's my object [sub_object]


Zurück zum Tutorial der Komponente Webservice



Quelltext

Quelltext


Datei: /pages/tutorials/webservice/helloworld-02-client.php

<?php
/* 
 * Use: http://YOUR_DOMAIN/tutorials/webservice/
 *         helloworld-02-client.html
 */

require_once(dirname(__FILE__)."/MySoapableObject.class.php");

class 
Helloworld02Client extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Webservice client with object";
        
        
// Init webservice
        
$client = new WebSitePhpSoapClient(
                    
$this->getBaseLanguageURL().
                    
"/tutorials/webservice/".
                    
"helloworld-02-server.wsdl?wsdl");
        
        
// test with a complex object
        
$my_obj = new MySoapableObject();
        
$my_obj->setText("It's my object");
        
$obj_echo $client->echoObject(
                new 
SoapVar($my_objSOAP_ENC_OBJECT));
        
$sub_text $client->getObjectSubText(
                new 
SoapVar($my_objSOAP_ENC_OBJECT));
        
        
// display result message
        
$this->render = new Object($obj_echo"<br/>"
                            
$sub_text);
    }
}
?>


Zurück zum Tutorial der Komponente Webservice


Quelltext

Quelltext


MySoapableObject:
Datei: /pages/tutorials/webservice/MySoapableObject.class.php

<?php
require_once(dirname(__FILE__)."/MySubSoapableObject.class.php");

class 
MySoapableObject {
    private 
$text "";
    private 
$sub_object null;
    
    public function 
setText($txt) {
        
$this->text $txt;
        
$this->sub_object = new MySubSoapableObject();
        
$this->sub_object->setSubText($txt." [sub_object]");
    }
    
    public function 
getText() {
        return 
$this->text;
    }
    
    public function 
getSubObject() {
        return 
$this->sub_object;
    }

?>


MySubSoapableObject:
Datei: /pages/tutorials/webservice/MySubSoapableObject.class.php

<?php
class MySubSoapableObject {
    private 
$sub_text "";
    
    public function 
setSubText($txt) {
        
$this->sub_text $txt;
    }
    
    public function 
getSubText() {
        return 
$this->sub_text;
    }

?>


Share

 


Copyright © 2009-2016 WebSite-PHP Framework PHP
Start Dokumentation Herunterladen Schnellstart Tutorials Wiki Issue Tracker