2

I'm quite familiar with using web services in Delphi when I have a WSDL. 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.

The sample given to me for PHP is:

<?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.

Any ideas??

Hein du Plessis
  • 3,305
  • 6
  • 34
  • 51
  • You know how the function is named you want to request? – hakre Oct 13 '11 at 11:51
  • According to the 2 page api doc, one can test with the test_api function: – Hein du Plessis Oct 13 '11 at 11:58
  • Cross check with [SOAP Docs](http://www.w3.org/TR/soap/) so you know what you do. To discover a service you don't exactly know about and you want to play around with, I would first use some SOAP GUI tool to probe function names and parameter types. – hakre Oct 13 '11 at 12:00
  • I'm pretty sure about the function names and parameters, I just don't know how to implement it in Delphi without the WSDL. Can I reverse engineer a WSDL ? – Hein du Plessis Oct 13 '11 at 12:07
  • In Delphi? Why have you posted PHP code? And yes you can write a WSDL on your own and provide it to a SOAP client. – hakre Oct 13 '11 at 12:10
  • The PHP code is the sample I've been given. I'll try coding a WSDL then. Thanks. – Hein du Plessis Oct 13 '11 at 12:24

1 Answers1

0

For very simple SOAP web services, it could be easier to follow existing examples / documentation or (if neither is good enough) record the interaction using a HTTP proxy (fiddler2), and then code the communciation using a XML library of your choice.

mjn
  • 36,362
  • 28
  • 176
  • 378
  • Thanks I've tried using SoapUI but it seems to require a WSDL before going any further? – Hein du Plessis Oct 15 '11 at 13:39
  • You are right - see http://stackoverflow.com/questions/5389568/how-to-use-soap-ui-without-wsdl - so I edited my answer – mjn Oct 15 '11 at 14:32
  • Damn was hoping I could use SoapUI to build up the WSDL. I have the function list, I'll try hacking it manually. Start / Run / Notepad.exe – Hein du Plessis Oct 17 '11 at 07:06