第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何使用 PHP Soap 類客戶端進(jìn)行 SoapCall

如何使用 PHP Soap 類客戶端進(jìn)行 SoapCall

PHP
蕪湖不蕪 2022-06-11 16:50:46
我正在嘗試使用 PHP Soap Client 類在 PHP 中進(jìn)行 SOAP 調(diào)用。我設(shè)法連接到 WDSL 文件,但它不接受我的參數(shù)。以下是此次通話所需的所有必要信息。當(dāng)我輸入以下內(nèi)容時(shí):    $wsdlUrl = 'https://irm.cooperboating.com/rdpwincentralsvc/irmpublic.asmx?WSDL';    $client = new SoapClient($wsdlUrl);    var_dump($client->__getFunctions());    var_dump($client->__getTypes());我得到:  // Output from getFunctions()  [26]=>  string(83) "GetCourseInformationResponse GetCourseInformation(GetCourseInformation $parameters)"  // Output from getTypes()  [117]=>  string(63) "struct GetCourseInformation {     GetCourseInformation_irmRQ RQ;  }"  [118]=>  string(152) "struct GetCourseInformation_irmRQ {     irmWebSvcCredentials Credentials;     string CourseNumber;     string CourseID;     dateTime StartDate;     dateTime EndDate;  }"  [4]=>  string(104) "struct irmWebSvcCredentials {     string LogonID;     string Password;     string DataPath;     string DatabaseID;  }"在閱讀了來自:如何使用 SoapClient 類進(jìn)行 PHP SOAP 調(diào)用的答案后, 我嘗試了以下操作:class irmWebSvcCredentials {    public function __construct() {        $this->LogonID = "SomeLogin";        $this->Password = "SomPass";        $this->DataPath = "SomePath";        $this->DatabaseID = "SomeId";    }}try {    $wsdlUrl = 'https://irm.cooperboating.com/rdpwincentralsvc/irmpublic.asmx?WSDL';    $client = new SoapClient($wsdlUrl);    $credentials = new irmWebSvcCredentials();    $params = array(        "Credentials" => $credentials,        "CourseNumber" => "",        "CourseID" => "",        "StartDate" => "2019-12-05T18:13:00",        "EndDate" => "2025-12-29T18:13:00",    );    $response = $client->GetCourseInformation(array($params));    var_dump($response);}catch(Exception $e) {    echo $e->getMessage();}我還嘗試將“憑據(jù)”作為數(shù)組而不是類輸入,因?yàn)槠渌恍┐鸢附ㄗh如下:當(dāng)我調(diào)用 $client->GetCourseInformation 時(shí),我為參數(shù)輸入的內(nèi)容似乎并不重要,只要我在數(shù)組結(jié)構(gòu)中提供一個(gè)參數(shù),它總是給我相同的輸出,即:使用 Postman,我已經(jīng)能夠獲得預(yù)期的輸出,這讓我相信我沒有提供某個(gè)參數(shù)。最后,這是我在 Postman 中提供的正文,以獲取內(nèi)容類型為 text/xml 的預(yù)期輸出:有什么我沒有提供的嗎?還是這個(gè)問題與 API 本身有關(guān)?
查看完整描述

1 回答

?
一只甜甜圈

TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超5個(gè)贊

這個(gè)問題已經(jīng)解決了。答案在 Postman 提供的正文中。


<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

  <soap:Body>

    <GetCourseInformation xmlns="http://someurl.com/irmpublic">

      <RQ>           <----- Notice the RQ here

        <Credentials>

         <LogonID>SomeLogin</LogonID>

         <Password>SomPass</Password>

         <DataPath>SomePath</DataPath>

         <DatabaseID>SomeId</DatabaseID>

       </Credentials>

        <CourseNumber></CourseNumber>

        <CourseID></CourseID>

        <StartDate>2019-12-20T18:13:00</StartDate>

        <EndDate>2025-12-29T18:13:00</EndDate>

      </RQ>

    </GetCourseInformation>

  </soap:Body>

</soap:Envelope>

從未提供過 RQ,因此它不知道如何讀取提供的參數(shù)。要解決這個(gè)問題,我們只需要改變它:


    $params = array(

        "Credentials" => array(

            "LogonID" => "SomeLogin",

            "Password" => "SomPass",

            "DataPath" => "SomePath",

            "DatabaseID" => "SomeId",

        ),

        "CourseNumber" => "",

        "CourseID" => "",

        "StartDate" => "2019-12-05T18:13:00",

        "EndDate" => "2025-12-29T18:13:00",

    );

對(duì)此:


    $params = array(

        "RQ" => array(

            "Credentials" => array(

                "LogonID" => "SomeLogin",

                "Password" => "SomPass",

                "DataPath" => "SomePath",

                "DatabaseID" => "SomeId",

            ),

            "CourseNumber" => "",

            "CourseID" => "",

            "StartDate" => "2019-12-05T18:13:00",

            "EndDate" => "2025-12-29T18:13:00",

        )

    );

這是一個(gè)非常具體的問題,但我希望這對(duì)將來的某人有所幫助。


查看完整回答
反對(duì) 回復(fù) 2022-06-11
  • 1 回答
  • 0 關(guān)注
  • 148 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)