dongsui5464 2019-07-19 15:38
浏览 236
已采纳

SOAP-ERROR:解析架构:无法从domain.com/WebService.svc?xsd=xsd0导入架构

Problem

I am working on a web service and I am unable to connect always get this error message:

SOAP-ERROR: Parsing Schema: can't import schema from domain.com/WebService.svc?xsd=xsd0

I did went to all of the SO questions I did not find a solution.

Server

Linux, php7.1

PHP Modules Enabled

bz2, calendar, Core, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd,
gettext, hash, iconv, intl, json, ldap, libxml, mbstring, mysqli, mysqlnd,
openssl, pcntl, pcre, PDO, pdo_dblib, pdo_mysql, pdo_sqlite, Phar, posix,
readline, Reflection, session, shmop, SimpleXML, soap, sockets, SPL,
sqlite3, standard, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xml, 
xmlreader, xmlwriter, xsl, zip, zlib

Code

$wsdlFile = **fullpathtowsdlfile**;
$context = stream_context_create([
            'ssl' => [
                // set some SSL/TLS specific options
                'verify_peer' => false,
                'verify_peer_name' => false,
                'allow_self_signed' => true
            ],

            'http'=>array(
                'user_agent'=>'SoapClient'
            )

        ]);

$options = array(
            'trace'=>1,
            'location'=>self::$wsdl,
            'exception'=>1,
            'cache_wsdl'=>WSDL_CACHE_NONE,
            //'stream_context'=>$context, // disable but leaved for reference.
            'local_cert'=> **fullpath**,
            'soap_version'=> SOAP_1_1
        );

$client =  new \SoapClient($wsdlFile, $options);

Also tried the Url instead of the Wsdl file and I get the same error. I can connect to the url via telnet domain 80 , telnet domain 413 and with my browser.

What I am missing? Any help will be appreciated.

  • 写回答

1条回答 默认 最新

  • dongyu2300 2019-07-19 17:57
    关注

    The issue was a self signed certificate, updated my code to this and now the error is gone.

    
    $context = stream_context_create([
                'ssl' => [
                    // set some SSL/TLS specific options
                    'verify_peer' => false,
                    'verify_peer_name' => false,
                    'allow_self_signed' => true
                ] 
            ]);
    
    $options = array(
                'trace'=>1,
                'exception'=>0,
                'stream_context'=>$context,  
    
            );
    $client =  new \SoapClient($wsdlFile, $options);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 QCustomPlot嵌套到python
  • ¥20 电脑拓展屏桌面被莫名遮挡
  • ¥20 ensp,用局域网解决
  • ¥15 Python语言实验
  • ¥15 我每周要在投影仪优酷上自动连续播放112场电影,我每一周遥控操作一次投影仪,并使得电影永远不重复播放,请问怎样操作好呢?有那么多电影看吗?
  • ¥20 电脑重启停留在grub界面,引导出错需修复
  • ¥15 matlab透明图叠加
  • ¥50 基于stm32l4系列 使用blunrg-ms的ble gatt 创建 hid 服务失败
  • ¥150 计算DC/DC变换器平均模型中的参数mu
  • ¥25 C语言代码,大家帮帮我