欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

SOAP webservice 通信问题

程序员文章站 2022-06-10 12:14:58
...
$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


回复讨论(解决方案)

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