【发布时间】:2011-10-15 22:32:34
【问题描述】:
当我拥有 WSDL 时,我非常熟悉在 Delphi 中使用 Web 服务。我只需使用向导,几秒钟后我就可以启动并运行。
我现在面临一个挑战,我得到了一个用 PHP 编写的肥皂接口,没有任何 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,但我收到一个关于不存在的函数的肥皂错误。
有什么想法吗??
【问题讨论】:
-
你知道你要请求的函数是怎么命名的吗?
-
根据 2 页 api 文档,可以使用 test_api 函数进行测试:
-
与SOAP Docs 交叉核对,让您知道自己在做什么。为了发现一个你不完全了解并且想要尝试的服务,我会首先使用一些 SOAP GUI 工具来探测函数名称和参数类型。
-
函数名称和参数我很确定,只是不知道如何在没有 WSDL 的情况下在 Delphi 中实现它。我可以对 WSDL 进行逆向工程吗?
-
在德尔福?为什么要发布 PHP 代码?是的,您可以自己编写 WSDL 并将其提供给 SOAP 客户端。