Monday, May 2, 2011

PHP, SOAP, Webservice, WSDL, URL format, Uncaught SoapFault exception

The following error occurs when attempting to create a soap client in PHP if the url does not have ?wsdl at the end.

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://testsite.com/somedir/WebServices/service.asmx' : Premature end of data in tag html line 3 in /.../codefile.php:502 Stack trace: #0 /.../codefile.php(502): SoapClient->SoapClient('https://testsite...') #1 {main} thrown in /.../codefile.php on line 502

For example:
$client = new SoapClient('http://testsite.com/WebServices/service.asmx');
(error)

$client = new SoapClient('http://testsite.com/WebServices/service.asmx?wsdl');
(no error)

No comments: