I am executing the following php code when trying to get a request from a SOAP API server
try { $soap = new SoapClient($wsdl, $options); $data = $soap->GetXYZ($params); } catch(Exception $e) { $Lastresponse = $soap->__getLastResponse(); }
All I got was the code "it looks like we donβt have an XML document."
But when I looked at the $ Lastresponse variable in the catch block, I found it as below:
------=_Part_1134075_393252946.1482317378966 Content-Type: application/xop+xml; charset=utf-8; type="text/xml" <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> ......all valid data ... </SOAP-ENV:Body> </SOAP-ENV:Envelope> ------=_Part_1134075_393252946.1482317378966--
Note. The options $ options I use are:
$options = array( 'uri'=>'http://schemas.xmlsoap.org/soap/envelope/', //'style'=>SOAP_RPC, //'use'=>SOAP_ENCODED, 'soap_version'=>SOAP_1_1, 'cache_wsdl'=>WSDL_CACHE_NONE, 'connection_timeout'=>15, 'trace'=>true, 'encoding'=>'UTF-8', 'exceptions'=>true );
Although I made a workaround for xml parsing, does anyone have an idea about these extra bits parts? Is there something I'm doing wrong?
soap xml php web-services
Ashok poudel
source share