Results 1 to 4 of 4

Thread: Problem of session with Soap object

  1. #1
    Join Date
    Jun 2009
    Posts
    83

    Problem of session with Soap object

    I'm over SOAP (extension php_soap) and I get the following message when I try to use a SOAP object passed in session:
    supplied argument is not a valid sdl resource
    In a login page, I initialize the object and instantiates:
    PHP Code:
    $_SESSION["conn_telephone"] = new connections_telephone();
    if (
    $_SESSION["conn_telephone"]->login_reseller($_POST["t_pseudo"],$_POST["t_password"])){
    $_SESSION["conn_telephone"]->id_session $_SESSION["conn_telephone"]->login_reseller($_POST["t_pseudo"],$_POST["t_password"]);
    redirect("index.php?p=member" );

    And on top of the member's area, I would do this:
    PHP Code:
    $tab_customer $_SESSION["conn_telephone"]->get_customers();
    for(
    $i=0$i<count($tab_customer->{'customer_list'});$i++){
    $curr_customer $tab_customer->{'customer_list'}[$i]->{'i_customer'};
    $tab_competes $conn_portaone->get_competes($curr_customer);
    for(
    $j=0$j<count($tab_competes ->{'account_list'});$j++){
     echo 
    $tab_competes ->{'account_list'}[$j]."<br><br>";
    }

    So after some reading on the internet, I tried using serialize and unserialize but without success ...

    Login Page:

    PHP Code:
    $conn_telephone = new connections_telephone();
    if (
    $conn_telephone->login_reseller($_POST["t_pseudo"],$_POST["t_password"])){
    $conn_telephone->id_session $conn_telephone->login_reseller($_POST["t_pseudo"],$_POST["t_password"]);
            
    serialize($conn_telephone);
            
    redirect("index.php?p=member" );

    Page of the member's area:
    PHP Code:
    unserialize($conn_telephone);
    $tab_customer $conn_telephone->get_customers();
    for(
    $i=0$i<count($tab_customer->{'customer_list'});$i++){
    $curr_customer $tab_customer->{'customer_list'}[$i]->{'i_customer'};
    $tab_competes $conn_portaone->get_competes($curr_customer);
    for(
    $j=0$j<count($tab_competes ->{'account_list'});$j++){
     echo 
    $tab_competes ->{'account_list'}[$j]."<br><br>";
    }

    And there I have a message that $conn_telephone is not defined!

    If you saw an error in my code, or if you have a track then please help me!

  2. #2
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Problem of session with Soap object

    If:
    1) you do not serialize conn_telephone $ in $ _SESSION [ 'conn_telephone']
    2) in another script, you do not use $ _SESSION [ 'conn_telephone'] to unserialize
    3) you do not store the result of the deserialization in a variable like $ conn_telephone

    then it is likely to occur.

    1. must store the result of serializing in a session variable if you want to find it in another page or another script
    2. $conn_telephone is not necessary to recover from the session variable created in the previous script
    3. unserialize but you should see to store the result in a variable for use later in the script

  3. #3
    Join Date
    Nov 2008
    Posts
    1,192

    Re: Problem of session with Soap object

    There is no need to use a serialize or unserialize, because:

    these objects are automatically linearized with the function serialize() at the end of each script, and replayed with unserialize() at the beginning of the next script
    On the other side, for the recovery of an object stored in a session works well, must know php class object before the session_start. You must therefore include file class definition before session_start.

  4. #4
    Join Date
    Jun 2009
    Posts
    83

    Re: Problem of session with Soap object

    @ Modifier

    Hmmm yeah this is the last version of my code after much testing to find a way to serialize and unserialize ...

    I went through this kind of step between two (unsuccessful):
    Login Page:

    PHP Code:
    $conn_telephone = new connections_telephone();
    if (
    $conn_telephone->login_reseller($_POST["t_pseudo"],$_POST["t_password"])){
       
    $conn_telephone->id_session $conn_telephone->login_reseller($_POST["t_pseudo"],$_POST["t_password"]);
     
       
    $my_conn serialize($conn_telephone);
       
    redirect("index.php?p=member" );

    Page of the member's area:

    PHP Code:
    $conn_telephoneunserialize($my_conn);
    $tab_customer $conn_telephone->get_customers();
    for(
    $i=0$i<count($tab_customer->{'customer_list'});$i++){
       
    $curr_customer $tab_customer->{'customer_list'}[$i]->{'i_customer'};
       
    $tab_competes $conn_portaone->get_competes($curr_customer);
       for(
    $j=0$j<count($tab_competes ->{'account_list'});$j++){
          echo 
    $tab_competes ->{'account_list'}[$j]."<br><br>";
       }


Similar Threads

  1. Replies: 4
    Last Post: 17-01-2011, 11:14 AM
  2. Replies: 4
    Last Post: 24-12-2010, 07:58 AM
  3. Replies: 3
    Last Post: 31-07-2009, 01:09 PM
  4. Replies: 9
    Last Post: 10-04-2009, 01:51 AM
  5. Problem Creating session under XP
    By Swaraj in forum Operating Systems
    Replies: 3
    Last Post: 25-02-2009, 02:42 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,148,838.84644 seconds with 16 queries