我希望能够访问特定的API (在这里可以找到:https://jigsaw.w3.org/css-validator/manual.html#api),但是这是一个SOAP,我从未使用过SOAP。所以我安装了这个包:https://codedredd.github.io/laravel-soap/和我尝试了一个测试调用。看起来是这样的:
$response = Soap::baseWsdl('https://jigsaw.w3.org/css-validator/validator')
->call('validator', [
'text' => $text,
'lang' => 'en',
]);
dd($response);不过,我已经知道这会失败,因为我不知道该把什么放进->call(‘)
正如我所期望的那样,我得到了这样的回应:
#响应:GuzzleHttp\Psr7 7\Response {#1715 -reasonPhrase:“坏请求”
帮助?
发布于 2022-10-04 03:03:30
答:这不是一个SOAP。这太尴尬了。文档的标题是“SOAP1.2”,因此我假设它将是一个SOAP。但是不,SOAP部分只是对返回XML的引用。
发布于 2022-10-04 02:47:07
根据你提供的文件。https://jigsaw.w3.org/css-validator/manual.html#api
必须将输出设置为“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);https://stackoverflow.com/questions/73942604
复制相似问题