-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
looks like we got no XML document #180
Comments
I was wrong. It has nothing to do with blocked contents. |
Quick fix for now is the following but for sure there are better ways to do it File /**
* Performs a SOAP request
*
* @link http://php.net/manual/en/function.soap-soapclient-dorequest.php
*
* @param string $request the xml soap request
* @param string $location the url to request
* @param string $action the soap action.
* @param integer $version the soap version
* @param integer $one_way
* @return string the xml soap response.
*/
public function __doRequest($request, $location, $action, $version, $one_way = 0)
{
$postOptions = array(
'body' => $request,
'headers' => array(
'Connection' => 'Keep-Alive',
'User-Agent' => 'PHP-SOAP-CURL',
'Content-Type' => 'text/xml; charset=utf-8',
'SOAPAction' => $action
),
'verify' => $this->validate,
'http_errors' => false
);
$postOptions = array_replace_recursive($postOptions, $this->auth);
$response = $this->httpClient->post($location, $postOptions);
$this->__last_request_headers = $postOptions['headers'];
$this->_responseCode = $response->getStatusCode();
//return $response->getBody()->__toString();
$responseStr = $response->getBody()->__toString();
$responseStr = str_replace('', '', $responseStr);
return $responseStr;
} |
I did some more research and I have a working solution. Here is the code of the working solution: File /**
* Performs a SOAP request
*
* @link http://php.net/manual/en/function.soap-soapclient-dorequest.php
*
* @param string $request the xml soap request
* @param string $location the url to request
* @param string $action the soap action.
* @param integer $version the soap version
* @param integer $one_way
* @return string the xml soap response.
*/
public function __doRequest($request, $location, $action, $version, $one_way = 0)
{
$postOptions = array(
'body' => $request,
'headers' => array(
'Connection' => 'Keep-Alive',
'User-Agent' => 'PHP-SOAP-CURL',
'Content-Type' => 'text/xml; charset=utf-8',
'SOAPAction' => $action
),
'verify' => $this->validate,
'http_errors' => false
);
$postOptions = array_replace_recursive($postOptions, $this->auth);
$response = $this->httpClient->post($location, $postOptions);
$this->__last_request_headers = $postOptions['headers'];
$this->_responseCode = $response->getStatusCode();
// ======================================================
// MODIFICATION START
// ======================================================
//return $response->getBody()->__toString();
$responseStr = $response->getBody()->__toString();
libxml_use_internal_errors(true);
$dom = new \DOMDocument("1.0", "UTF-8");
$dom->strictErrorChecking = false;
$dom->validateOnParse = false;
$dom->recover = true;
$dom->loadXML($responseStr);
$xml = simplexml_import_dom($dom);
libxml_clear_errors();
libxml_use_internal_errors(false);
return $xml->asXML();
// ======================================================
// MODIFICATION END
// ======================================================
} |
That passes my unit tests. Do you want to submit a pull request, or would you prefer I just commit under my name and release? |
Just commit it under your name. |
When we can expect this fix will be released? Cause I'm facing those invalid character issues quite for some time. |
This has been published as version |
looks like we got no XML document [/.../vendor/garethp/php-ews/src/API/NTLMSoapClient.php:118]
The text was updated successfully, but these errors were encountered: