Welcome Guest, Not a member yet? Register   Sign In
Using models in soap webservice server
#1

[eluser]excitedcroc[/eluser]
Hi,

I am having difficulty getting my remote nusoap web service to use models correctly?

Please see the code below ...

I am getting a php error saying that PageModel::$db is not defined. Although if I go to the script directly as if were a controller the code runs fine!

Do I need somehow to tell Codeigniter to allow SOAP calls to access it properly ?

Here is my code, I am accessing it via a client which calls server.get_page(). The call is a success and even loads the model. However as soon as I try to query the database it complains that db is not defined in the model.

Thanks for any suggestions ...


Code:
<?php
class TheServer extends Controller
{
    function TheServer( )
    {
        parent::Controller( );

        $this->load->library( "Nusoap_lib" );

        $this->nusoap_server = new soap_server( );

        $this->nusoap_server->configureWSDL( "TheServer", "urn:TheServer" );
        
        $this->nusoap_server->register( "TheServer.get_page",
            array( "page_num" =>  "xsd:int" ),
            array( "return" =>  "xsd:string" ),
             "urn:TheServer",
             "urn:TheServer#get_page",
             "rpc",
             "encoded",
             "Get the HTML for the page specified"
        );
    }

    function get_page( $data )
    {
            $this->load->model( "PageModel" );
            $pageDetails = $this->PageModel->getPage( 1 );
            
            print_r( $pageDetails );
            
        // return "first_name" ;
    }
    
    function index()
    {
        if( $this->uri->segment( 2 ) == "wsdl" || isset( $_REQUEST[ "wsdl" ] ) )
        {
            $_SERVER[ "QUERY_STRING" ] = "wsdl";
        }
        else
        {
            $_SERVER[ "QUERY_STRING" ] = "";
        }
        $this->nusoap_server->service( file_get_contents( "php://input" ) );
    }
}




Theme © iAndrew 2016 - Forum software by © MyBB