SOAP webservice 通信问题

php中文网
发布: 2016-06-23 13:30:27
原创
1340人浏览过

$client = new \SoapClient($wsdl_url,["trace"=>true,'encoding'=>'UTF-8','soap_version'=>SOAP_1_2,'uri'=>'http://ws.apache.org/axis2']);
print_r($client->__getFunctions());
$xml=


SLDQ


XML;

主要在这边:使用数组就报错
$client->__soapCall('getDepartInfo',$xml);  

Fatal error:  Uncaught SoapFault exception: [HTTP] Could not connect to host in 

等下发wsdl

AI建筑知识问答
AI建筑知识问答

用人工智能ChatGPT帮你解答所有建筑问题

AI建筑知识问答 22
查看详情 AI建筑知识问答

回复讨论(解决方案)

额,容量太大。。。。。
http://www.foxwho.com/wsdl.txt
这个地址查看

晚上 8点钟在线,现在回家吃饭

struct getDepartInfo { string strXml;}
登录后复制
可知,要这样调用
$client->__soapCall('getDepartInfo', array('strXml' => $xml));
登录后复制

struct getDepartInfo { string strXml;}
登录后复制
可知,要这样调用
$client->__soapCall('getDepartInfo', array('strXml' => $xml));
登录后复制



报错






Could not connect to host

SoapFault Object
(
    [message:protected] => Could not connect to host
    [string:Exception:private] => 
    [code:protected] => 0
    [file:protected] => /www/wwwroot/default/p.php
    [line:protected] => 29
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [function] => __doRequest
                    [class] => SoapClient
                    [type] => ->
                    [args] => Array
                        (
                            [0] => 


                            [1] => http://****:80/axis2/services/WS4SZ.WS4SZHttpSoap11Endpoint/
                            [2] => urn:getDepartInfo
                            [3] => 1
                            [4] => 0
                        )

                )

struct getDepartInfo { string strXml;}
登录后复制
可知,要这样调用
$client->__soapCall('getDepartInfo', array('strXml' => $xml));
登录后复制


帮我调试一下,联系我QQ 我给你文件。改天请你吃饭

Could not connect to host 无法连接到主机
你在 wsdl 中隐去了目标 url ,这就没法帮你了

vs2010 的 wsdl 工具生成的方法是

    public string getDepartInfo([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string strXml) {        object[] results = this.Invoke("getDepartInfo", new object[] {                    strXml});        return ((string)(results[0]));    }
登录后复制
可知并没有搞错

生成的 url 是
this.Url = "http://***:80/axis2/services/WS4SZ.WS4SZHttpSoap11Endpoint/";
登录后复制

Could not connect to host 无法连接到主机
你在 wsdl 中隐去了目标 url ,这就没法帮你了

vs2010 的 wsdl 工具生成的方法是

    public string getDepartInfo([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=true)] string strXml) {        object[] results = this.Invoke("getDepartInfo", new object[] {                    strXml});        return ((string)(results[0]));    }
登录后复制
可知并没有搞错

生成的 url 是
this.Url = "http://***:80/axis2/services/WS4SZ.WS4SZHttpSoap11Endpoint/";
登录后复制


发你短信信息里,因为这个不能公开

谢谢版主,等对方把端口更换成公网IP,我再试试看!
哪天来苏州的时候搓一顿。

最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号