• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

SOAP webservice 通信问题

php 搞代码 3年前 (2022-01-23) 17次浏览 已收录 0个评论
文章目录[隐藏]

$client = new \SoapClient($wsdl_url,[“trace”=>true,’encoding’=>’UTF-8′,’soap_version’=>SOAP_1_2,’uri’=>’http://ws.apache.org/axis2′%5D);
print_r($client->__getFunctions());
$xml=<<<XML
<?xml version=”1.1″ encoding=”utf-8″?>

SLDQ

XML;

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

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

等下发wsdl

回复讨论(解决方案)

额,容量太大。。。。。
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));

报错
<?xml version=”1.0″ encoding=”UTF-8″?>

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] => <?xml version=”1.0″ encoding=”UTF-8″?>

[1] => http://****:80/axis2/services/WS4SZ.WS4SZHttpSoap11Endpoint/
[2] => urn:getDepartInfo
[3] => 1
[4] => 0
本@文来源[email protected]搞@^&代*@码网(搞代gaodaima码 )

)

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,我再试试看!
哪天来苏州的时候搓一顿。


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:SOAP webservice 通信问题

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址