簡體   English   中英

PHP SOAP SoapClient參數

[英]PHP SOAP SoapClient parameters

我是剛接觸PHP的SOAP(通常是SOAP)的。 我在SoapClient類上遇到麻煩。 它帶有四個參數(請求,位置,操作,版本),但是我真的不知道這些參數應該是什么,因為它們與我要使用的Web服務有關。

看到

http://wiki.agemni.com/Getting_Started/APIs/Agemni_CMS_Synchttp://www.agemni.com/_anet/ADBAccess.asmx?op=getCMSTables

這是我最好的猜測:

$wsdl = 'http://www.agemni.com/_anet/ADBAccess.asmx?WSDL';

$action = 'http://webservice.agemni.com/getCMSTables';
$request = 'POST /_anet/ADBAccess.asmx HTTP/1.1
Host: www.agemni.com
Content-Type: text/xml; charset=utf-8
Content-Length: 10000
SOAPAction: "http://webservice.agemni.com/getCMSTables"

<?xml version="1.0" encoding="utf-8"?>
<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>
    <getCMSTables xmlns="http://webservice.agemni.com/getCMSTables" />
  </soap:Body>
</soap:Envelope>"
';
$location = 'http://www.agemni.com/_anet/ADBAccess.asmx';
$version ='1';


$client = new SoapClient($wsdl);
$response = $client->__doRequest($request, $location, $action, $version);

我並不是要有人為我做這件事,但是如果您能幫助闡明$ action,$ request和$ location應該是什么(非常確定$ version只是int 1或2),我將不勝感激。

好吧,如果您不想處理請求的詳細信息並且擁有WSDL文件,則無需設置這些參數。 只需實例化WSDL文件的路徑,它就應該包含其他所有內容。 你剛剛打電話

$response = $client->getCMSTables();

請參閱: http//php.net/manual/en/soapclient.soapclient.php

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM