CodeIgniter Forums
NuSoap Problem and CodeIgniter 1.7.1 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: NuSoap Problem and CodeIgniter 1.7.1 (/showthread.php?tid=22227)



NuSoap Problem and CodeIgniter 1.7.1 - El Forum - 09-01-2009

[eluser]Bl1nk[/eluser]
I got a problem in running web servinces in CodeIgniter on $HTTP_RAW_POST_DATA.

I already modified php.ini its global variables and repopulate raw post data variables.

My system is installed with CodeIgniter 1.7.1 and XAMPP 1.7.1 which installed with these bundle:
Code:
###### ApacheFriends XAMPP (Basispaket) version 1.7.1 ######

  + Apache 2.2.11
  + MySQL 5.1.33 (Community Server)
  + PHP 5.2.9 + PEAR (Support for PHP 4 has been discontinued)
  + XAMPP Control Version 2.5 from www.nat32.com
  + XAMPP CLI Bundle 1.3 from Carsten Wiedmann    
  + XAMPP Security 1.0    
  + SQLite 2.8.15
  + OpenSSL 0.9.8i
  + phpMyAdmin 3.1.3.1
  + ADOdb 5.06a
  + Mercury Mail Transport System v4.62
  + FileZilla FTP Server 0.9.31
  + Webalizer 2.01-10
  + Zend Optimizer 3.3.0
  + eAccelerator 0.9.5.3 für PHP 5.2.9 (but not activated in the php.ini)
Code:
// Create Web Service Server
$server = new soap_server;

// Register Services
$server->register('hello');
$server->register('add');

// Define Services
function hello ($name){
  return "Hello $name";
}

function add ($x,$y){
  return $x + $y;
}

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

[Here are the errors]
In Google CHROME:
Code:
This page contains the following errors:

error on line 10 at column 7: Extra content at the end of the document
Below is a rendering of the page up to the first error.

A PHP Error was encountered Severity: Notice Message: Undefined index: content-type Filename: libraries/nusoap.php Line Number: 4210


In Mozilla Firefox:
Code:
XML Parsing Error: junk after document element
Location: http://localhost/mostrag/index.php/web_services/login
Line Number 10, Column 7:</div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
------^



NuSoap Problem and CodeIgniter 1.7.1 - El Forum - 11-26-2009

[eluser]alvk4r[/eluser]
See http://ellislab.com/forums/viewreply/671670/ for a complete example.
Try with something like
Code:
if($this->uri->rsegment(3) == "wsdl") {
            $_SERVER['QUERY_STRING'] = "wsdl";
        } else {
            $_SERVER['QUERY_STRING'] = "";
        }
        
        $this->server->service(file_get_contents("php://input"));
inside the index method of your controller.
You need... well see the attachment of my reply.

If the services screen don't appear, don't worry, if you can generate wsdl file through URL, your webservices will run.