[英]Laravel SOAP request call
I'm looking to get access to a specific API (found here: https://jigsaw.w3.org/css-validator/manual.html#api ), however this is a SOAP api and I've never worked with SOAP. So I install this package: https://codedredd.github.io/laravel-soap/ and I try a test call.我正在寻找访问特定的 API(在此处找到: https://jigsaw.w3.org/css-validator/manual.html#api ),但这是一个 SOAP api,我从未使用过 SOAP . 所以我安装了这个 package: https://coderedd.github.io/laravel-soap/我尝试了一个测试调用。 It looks like this:
它看起来像这样:
$response = Soap::baseWsdl('https://jigsaw.w3.org/css-validator/validator')
->call('validator', [
'text' => $text,
'lang' => 'en',
]);
dd($response);
however I already know this is going to fail because I have no idea what to put into the ->call('')但是我已经知道这会失败,因为我不知道要在 ->call('') 中放入什么
and as expected I get the response:正如预期的那样,我得到了回应:
#response: GuzzleHttp\Psr7\Response {#1715 -reasonPhrase: "Bad Request"
#response: GuzzleHttp\Psr7\Response {#1715 -reasonPhrase: "Bad Request"
Help?帮助?
According to the documentation you provided.根据您提供的文档。 https://jigsaw.w3.org/css-validator/manual.html#api
https://jigsaw.w3.org/css-validator/manual.html#api
You have to set the output to either 'application/soap+xml' or 'soap12'您必须将 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);
Answer: This is not a SOAP API. That's embarrassing.回答:这不是SOAP API,尴尬。 The title of the documentation was "CSS Validator Web Service API SOAP 1.2" so I had assumed it was going to be a SOAP API. But no, the SOAP part is just a reference to returning XML.
文档的标题是“CSS Validator Web Service API SOAP 1.2”所以我假设它会是 SOAP API。但是不,SOAP 部分只是对返回 88.4288 的引用 SOAP
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.