简体   繁体   English

如何解决PHP-EWS / SOAP错误?

[英]How to troubleshoot PHP-EWS/SOAP error?

last year I made a PHP project that interacted with and Exchange 2010 Server using Exchange Web Services. 去年,我使用Exchange Web服务创建了一个与Exchange 2010 Server交互的PHP项目。 I have just come back to this project, and when I try to use any of the php-ews methods, I get this error: 我刚刚回到这个项目,当我尝试使用任何php-ews方法时,我收到此错误:

SoapClient::__doRequest() returned non string value

I don't exactly understand how all the SOAP and CURL code works, so could anyone give me a few pointers in how to go about troubleshooting this? 我并不完全理解所有SOAP和CURL代码是如何工作的,所以有人可以给我一些关于如何解决此问题的指示吗?

Things I have tried 我尝试过的事情

When I go to the URL that the SOAP request is being sent to in a web browser, I am warned that it doesn't have an valid certificate, so I have put the following code in both my NTLMSoapClient and NTLMStream: 当我转到在Web浏览器中发送SOAP请求的URL时,我被警告它没有有效的证书,因此我将以下代码放在我的NTLMSoapClient和NTLMStream中:

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

But I still receive the same error. 但我仍然收到同样的错误。

When I browse to the address in a web browser and ignore the certificate warning, I am prompted for a password, and it only seems to accept the admin password, and then It redirects me to services.wsdl. 当我在Web浏览器中浏览到该地址并忽略证书警告时,系统会提示我输入密码,它似乎只接受管理员密码,然后将其重定向到services.wsdl。

Changing the username and password in my code to the admin ones doesn't make any difference. 将我的代码中的用户名和密码更改为管理员用户名和密码没有任何区别。

I used to work on a similar project, but involving PHP and MS Sharepoint web services. 我曾经在一个类似的项目上工作,但涉及PHP和MS Sharepoint Web服务。 I used NuSoap library to facilitate working with SOAP. 我使用NuSoap库来促进使用SOAP。

I have no experience with PHP EWS, but I'd recommend you to look into request and response codes, data and headers to see what exactly you send and receive. 我没有使用PHP EWS的经验,但我建议您查看请求和响应代码,数据和标题,以查看您发送和接收的确切内容。 This info will probably help you find your problem (is it either authentication error or failure to get wsdl description or invalid arguments for the web method etc.). 此信息可能会帮助您找到问题(是身份验证错误还是无法获取wsdl描述或Web方法的无效参数等)。

// For debugging purposes
// return transfer data as a result
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// read headers
curl_setopt($ch, CURLOPT_HEADER, 1);
// show request headers, will display all the outgoing info, including fields
curl_setopt($ch, CURLINFO_HEADER_OUT, true);

// Make the request
$data = curl_exec($ch);
$errors = curl_error($ch);
// get info about the transfer, for debugging purposes
$details = curl_getinfo($ch); 

curl_close($ch);

// Displaying debugging info
var_dump($data);
var_dump($errors);
var_dump($details);

For more details on my experience see my posts about authorizing and calling MS SPS web service from PHP using CURL and NuSoap. 有关我的经验的更多详细信息,请参阅我使用CURL和NuSoap从PHP 授权调用MS SPS Web服务的帖子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM