SOAP webservice 通信问题

风.foxwho 2015-07-21 06:18:11
$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=<<<XML
<?xml version="1.1" encoding="utf-8"?>
<Message>
<requestInfo>
<HospitalID>SLDQ</HospitalID>
</requestInfo>
</Message>
XML;

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

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

等下发wsdl
...全文
168 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
风.foxwho 2015-07-22
  • 打赏
  • 举报
回复
谢谢版主,等对方把端口更换成公网IP,我再试试看! 哪天来苏州的时候搓一顿。
风.foxwho 2015-07-21
  • 打赏
  • 举报
回复
引用 7 楼 xuzuning 的回复:
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/";
发你短信信息里,因为这个不能公开
xuzuning 2015-07-21
  • 打赏
  • 举报
回复
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/";
风.foxwho 2015-07-21
  • 打赏
  • 举报
回复
引用 4 楼 xuzuning 的回复:
struct getDepartInfo {
 string strXml;
}
可知,要这样调用
$client->__soapCall('getDepartInfo', array('strXml' => $xml));
帮我调试一下,联系我QQ 我给你文件。改天请你吃饭
风.foxwho 2015-07-21
  • 打赏
  • 举报
回复
引用 4 楼 xuzuning 的回复:
struct getDepartInfo {
 string strXml;
}
可知,要这样调用
$client->__soapCall('getDepartInfo', array('strXml' => $xml));
报错 <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ws.apache.org/axis2"><SOAP-ENV:Body><ns1:getDepartInfo/></SOAP-ENV:Body></SOAP-ENV:Envelope> <br> <br>Could not connect to host <br>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"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ws.apache.org/axis2"><SOAP-ENV:Body><ns1:getDepartInfo/></SOAP-ENV:Body></SOAP-ENV:Envelope> [1] => http://****:80/axis2/services/WS4SZ.WS4SZHttpSoap11Endpoint/ [2] => urn:getDepartInfo [3] => 1 [4] => 0 ) )
xuzuning 2015-07-21
  • 打赏
  • 举报
回复
struct getDepartInfo {
 string strXml;
}
可知,要这样调用
$client->__soapCall('getDepartInfo', array('strXml' => $xml));
风.foxwho 2015-07-21
  • 打赏
  • 举报
回复
晚上 8点钟在线,现在回家吃饭
风.foxwho 2015-07-21
  • 打赏
  • 举报
回复
额,容量太大。。。。。 http://www.foxwho.com/wsdl.txt 这个地址查看

21,887

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧