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. 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('')
and as expected I get the response:
#response: GuzzleHttp\Psr7\Response {#1715 -reasonPhrase: "Bad Request"
Help?
CodePudding user response:
Answer: This is not a SOAP API. That's embarrassing. 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.
CodePudding user response:
According to the documentation you provided. https://jigsaw.w3.org/css-validator/manual.html#api
You have to set the output to either 'application/soap xml' or '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);