順豐BSP訂單號查詢介面SOAP的請求樣本_PHP教程

來源:互聯網
上載者:User

順豐BSP訂單號查詢介面SOAP的請求樣本


在一些介面的設計中有時用到了SOAP方式的請求,比如順豐BSP的介面。

我嘗試不同方式的POST方式請求,要麼完全請求不到東西,要麼接收到亂碼,均以失敗告終。

針對順豐介面的SOAP請求的核心代碼分享如下:

代碼如下

/**
* 發送soap請求
*/
private function _soap()
{
$client = new SoapClient($this->serviceUrl);
$info = new stdClass();
$info->arg0 = $this->xml;
$param = array($info);
$response = $client->__call(“sfexpressService”,$param);
return $response->return ;
}

/**
* 拼接出請求的xml
*/
public function createXml()
{
$xml = ‘
’.$this->user.’,’.$this->passWord.’

invoice_no.’” />

’;
$this->xml = $xml;
}

提示:
1.$this->serviceUrl 順豐分配的BSP請求地址,注意是?wsdl的地址
2.$this->user,$this->passWord 即是順豐分配的ID和校正碼
3.返回的return是一個XML的String,你可能需要simplexml_load_string來解析。

http://www.bkjia.com/PHPjc/898890.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/898890.htmlTechArticle順豐BSP訂單號查詢介面SOAP的請求樣本 在一些介面的設計中有時用到了SOAP方式的請求,比如順豐BSP的介面。 我嘗試不同方式的POST方式請求...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.