Welcome Guest, Not a member yet? Register   Sign In
How we can use SOAP with codeigniter ?
#1

[eluser]Anurag[/eluser]
HI,

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

Thanks
#2

[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.
#3

[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");
#4

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

[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.
#6

[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
#7

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

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

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

Thanks again for all you supports .




Theme © iAndrew 2016 - Forum software by © MyBB