Welcome Guest, Not a member yet? Register   Sign In
CI SOAP Server Problem
#1

[eluser]JanDoToDo[/eluser]
Hey guys,

Am currently making a SOAP server with CI and have this:

Code:
class Web_server extends Controller {
    
    function getOrder($username, $password)
    {
        $user = 'delagua';
        $pass = 'admin123!';
        
        if ($user == $username AND $pass == $password) :
            //$query = $this -> ci -> db -> get('country_iso');
            $query = $this -> db -> select('o.*')
                                    -> from('orders AS o')
                                    -> where(array())
                                    -> get();
            $results = $query -> result_array();
            
            foreach ($results as $order) :
                $items = array();
                foreach ($order as $k => $item) :
                    $items[$k] = array($item, 'string');
                endforeach;
                
                $query = $this -> ci -> db -> select('od.product_id, od.product_quantity')
                                        -> from('orders_products AS od')
                                        -> where('order_id', $order['order_id'])
                                        -> get();
                $products = $query -> result_array();
                foreach ($products as $product) :
                    foreach ($product as $k => $prod) :
                        $pr[$k] = array($prod, 'string');
                    endforeach;
                    
                endforeach;
                $prods[] = array($pr, 'struct');
                $items['products'] = array($prods, 'struct');
                $orders[$order['order_id']] = array($items, 'struct');
            endforeach;
            
            return $orders;
        
            //return 'validation success';
            
        else :
            throw new SoapFault("Server", "Validation Failed");
        endif;
    }
    
    function index()
    {
        ini_set('soap.wsdl_cache_limit', 0);
        ini_set('soap.wsdl_cache_ttl', 0);
        $server = new SoapServer('http://www.domain.org/assets/server.wsdl');
        $server -> setClass('Web_server');
        $server -> handle();
    }

When I run the client I get this error returned:

SoapFault exception: [SOAP-ENV:Server] Call to a member function get() on a non-object in...

However, when I take out the DB requests, it works fine. I tried instantiating the CI super object inside the function but that didnt work.

Anyone have any ideas?


Messages In This Thread
CI SOAP Server Problem - by El Forum - 03-19-2010, 05:49 AM
CI SOAP Server Problem - by El Forum - 03-19-2010, 06:24 AM
CI SOAP Server Problem - by El Forum - 03-19-2010, 06:25 AM
CI SOAP Server Problem - by El Forum - 03-19-2010, 06:26 AM
CI SOAP Server Problem - by El Forum - 03-19-2010, 06:31 AM
CI SOAP Server Problem - by El Forum - 03-19-2010, 07:16 AM
CI SOAP Server Problem - by El Forum - 03-21-2010, 04:27 PM
CI SOAP Server Problem - by El Forum - 03-29-2010, 12:14 PM
CI SOAP Server Problem - by El Forum - 03-29-2010, 12:21 PM
CI SOAP Server Problem - by El Forum - 06-09-2010, 12:32 PM
CI SOAP Server Problem - by El Forum - 06-09-2010, 12:42 PM
CI SOAP Server Problem - by El Forum - 06-09-2010, 01:06 PM
CI SOAP Server Problem - by El Forum - 06-09-2010, 01:19 PM
CI SOAP Server Problem - by El Forum - 06-09-2010, 02:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB