CodeIgniter Forums
Requesting SOAP using CURL on Codieigniter 4 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Requesting SOAP using CURL on Codieigniter 4 (/showthread.php?tid=76567)



Requesting SOAP using CURL on Codieigniter 4 - remesses_thegreat - 05-27-2020

I am consuming a service using CURL. I am able to connect all the functions of the services in the form of a CXF Service List using the following code.
$client = \Config\Services::curlrequest();
Code:
    $response = $client->request('GET', 'www.soapservice.co.za/service');

    var_dump($response->getBody());
Var Dump Returns a string with Available services
The service has 10 functions listed in this manner getDataFunction.
How do i invoke the function? Or how do i get the contents of the body and start using Service functions ?
Any help would be appreciated

I was using SoapClient on CI3 now I have moved to CI4 and the same SoapClient code that worked on CI3 does not work on CI4. Does CI4 Support SOAP? I would use soap client too as it was much easier for me. I am very new to CURL. If you have a solution i would appreciate it. The service was developed using Java and it returns CXF Service List with all Available functions.


RE: Requesting SOAP using CURL on Codieigniter 4 - jreklund - 06-01-2020

You will need to provide us with code on how you use the SoapClient and what error you get. I guess you mean the official one?
https://www.php.net/manual/en/class.soapclient.php

Most likely you need to put \ in front of every function.

From:
SoapClient

Into:
\SoapClient


RE: Requesting SOAP using CURL on Codieigniter 4 - remesses_thegreat - 06-02-2020

(06-01-2020, 02:26 PM)jreklund Wrote: You will need to provide us with code on how you use the SoapClient and what error you get. I guess you mean the official one?
https://www.php.net/manual/en/class.soapclient.php

Most likely you need to put \ in front of every function.

From:
SoapClient

Into:
\SoapClient
Thank you so much. That work :-) Really Appreciate it jreklund


RE: Requesting SOAP using CURL on Codieigniter 4 - korgoth - 06-02-2020

Can you indeed show an example of how you made that work? I too have to deal with SOAP calls in CI4 and have no clue on how to do it Wink


RE: Requesting SOAP using CURL on Codieigniter 4 - remesses_thegreat - 06-02-2020

(06-02-2020, 01:42 AM)korgoth Wrote: Can you indeed show an example of how you made that work? I too have to deal with SOAP calls in CI4 and have no clue on how to do it Wink
 Here you go 


public function test()
    {
    $url = '';     

    $client = new \SoapClient($url);
    
    $response = $client->getOfficeRegistryList();

    var_dump($response); 

    $office = $response->return

    foreach($office as $row)
    {
        echo $row->fullDescription;
        echo "<br>";
    }
    }


I hope this will be helpful