![]() |
Nusoap in Code Igniter 1.5.4 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Nusoap in Code Igniter 1.5.4 (/showthread.php?tid=2885) |
Nusoap in Code Igniter 1.5.4 - El Forum - 08-29-2007 [eluser]Leonardo Radoiu[/eluser] Hello! After some hard time trying to figure out how I can implement nusoap library in 1.5.4 version I came up with a solution I want to share with all of you who came across the very same problem. First, the nusoap library file that you must put in the system/libraries folder (we assume we have already there the nusoap base class named nusoap.php). I named this Nusoap_lib.php: Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); Let's say we have a nusoap webservice named MemberWSVC saved as a controller file named MemberWSVC.php: Code: <?php Finally, we consume the webservice with a controller named Client.php: Code: <?php Let's say this client will be accesible at http://localhost/webservice.php/client/12345 That's it! I hope it works for you. Nusoap in Code Igniter 1.5.4 - El Forum - 09-12-2007 [eluser]Avatar[/eluser] Having some trouble, It's not running the function selectMemberInfo($member_id) within select_member_info function. I know this because I put echo 'here';die; statement. Below never shows here when access WS directly, hence it doesn't even get to load the model: Code: function select_member_info() { but this does Code: function select_member_info() { not sure why. Any help would be greatly appreciated. Thanks in advance. This is good stuff by the way. Thanks. Nusoap in Code Igniter 1.5.4 - El Forum - 09-13-2007 [eluser]Leonardo Radoiu[/eluser] Hi there! That first "echo" will never show up anything because that "the inside" of the selectMemberInfo() function is never accessible by WS directly (like http://localhost/MemberWSVC or http://localhost/MemberWSVC/index/wsdl) but when you consume the WS with a client. For instance, if you write a nusoap client script like this: Code: class Client extends Controller { And we access this controller, let's say, at http://localhost/client If something happens and the webservice doesn't return a thing and you don't know what is going on out there your can debug the nusoap client because all the error will be printed clearly in the [response] key of the object: Code: print_r($this->soapclient); *** What I forgot to mention earlier in my presentation *** is that you have to insert a route in your routes.php file in order to access the proper path of the wsdl: $route['MemberWSVC/select_member_info/wsdl'] = "MemberWSVC/index/wsdl"; All you have to keep in you mind (and that is what makes the trouble with Nusoap) is that the proper output of the WSDL and the proper path of the WSDL keeps your nusoap client working. That is, if you have an error along the way in your includes file (a white space or a debug output or an error of some kind) crashes the WSDL output. For any other questions on this subject I will answer you gladly because I work intensely with Nusoap in CI. Nusoap in Code Igniter 1.5.4 - El Forum - 09-14-2007 [eluser]Avatar[/eluser] SWEET, it works. Thank you so much. This is a great code for starters in nusoap. ![]() Nusoap in Code Igniter 1.5.4 - El Forum - 11-19-2007 [eluser]Wades[/eluser] Thanks Leonardo Radoiu but I have some question about your script here, could you explain it when you have time? following are my test code according to your's server.php Code: <?php client.php Code: <?php the first question is that the return value in the client, as you can see, it should return Code: $row['id'] = '1'; Code: A PHP Error was encountered Code: var_dump($row) Code: array(3) { [0]=> string(1) "1" [1]=> string(2) "fn" [2]=> string(2) "ln" } Code: $row['firstname'] Code: $this->nusoap_server->wsdl->addComplexType( the second question I have is that when I change Code: $this->nusoap_server->configureWSDL("Server", "urn:Server"); Code: $this->nusoap_server->configureWSDL("ss", "urn:ss"); Greatly appreciated!!! Nusoap in Code Igniter 1.5.4 - El Forum - 12-06-2007 [eluser]bigg-media[/eluser] NuSoap Library for CI http://codeigniter.com/wiki/CI_Nusoap_Library Nusoap in Code Igniter 1.5.4 - El Forum - 12-06-2007 [eluser]esra[/eluser] [quote author="bigg-media" date="1196985590"]NuSoap Library for CI http://codeigniter.com/wiki/CI_Nusoap_Library[/quote] A couple of recommendations if you don't mind. Start a new thread in the Ignited Code forum and add a line to your wiki article pointing them to that thread. That way users have a place to post questions and you get much better recognition for your work. In your new thread, point them to the wiki article's url. You might also want to post your code on the wiki between opening and closing code block tags, so the file can be copied in the exact format you wrote it in. There is an article on the wiki with an explanation of the codes. I have not had a chance to try this yet, but certainly will this weekend. Thanks for your contribution. Nusoap in Code Igniter 1.5.4 - El Forum - 04-09-2008 [eluser]herrucules[/eluser] Hi, i'm new to this nusoap, so please be patient ![]() i've tried to use the code above for serve n fetch the webservice.. but it came out as an error like this Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing Schema: unexpected <element> in restriction in D:\ci\apps\system\application\controllers\client.php:12 Stack trace: #0 D:\ci\apps\system\application\controllers\client.php(12): SoapClient->SoapClient('http://heppy/ci...') #1 [internal function]: Client->index('12') #2 D:\ci\apps\system\codeigniter\CodeIgniter.php(224): call_user_func_array(Array, Array) #3 D:\ci\apps\index.php(115): require_once('D:\ci\apps\syst...') #4 {main} thrown in D:\ci\apps\system\application\controllers\client.php on line 12 first thing i tried is create MemberWSVC.php and Client.php controller.. then copy paste the code above. since i didnt have Member model i just hardcode the $row values just like wades did. and then added the routes. and as a result i get message above. could anybody give me advice n direction thx alot. Nusoap in Code Igniter 1.5.4 - El Forum - 04-09-2008 [eluser]herrucules[/eluser] i've correct the error, my friend told me that i must unload the soap module from php extension first.. now the no error but the $row returned is empty A PHP Error was encountered Severity: Notice Message: Undefined index: Filename: libraries/Nusoap.php Line Number: 6497 i've tried to var_dump the values and it came out as an empty string: string(0) "" any help ? Nusoap in Code Igniter 1.5.4 - El Forum - 05-04-2008 [eluser]heriniaina[/eluser] I have the same error Quote:A PHP Error was encountered I use an external SOAP service (not in the same server) Code: $this->nusoap_client = new soapclient("http://radiovazogasy.com/wsdl/?wsdl"); Anybody can help? Thanks |