Home > Backend Development > PHP Tutorial > SOAP webservice 通信问题

SOAP webservice 通信问题

WBOY
Release: 2016-06-23 13:30:27
Original
1161 people have browsed it

$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;}
Copy after login
Copy after login
Copy after login
可知,要这样调用
$client->__soapCall('getDepartInfo', array('strXml' => $xml));
Copy after login
Copy after login
Copy after login

struct getDepartInfo { string strXml;}
Copy after login
Copy after login
Copy after login
可知,要这样调用
$client->__soapCall('getDepartInfo', array('strXml' => $xml));
Copy after login
Copy after login
Copy after login



报错






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;}
Copy after login
Copy after login
Copy after login
可知,要这样调用
$client->__soapCall('getDepartInfo', array('strXml' => $xml));
Copy after login
Copy after login
Copy after login


帮我调试一下,联系我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]));    }
Copy after login
Copy after login
可知并没有搞错

生成的 url 是
this.Url = "http://***:80/axis2/services/WS4SZ.WS4SZHttpSoap11Endpoint/";
Copy after login
Copy after login

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]));    }
Copy after login
Copy after login
可知并没有搞错

生成的 url 是
this.Url = "http://***:80/axis2/services/WS4SZ.WS4SZHttpSoap11Endpoint/";
Copy after login
Copy after login


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

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template