企業訓練系統-Enterprise Training

這裡搜集了我們使用 Moodle 這個免費平台, 運用在各個產業及各種訓練(內部訓練/公開課程)的運用實例; 同時也證明 Moodle 不只是在學校好用, 企業也好用👍

Web Service 與 ERP 系統整合

WSDL網址:

e.g. https://enterprise.clickap.com/webservice/soap/server.php?wsdl=1&wstoken=1a2222bbcccd33333333e5f6g7777h887


以鼎新的TipTop ERP / Workflow 系統為例:

<?php

header('Content-Type: text/html; charset=utf-8');

$wsdl = 'TIPTOPServiceGateWay.wsdl';

$client = new SoapClient($wsdl, array(

    'soap_version'   => SOAP_1_1,

    'cache_wsdl'   => WSDL_CACHE_NONE,

    'trace'          => true,

    'features'     => SOAP_SINGLE_ELEMENT_ARRAYS,

    'style'        => SOAP_ENCODED, //SOAP_DOCUMENT,

    'use'          => SOAP_LITERAL

));


try {

    

    // __getFunctions 取得所有 functions (Dumping client object functions)

    var_dump($client->__getFunctions());

    // __getTypes 取得所有方法回傳的結構 (Dumping client Types)

    var_dump($client->__getTypes());


    $param = "<Access><Account userId='' password=''/><Connection from='elearning.dsc.com.tw' organization='AUDIX_PY'/></Access>";

    $return = $client->__soapCall("elearning", array($param));

    //var_dump($return);

    if($return["succeed"]=='Y'){

      $data = $return['data'];

      $datalen = sizeof($data);

      echo "Get data ". $datalen . "(s). and status is [<code>". htmlspecialchars($return['status'], ENT_QUOTES) . "</code> ]"; 


      // Get last response, if you want to do.

      //$response = $client->__getLastResponse();

      //var_dump($response);

    }

    else{

      echo "Failed. Message: " . $return['msg'];

    }

    exit;

}

catch (SoapFault $e) {

    echo "Error: {$e}";

}

$wsdl 為 Tiptop 的wsdl 內容, 客戶給的檔案。

SOAP_1_1 是

'elearning'  為Tiptop 給 數位學習(就是 Moodle啦..)用的 method 名稱; 'status'、'msg' 都要換成你自己的。


你執行的結果應該像這樣:

Get data 999(s). and status is [<Status> <Result code="0" sqlcode="" description="" /> </Status> ]

PS: status 一樣要問客戶端的定義.

done.