2011-10-13 62 views
2

當我有WSDL時,我非常熟悉在Delphi中使用Web服務。我只需使用該向導,幾秒鐘後即可開始運行。在沒有WSDL的Delphi中使用PHP soap服務?

我現在面臨一個挑戰,我得到了一個用PHP編寫的soap接口,沒有任何WSDL模式。

給我的PHP的樣本是:

<?php 
// The xml to be sent to the webService 
$reqest_string = <<<XML 
<test_api> 
    <request>1</request> 
</test_api> 
XML; 

// create web service client 
$client = new WSClient(array("to" => "http://api.infax.co.za/edge_api.php")); 

// send request to the web service 
$reply = $client->request($reqest_string); 

// display the responce from the webservice 
$xml_str = simplexml_load_string($reply->str); 

// display response on screen 
echo "Came from server = ".$xml_str->response."<br>"; 
?> 

我試過只是荷蘭國際集團後的XML的url,但我得到一個錯誤的肥皂回有關不存在的功能。

任何想法??

+0

你知道如何命名你想要的功能嗎? – hakre

+0

根據第2頁API文檔,可以與test_api功能測試: \t

+0

交叉檢查與[SOAP文檔(http://www.w3.org/TR/soap/),所以你知道你在做什麼。要發現一個你並不完全瞭解的服務並且想要玩弄,我首先會使用一些SOAP GUI工具來探測函數名稱和參數類型。 – hakre

回答

0

對於非常簡單的SOAP Web服務,使用HTTP代理(fiddler2)記錄交互,然後使用XML庫的交互代碼可以更容易地遵循現有的示例/文檔或(如果這兩者都不夠好)你的選擇。

+0

謝謝我已經嘗試過使用SoapUI,但在繼續之前似乎需要WSDL? –

+0

你是對的 - 請參閱http://stackoverflow.com/questions/5389568/how-to-use-soap-ui-without-wsdl - 所以我編輯了我的答案 – mjn

+0

Damn希望我可以使用SoapUI來構建WSDL 。我有功能列表,我會嘗試手動黑客入侵。開始/運行/ Notepad.exe –