![]() |
Please help to make SOAP call using nusoap - 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: Please help to make SOAP call using nusoap (/showthread.php?tid=21077) Pages:
1
2
|
Please help to make SOAP call using nusoap - El Forum - 07-30-2009 [eluser]Gewa[/eluser] Hi, Endly I have managed to install nusoap I need to make a SOAP call Code: POST /1.0/commerce.asmx HTTP/1.1 Which will give me Code: HTTP/1.1 200 OK in my controller i have made usual code from forum I have got example Code: $this->load->library("nusoap"); but i get Code: Array How to fix this error and how to parse the response. Please help!!!! Please help to make SOAP call using nusoap - El Forum - 07-30-2009 [eluser]Gewa[/eluser] any help pleaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaseeeeeeeeeeeeee... Please help to make SOAP call using nusoap - El Forum - 07-30-2009 [eluser]bretticus[/eluser] Not sure how this is a CI issue. Why not try going over to the NuSOAP forums? http://sourceforge.net/forum/forum.php?forum_id=193579 Please help to make SOAP call using nusoap - El Forum - 07-31-2009 [eluser]Leonardo Radoiu[/eluser] Well, I'm not an expert in this SOAP-thing but I try to be of some help. Here are two solutions, I already tried them myself for the webservice you gave. 1. If you use PHP's internal soap functions (see http://www.php.net/soap): Code: class LicenseHeader{ 2. If you use nusoap (I made this test with nusoap v1.2): Code: //you need to put the second parameter set to true because it needs to know this is a wsdl file, otherwise it won't work and the answer is right back what you need, the list of vendors. Be careful, if you work in a safe-moded environment, put the condition below in the nusoap library, before the curl's option CURL_FOLLOWLOCATION, so you won't get a warning: Code: if ((!ini_get("safe_mode")) && (!strlen(ini_get("open_basedir")))) curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, 1); Good luck! Please help to make SOAP call using nusoap - El Forum - 07-31-2009 [eluser]Gewa[/eluser] Fatal error: Class declarations may not be nested in Z:\home\smysite.com\www\system\application\controllers\soap_parcer.php on line 31 31 line is Code: class LicenseHeader{ and second code gives A PHP Error was encountered Severity: Warning Message: SoapClient::SoapClient() expects parameter 2 to be array, boolean given Filename: controllers/soap_parcer.php Line Number: 34 Fatal error: Uncaught SoapFault exception: [Client] SoapClient::SoapClient() [<a href='function.SoapClient-SoapClient'>function.SoapClient-SoapClient</a>]: Invalid parameters in Z:\home\mysite.com\www\system\application\controllers\soap_parcer.php:34 Stack trace: #0 Z:\home\mysite.com\www\system\application\controllers\soap_parcer.php(34): SoapClient->SoapClient('https://api.acm...', true) #1 [internal function]: Soap_parcer->index() #2 Z:\home\mysite.com\www\system\codeigniter\CodeIgniter.php(224): call_user_func_array(Array, Array) #3 Z:\home\mysite.com\www\index.php(115): require_once('Z:\home\spamr.c...') #4 {main} thrown in Z:\home\mysite.com\www\system\application\controllers\soap_parcer.php on line 34 Please help to make SOAP call using nusoap - El Forum - 07-31-2009 [eluser]Gewa[/eluser] Maybe I am wrong in installing NUSOAP? i have just put the file from wiki in /system/application/libraries, then downloaded the latest version of nusoap from Sourceforge, and them also put all files from /lib/ folder to the same folder as nusoap.php from wiki .. when I uncomment this part Code: /* load classes*/ I get Fatal error: Class 'nusoap_base' not found in Z:\home\mysite.com\www\system\application\libraries\class.soapclient.php on line 26 What to do , I don't know... Please help to make SOAP call using nusoap - El Forum - 07-31-2009 [eluser]Leonardo Radoiu[/eluser] Obviously, first of all you need to create a file for the LicenseHeader class and then load it into your controller. Second, I don't think the nusoap library from Sourceforge is the latest, I've got v1.2 and they have v0.7.3. But you may just get lucky, give it a try. Third, you have to load the nusoap.php file from their kit, which is the file that includes all the other classes in itself. Be careful, if you have the latest PHP version installed there may be some conflicts in function names because PHP has classes and functions are named alike. In this case just prefix your classes from nusoap.php with "nu": e.g. class "soapclient" becames class "nusoapclient" etc. Please help to make SOAP call using nusoap - El Forum - 07-31-2009 [eluser]Gewa[/eluser] can you email me version 1.2 ? thanks.... Please help to make SOAP call using nusoap - El Forum - 08-01-2009 [eluser]Gewa[/eluser] I understood everything(THANKS TO LEO!!!) Just one thing is not clear in NuSoap and Soap ... For example there is a request Code: <?xml version="1.0" encoding="utf-8"?> How to pass Code: <Filters> My head is blowing.... Please help to make SOAP call using nusoap - El Forum - 08-09-2009 [eluser]Leonardo Radoiu[/eluser] For this method of the webservice you need to use a serialized envelope in order to send the parameters, like this: Code: $client = new nusoapclient('https://api.acme.lt/1.0/commerce.asmx?WSDL', true); Notice that in this case the LicenseHeader is sent with this serialized envelope in the third parameter (header), and the filters in the second parameter (body) of the function serializeEnvelope (see the nusoap documentation), as you can see in the method definition: Code: <soap:Header> The other parameters: 'document' and 'literal' are specified in the wsdl of the webservice (see style='document' and use='literal' below): Code: <wsdl:operation name="GetProductList"> Be careful, you may need to adjust the connection timeout or the response timeout respectively, to be sure that the response is not very big (in the matter of data) or your connection is not chunked in some way, in order to prevent the script stop running before the list is downloaded. |