$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;
主にここ: 配列を使用するだけエラー
$client->__soapCall('getDepartInfo',$xml);
致命的なエラー: SoapFault 例外をキャッチできませんでした: [HTTP]
でホストに接続できませんでした
wsdl が発行されるまで待機してください
http://www.foxwho.com/wsdl.txt
このアドレスを確認してください
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));
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])); }
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])); }
this.Url = "http://***:80/axis2/services/WS4SZ.WS4SZHttpSoap11Endpoint/";
モデレータ様、ありがとうございます。相手がポートをパブリック IP に変更してからもう一度試してみます。
いつか蘇州に行ったら試してみます。