简体   繁体   English

在不带WSDL的Delphi中使用PHP soap服务?

[英]Using PHP soap service with Delphi without WSDL?

I'm quite familiar with using web services in Delphi when I have a WSDL. 当我有WSDL时,我对在Delphi中使用Web服务非常熟悉。 I simply use the wizard and in a few secs I'm up and running. 我只是使用向导,然后在几秒钟内启动并运行。

I now have a challenge where I'm given a soap interface written in PHP, without any WSDL schema. 现在,我面临一个挑战,我需要一个用PHP编写的soap接口,而没有任何WSDL模式。

The sample given to me for PHP is: 给我的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>";
?>

I've tried just post-ing the xml to the url, but I get a soap error back about a function that does not exist. 我尝试过仅将xml发布到url,但是我收到关于不存在的功能的错误消息。

Any ideas?? 有任何想法吗??

对于非常简单的SOAP Web服务,可以更容易地遵循现有的示例/文档,或者(如果两种方法都不够好)使用HTTP代理(fiddler2)记录交互,然后使用您选择的XML库编写通信代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM