SOAP-ERROR: Parsing WSDL:Couldn’t load from “xxxxxxx” 解决方案

亦凉 2022-06-05 02:22 433阅读 0赞

#

用php的soapclient连接第三方的webservice,是https的,连接报错SOAP-ERROR: Parsing WSDL:Couldn’t load from “xxxxxxx”

首先排查 php的soap扩展是否安装
openssl扩展
服务器本身安装openssl

排除第三方对本服务器的IP限制

最后怀疑是https需要ssl验证,而本机没有pem文件

可以通过如下设置,忽略ssl验证

verify_peer:指定是否验证ssl,默认为true
将verify_peer设为false

另外,允许引用外部xml实体
加libxml_disable_entity_loader(false);语句

  1. libxml_disable_entity_loader(false);
  2. $opts = array(
  3. 'ssl' => array(
  4. 'verify_peer' => false
  5. ),
  6. 'https' => array(
  7. 'curl_verify_ssl_peer' => false,
  8. 'curl_verify_ssl_host' => false
  9. )
  10. );
  11. $streamContext = stream_context_create($opts);
  12. $client = new SoapClient("https://urlToSoapWs",
  13. array(
  14. 'stream_context' => $streamContext
  15. ));
  16. 1
  17. 2
  18. 3
  19. 4
  20. 5
  21. 6
  22. 7
  23. 8
  24. 9
  25. 10
  26. 11
  27. 12
  28. 13
  29. 14
  30. 15

禁止引用外部xml实体
libxml_disable_entity_loader(true);

nginx 报错 upstream timed out (110: Connection timed out)解决方案

nginx每隔几个小时就会报下面的错误:

2013/05/18 21:21:36 [error] 11618#0: *324911 upstream timed out (110: Connection timed out) while reading response header from upstream,
client: 42.62.37.56, server: localhost, request: “GET /code-snippet/2747/HTML5-Canvas-usage HTTP/1.0”,
upstream: “fastcgi://127.0.0.1:9002”, host: “outofmemory.cn”, referrer: “http://outofmemory.cn/code-snippet/tagged/canvas“报这个错误之后,整个服务器就不响应了,但是nginx后面的webpy程序没有任何错误,后端的数据库也很正常,从网上查了很多资料,都是说要修改proxy_read_timeout,proxy_send_timeout和proxy_buffer几个相关设置的值。

如下配置,要放在server配置节之内

  1. large_client_header_buffers 4 16k;
  2. client_max_body_size 30m;
  3. client_body_buffer_size 128k;
  4. proxy_connect_timeout 300;
  5. proxy_read_timeout 300;
  6. proxy_send_timeout 300;
  7. proxy_buffer_size 64k;
  8. proxy_buffers 4 32k;
  9. proxy_busy_buffers_size 64k;
  10. proxy_temp_file_write_size 64k;
  11. fastcgi_connect_timeout 300;
  12. fastcgi_read_timeout 300;
  13. fastcgi_send_timeout 300;
  14. fastcgi_buffer_size 64k;
  15. fastcgi_buffers 4 32k;
  16. fastcgi_busy_buffers_size 64k;
  17. fastcgi_temp_file_write_size 64k;
  18. 1
  19. 2
  20. 3
  21. 4
  22. 5
  23. 6
  24. 7
  25. 8
  26. 9
  27. 10
  28. 11
  29. 12
  30. 13
  31. 14
  32. 15
  33. 16
  34. 17
  35. 18

你可以看到上面是proxy_和fastcgi_两种配置,就是说如果你的nginx后面是proxy,就设置proxy相关的配置,如果是fastcgi就设置fastcgi相关的配置。

发表评论

表情:
评论列表 (有 0 条评论,433人围观)

还没有评论,来说两句吧...

相关阅读