SOAP webservice 通訊問題

來源:互聯網
上載者:User
$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,我再試試看!
哪天來蘇州的時候搓一頓。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.