doufengsui7449 2015-08-27 13:54
浏览 354

警告:SoapClient :: SoapClient(http://www.w3.org/2005/05/xmlmime):无法打开流:HTTP请求失败! 需要HTTP / 1.1 401授权

I have simple script connection call using PHP 5.2.10 to a Web service working with SOAP 1.2.

The same PHP installation is able to connect via Web service to another web server working with SOAP 1.1 without issues. In addition, the web services using 1.2 is working fine with another two servers using almost the same hard code.

However, every time I am using SOAP 1.2 on this server with PHP 5.2.10 I got the bellow error if I run the script from a batch file:

Warning: SoapClient::SoapClient(http://www.w3.org/2005/05/xmlmime): failed to open stream: HTTP request failed! HTTP/1.1 401 Authorization Required in C: \NewSimpleConnectionTest.php on line 10

If the script is running via Eclipse PHP with PHP 5.2 on a different computer, it does not have any error so the hard code seems fine, user and password are correct too because it is used on the others servers and on the Eclipse test:

My script is this:

<?php
    $_endpoint = "http://server:8080/serverv/ServerAPI";
    $_username = "userServer";
    $_password = "123ABC!";
    try 
    {
            $client = new SoapClient($_endpoint."?WSDL", array('location' => $_endpoint, 'login' => $_username, 'password' => $_password, 'trace' => 1, 'features' => SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS, 'soap_version' => SOAP_1_2));
            echo 'Connected to Web Services.';
    }catch(Exception $e){
            echo 'Failure to connect to WebServices.';
    }
?>  

This is the information in the SOAP and XML phpinfo.

SimpleXML

Simplexml support => enabled
Revision => $Revision: 1.151.2.22.2.46 $
Schema support => enabled

soap

Soap Client => enabled
Soap Server => enabled

Directive => Local Value => Master Value
soap.wsdl_cache => 1 => 1
soap.wsdl_cache_dir => /tmp => /tmp
soap.wsdl_cache_enabled => 1 => 1
soap.wsdl_cache_limit => 5 => 5
soap.wsdl_cache_ttl => 86400 => 86400

Any idea about what is missing or the problem on this PHP version to work with SOAP 1.2 in that server?

Thanks in advance!!

  • 写回答

1条回答 默认 最新

  • doukou1718 2015-11-17 19:26
    关注

    After some hours working around this problem, the solution was changing the version of PHP from 5.2.10 to 5.5.28.

    There is some kind of bug on this old version and prevent the correct connection with SOAP 1.2.

    I hope this help someone using this old version of PHP.

    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能