Part of the EllisLab Network
   
 
problem with webservice inside CI
Posted: 29 August 2008 02: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 04:19 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  846
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 me on Twitter - Try my EE plug-ins and extensions

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120378 Total Logged-in Users: 19
Total Topics: 126497 Total Anonymous Users: 4
Total Replies: 665221 Total Guests: 275
Total Posts: 791718    
Members ( View Memberlist )