CodeIgniter Forums
How we can use SOAP with codeigniter ? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: How we can use SOAP with codeigniter ? (/showthread.php?tid=36575)



How we can use SOAP with codeigniter ? - El Forum - 12-07-2010

[eluser]Anurag[/eluser]
HI,

Is codeigniter support SOAP ? If not so how we can use SOAP along with framework.

Thanks


How we can use SOAP with codeigniter ? - El Forum - 12-07-2010

[eluser]Atharva[/eluser]
There is no special class for soap in CI. I use nuSOAP. I load the file in function like:
Code:
require_once(getcwd().'soap_lib/nusoap.php');
$wsdl = 'some url';
$client = new nusoap_client($wsdl, 'wsdl');
...
...
...

There may be some better ways, but this works for me.


How we can use SOAP with codeigniter ? - El Forum - 12-07-2010

[eluser]cahva[/eluser]
..or just use the built-in Soap class(needs to be enabled in PHP, usually is):
Code:
$client = new SoapClient("some.wsdl");



How we can use SOAP with codeigniter ? - El Forum - 12-07-2010

[eluser]Unknown[/eluser]
It's actually quite straightforward if you are using php 5 and have the soap library enabled.

Since I spent some time trying to get started myself, here is a "hello world" example using the built in soap classes, adapted from a post I found elsewhere on here.

Put the hello.wsdl file in the folder that corresponds to base_url() of your codeigniter app, and add the two controllers to your codeigniter controllers folder. Obviously in real life the client and server would be in two different places but this will give you the idea.

Invoke the client like so:

http://localhost/index.php/helloclient


How we can use SOAP with codeigniter ? - El Forum - 12-07-2010

[eluser]Anurag[/eluser]
Thanks Atharva , cahva and Gavin_R. Let me try with Gavin_R "hello world" example.If it not clear to me i will be back with queries.

Thanks again to all.


How we can use SOAP with codeigniter ? - El Forum - 12-08-2010

[eluser]Anurag[/eluser]
Hi Gavin,

Is soap address location is current ?

<soap:address location="http://localhost/sitename/index.php/helloserv/my_server/"/>

Any other changes are to made on hello.wsdl file.If so plz explain.


Thanks


How we can use SOAP with codeigniter ? - El Forum - 12-08-2010

[eluser]Anurag[/eluser]
At this line of code exception is occur

$return = $client->__soapCall("hello",array("world"));


How we can use SOAP with codeigniter ? - El Forum - 12-08-2010

[eluser]Anurag[/eluser]
Any how problem has been resolved.actually SOAP server path is not correct that time.

Thanks again for all you supports .