Welcome Guest, Not a member yet? Register   Sign In
Requesting SOAP using CURL on Codieigniter 4
#1

(This post was last modified: 05-27-2020, 01:15 AM by remesses_thegreat.)

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.
Reply
#2

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
Reply
#3

(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
Reply
#4

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
Reply
#5

(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
Reply




Theme © iAndrew 2016 - Forum software by © MyBB