簡單地使用nusoap調用webservice

來源:互聯網
上載者:User
使用php調用webservice,有個非常方便的封裝類nusoap,可以在http://sourceforge.net/projects/nusoap/files/下載。

NuSOAP的使用比較簡單,其中最常用到的類是soap_server和soapclient, 其中soap_server用於建立 Webservice服務,類soapclient則用於調用Webservice .這兩個類的定義都在lib/nusoap.php中,因此我們在建立 或調用Webservice介面程式時均需要引用該檔案。

require('lib/nusoap.php');// $xml = '一段XML標籤,由webservice的server端來規定,一般在介面文檔裡可以看到';// $soapClient = new nusoap_client("webservice的調用地址",TRUE); //TRUE參數表示使用wsdl// $soapClient->xml_encoding = 'UTF-8'; //指定字元編碼// $soapClient->soap_defencoding = 'UTF-8';// $parameters = array("參數1"=>"", "參數2"=>$xml); //參數也需要根據介面文檔來寫// $outString = $soapClient->call("方法名", $parameters);// var_dump($outString);

以上就介紹了 簡單地使用nusoap調用webservice,包括了方面的內容,希望對PHP教程有興趣的朋友有所協助。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.