[英]Laravel SOAP request call
我正在尋找訪問特定的 API(在此處找到: https://jigsaw.w3.org/css-validator/manual.html#api ),但這是一個 SOAP api,我從未使用過 SOAP . 所以我安裝了這個 package: https://coderedd.github.io/laravel-soap/我嘗試了一個測試調用。 它看起來像這樣:
$response = Soap::baseWsdl('https://jigsaw.w3.org/css-validator/validator')
->call('validator', [
'text' => $text,
'lang' => 'en',
]);
dd($response);
但是我已經知道這會失敗,因為我不知道要在 ->call('') 中放入什么
正如預期的那樣,我得到了回應:
#response: GuzzleHttp\Psr7\Response {#1715 -reasonPhrase: "Bad Request"
幫助?
根據您提供的文檔。 https://jigsaw.w3.org/css-validator/manual.html#api
您必須將 output 設置為“application/soap+xml”或“soap12”
$response = Soap::baseWsdl('https://www.w3.org/2005/09/css-validator.wsdl')
->call('validator', [
'uri' => $text,
'lang' => 'en',
'output' => 'application/soap+xml'
]);
dd($response);
回答:這不是SOAP API,尷尬。 文檔的標題是“CSS Validator Web Service API SOAP 1.2”所以我假設它會是 SOAP API。但是不,SOAP 部分只是對返回 88.4288 的引用 SOAP
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.