How to fix the error: PHP SOAP Fatal error:uncaught soapfault exception: [Client] looks like we got no XML document?
The following code is present, and the above error occurs at run time. The reason is also clear, because __soapcall expects to return data in XML format, and if not, an error occurs.
$webservice _url = "Http://120.25.XX. Xx:3000/service.asmx? WSDL ";//webservice address $client = new Soapclientnew ($webservice _url); try{ $arr = $client->__soapcall (' Functionsql ', Array (' parameters ' = + $param));//Call the method}catch (Exception $e) {echo $e. getMessage ();}
So, what if the JSON data returned by our web service call is unusable? Online check, combined with personal groping, the following ways can bypass this problem, better solve.
1, create a new class Soapclientnew extends SoapClient {public function __dorequest ($request, $location, $action, $version, $ One_way = 0) { $request = parent::__dorequest ($request, $location, $action, $version, $one _way); $GLOBALS [' $soap _ Call_result '] = $request; Important! The result has been returned here, saved to the global variable//$start = Strpos ($request, ' <soap ');//According to the actual situation to do processing ... , if it is <?xml start, change to <?xml//$end = Strrpos ($request, ' > '); Return substr ($request, $start, $end-$start + 1); return $request; }}2, calling the new class $client = Soapclientnew ($webservice _url); try{ $arr = $client->__soapcall (' Functionsql ', Array (' parameters ' = = $param));//Call one of the methods }catch ( Exception $e) { } $arr = $GLOBALS [' $soap _call_result '];//After the call to read the global variable, you can get the result of the call Print_r ($arr);
PHP Development Experience Two