Part of the EllisLab Network
   
 
problem with webservice inside CI
Posted: 29 August 2008 03:19 PM   [ Ignore ]  
Summer Student
Total Posts:  8
Joined  09-12-2007

I would like some help with the fallowing!
it’s a simple hello world example that’s work outside CI, but when I tried putting in it a controller it just wont work, maybe someone can guide me in the right direction.
here’s what I have outside:
/* services.php */

require_once('../nusoap/lib/nusoap.php');

  
$server = new soap_server();

  
$server->configureWSDL('services''urn:helloString');

  
$server->register("getHello",
                       array(
'fname' => 'xsd:string'),
                       array(
'return' => 'xsd:string'),
                       
'urn:helloString',
                       
'urn:services#getHello'
                       
);

   
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA '';
   
$server->service($HTTP_RAW_POST_DATA);


function 
getHello($fname{
         $response 
"Hello  ".$fname;
      return 
$response;
  

In both cases, the client is inside CI (webclient.php)

class Webclient extends Controller {

    
function Webclient() {
        parent
::Controller();
        
$this->load->library("nusoap");
    
}

    
function index()
     
{

           $fname 
"john doe";
           
//$wsdlurl = 'http://localhost/services/index/wsdl'; //inside CI
           
$wsdlurl 'http://localhost/services.php?wsdl'//outside CI
        
$client = new soapClient($wsdlurl,true);
        
$result $client->call('getHello', array('fname' => $fname));
        print 
"$result";
      
}
  } 

here’s what I tried inside CI, but I think it just never call the function getHello, I got null as a response.
services.php:

class Services extends Controller {

    
function Services() {
        parent
::Controller();
        
$this->load->library("nusoap");
    
}

    
function index()
     
{

             $_SERVER[
'QUERY_STRING''wsdl';
          
$server = new soap_server();
          
$server->configureWSDL('services''urn:idhello');
          
$server->register("getHello",
                               array(
'fname' => 'xsd:string'),
                               array(
'return' => 'xsd:string'),
                               
'urn:idhello',
                               
'urn:services#getHello'
                               
);
           
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA '';
           
$server->service($HTTP_RAW_POST_DATA);
      
}

     
function getHello($fname{
              $response 
"Hello  ".$fname;
              return 
$response;
      
}

thank in advance for any suggestion to make it work smile

Profile
 
 
Posted: 27 March 2009 05:19 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  739
Joined  10-14-2005

Hi Kurtis, apparently I am stalking you on the forums! smile

Again would love to see the final code if you got this working, I’m having the exact same problem as you described here.

 Signature 

Nathan Pitman - Nine Four

Follow us on Twitter - ExpressionEngine Add ons from Nine Four

Profile