I need to develop a web service that will be called from a website developed using PHP.
For testing purposes I created a SOAP based Server, added a test method, but when I call my service from php, it seems that parameters aren’t passed to the server. This is my code in PHP (I don’t know php too much ).
<?php
$client = new SoapClient('http://127.0.0.1:8099/SOAP/NewService');
$response = $client->Echo('Test');
print_r($response);
?>
This is my method on the server:
function TNewService.Echo(const pEchoString: AnsiString): AnsiString;
begin
Result := 'This is a test: ' + pEchoString; //pEchoString is always equal to ''
end;
I read that you can call SOAP services developed with RemObjects SDK, like any other SOAP webservices. I tried also doing the same server with the Delphi’s own webservices and the testcase works. I also know that you can generate the interface for php, but the thing is that I don’t know who to call it.
If you guys have a Sample on how to call my SOAP webservice, or if you could tell where a I doing something wrong. I would really appreciate it.
hello again, I have downloaded a working example of SOAP and SSL from here ( HTTPS Server) and I can see that is working fine, but again I need to test it with a php client, but I always get this error.
This is my php:
and I get this error: > SOAP-ERROR: Parsing WSDL: Couldn’t load from ‘https://192.168.10.6:8099/soap’ : failed to load external entity "https://192.168.10.6:8099/soap"
I have enabled openssl in php.ini, do you have any idea of how to ge rid of this error (or a working example with a SOAP Remobjects service and a php client), because I tried all sorts of non-working solutions for the past two days.
Best regards,
Cristian
Ok, after another day of searching I realised the mistake I made, I used the same certificate for server and for client.
After that I generated a new certificate for my php client, and also it didn’t work, the problem was the “local_cert” needs to contain
also the private and the public key of the phpclient. After that I tried again and it didn’t worked. I received this error:
Fatal error: Uncaught SoapFault exception: [HTTP] Error Fetching http headers in C:\xampp\htdocs\test\test2.php:19 Stack trace: #0 [internal function]: SoapClient->__doRequest(‘<?xml version="…’, ‘http://localhos…’, ‘urn:NewLibrary-…’, 1, 0) #1 C:\xampp\htdocs\test\test2.php(19): SoapClient->__call(‘Sum’, Array) #2 C:\xampp\htdocs\test\test2.php(19): SoapClient->Sum(Object(stdClass)) #3 {main} thrown in C:\xampp\htdocs\test\test2.php on line 19
After that I began inspecting the wsdl for errors: I noticed at this line of the RODL generated wsdl:
<soap:address location=“http://localhost:8099/SOAP?service=NewService”/> that it doesn’t has https, and I think that this is the problem.
In the next step I built a new project of indy ssl (without rem sdk), and looked in the wsdl at the same line and it has “https” at the address tag. I tried my
php code and with this new address it works, and that’s why I presume that the problem with RemObjects SSL server might be at that address tag.
I am waiting for directions from you now. It would be nice if we could have a better integration of Remobjects and SSL. I know that you have your own crypting mechanism, but I can’t use it because I don’t know in which programming language the clients will be built with; I am sure that one will be in php, but I am not sure for the other(s).
Best regards,
Cristian Vasuica
hello again, nobody answered my question, could you please tell what are the problems and if it works with my version. Please have a look into this because time is precious and I need to give feedback to my manager.
Kind regards,
Cristian Vasuica
@EvgenyK thanks a lot. it works now. I have read that you plan to support ssl in a easier way in the next release. If that is true I will do my best in convincing my manager to upgrade RemObjects to the last version.