Question

Ive looked at similar errors and i think its most likely due to a BOM character but to be honest most of the other coding is in a different context and i just dont understand it, im not that familiar with soap and just use it to pull the data then format it in php.

My code is simple:

$activityClient = xpmClient::getModuleInstance('activity', $remoteSessionId, 'xxx.5pmweb.com');
$filter = new stdClass();
$count = 300;
$offset = 0;
$activityList = $activityClient->getList($filter, $offset, $count);

Now the server error shows:

> PHP Fatal error:  Uncaught SoapFault exception: [Client] looks like we got no XML document in xxx/caching.php:59\nStack trace:\n  
\#0 xxx/caching.php(59): SoapClient->__call('getList', Array)\n  
\#1 xxx/caching.php(59): xpmClient->getList(Object(stdClass), 0, '371')\n  
\#2 /xxx/reports.php(296): include('/xxx/...')\n  
\#3 {main}\n  thrown in /xxx/caching.php on line 59

Line 296 on report.php is an include for the caching.php file, line 59 of that file is

$activityList = $activityClient->getList($filter, $offset, $count);

This worked for months without issue so im not sure what changed today. Any ideas how to strip the BOM and still get my data into $activityList as an object so i can access the information?

edit//

The preg replace doesnt work, i guess thats because once i call $activityList the server gives a fatal error and doesnt process anything after that so im trying to fix it AFTER its broke rather than before.

How would i go about doing __getLastResponse()

Ive read the manual but dont understand how to structure it, im pretty sure i need a try catch for the reasons i said preg replace didnt work but i tried a few variations and its doing nothing, im pretty sure the structure is wrong, any pointers or ideas?

Was it helpful?

Solution

I don't know why would BOM cause this but if you want to strip bom here you go

function strip_bom( $str ) {
    return preg_replace( '/^(\x00\x00\xFE\xFF|\xFF\xFE\x00\x00|\xFE\xFF|\xFF\xFE|\xEF\xBB\xBF)/', "", $str );
}

OTHER TIPS

The Soap server you are using is broken. Have you checked manually trying to call it?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top