PHP code example of jelix / soap-server-module

1. Go to this page and download the library: Download jelix/soap-server-module library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jelix / soap-server-module example snippets

>
class defaultCtrl extends jController {

    /** 
     * Test with a simple parameter
     * @externalparam string $name
     * @return string
     */
    function hello() {
        $resp = $this->getResponse('soap');
        $resp->data = "Hello ".$this->param('name');
        return $resp;
    }
}

/**
 * Struct used for tests
 */
class MyTestStruct {
    /**
     * @var string
     */
    public $name = 'Dupont';

    /**
     * @var string
     */
    public $firstName = 'Bertrand';

    /**
     * @var string
     */
    public $city = 'Paris';
}

    /** 
     * for this method, we receive a MyTestStruct and return a MyTestStruct object
     * @externalparam MyTestStruct $input
     * @return MyTestStruct
     */
    function receiveObject() {
        $resp = $this->getResponse('soap');
        $input = $this->param('input');
        $input->name = 'Name updated';
        $resp->data = $input;
        return $resp;
    }

/**
 * An other struct used for test, this one have an other object as member propertie
 */
class MyTestStructBis {

    /**
     * @var MyTestStruct
     */
    public $test;

    /**
     * @var string
     */
    public $msg = 'hello';

    function __construct(){
        $this->test = new MyTestStruct();
    }
}

  $url = jUrl::get("mymodule~myaction@soap");
bash
php dev.php module:configure jsoap
bash
php install/installer.php
default.soap.php

   http://mysite.com/index.php/jsoap/WSDL/wsdl?service=aModule~aController

  http://mysite.com/index.php/jsoap/WSDL?service=aModule~aController