Well this is an old issue I've been dealing with and still no solution, so trying a new approach.
How can I send th SOAP response early (Before script execution ends)?
These issues are cause when the ACK file is not sent before 30 seconds as the process takes longer to complete then the allotted time.
flush() not working, get this error:
org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.
without the flush() I get this
org.xml.sax.SAXParseException: Premature end of file.
The script process can takeover 180 seconds to complete and the server waiting for the response only wait for about 30 seconds before timing out (Which cause the above error).
any thoughts as to how I can fix this?
Here is some of the code: This is how I accept and send the ACK file for the imcoming SOAP request
$data = 'php://input';
$content = file_get_contents($data);
if($content) {
respond('true');
} else {
respond('false');
}
The respond function
function respond($tf) {
$ACK = <<<ACK
<?xml version = "1.0" encoding = "utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<notifications xmlns="http://soap.sforce.com/2005/09/outbound">
<Ack>$tf</Ack>
</notifications>
</soapenv:Body>
</soapenv:Envelope>
ACK;
print trim($ACK);
}
PHP uses a single thread processing approach and will not send back the ACK file until the thread has completed it's processing. Is there some way to close the socket after the ACK submission and continue the processing so I don't get these timeout issues on the sending server?