Soap_persistence_session

software development

#1

Anyone know how I can get SOAP_PERSISTENCE_SESSION to work with PHP version 5.3.5? (Version of PHP that the server is using) ?

I’ve got a script (works fine on a home server PHP Version 5.3.6)

code I’m using

[code]

<?php class Hello { private $SavedFirst=""; private $SavedLast=""; public function HelloFullName($yourFName,$yourLName) { $this->SavedFirst = $yourFName; $this->SavedLast = $yourLName; return "Your Full name is ".$yourFName." ".$yourLName; } public function HelloFirstName($yourFName,$yourLName) { $this->SavedFirst = $yourFName; return "Your first name is ".$yourFName; } public function HelloLastName($yourLName) { $this->SavedLast = $yourLName; return "Hello your last name is ".$yourLName; } public function MemoryRecall() { $ReturnValue = ""; if($this->SavedFirst>"") { $ReturnValue = "I've Remermberd a First Name Of ".$this->SavedFirst; if($this->SavedLast>"")$ReturnValue = $ReturnValue." and a Last Name Of ".$this->SavedLast; } else { if($this->SavedLast>"") {$ReturnValue = $ReturnValue."I Only remember a Last Name of ".$this->SavedLast;} else {$ReturnValue = "Nope Don't Remember Anything";} } return $ReturnValue; } public function WhatSession() {return session_id();} } session_start(); $server = new SoapServer("hellonc.wsdl"); $server->setClass("Hello"); $server->setPersistence(SOAP_PERSISTENCE_SESSION); $server->handle(); ?>[/code]

c# Code that connects via WSDL

[code]
namespace SOAP
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
TestWSDL();
}
private void AddLog(string Text)
{
Log.Text = Log.Text + Text + Environment.NewLine;
}
public void TestWSDL()
{
Log.Text = “”;

        HelloWorld UseWebService = new HelloWorld();
        string FirstName = "John";
        string LasttName = "Doe";

        UseWebService.CookieContainer = new System.Net.CookieContainer();
        AddLog(UseWebService.MemoryRecall());
        System.Threading.Thread.Sleep(100);
        AddLog(UseWebService.HelloFirstName(FirstName));
        System.Threading.Thread.Sleep(100);
        AddLog(UseWebService.HelloLastName(LasttName));
        System.Threading.Thread.Sleep(100);
        AddLog(UseWebService.HelloFullName(FirstName,LasttName));
        System.Threading.Thread.Sleep(100);
        AddLog(UseWebService.MemoryRecall());
        System.Threading.Thread.Sleep(100);
        UseWebService.Dispose();
        
    }
}

}[/code]

Output

Nope Don't Remember Anything
Your first name is John
Hello your last name is Doe
Your Full name is John Doe
Nope Don't Remember Anything

Expected Output

Nope Don't Remember Anything
Your first name is John
Hello your last name is Doe
Your Full name is John Doe
Nope Don't Remember Anything
I've Remermberd a First Name Of John  and a Last Name Of Doe

#2

ok built a Linux Server at home this weekend running 3.5.3, and the script also works, why doesn’t the script work on Dreamhost ?

Why is the SOAP_PERSISTENCE_SESSION not remembering the variables between calls?
If I call WhatSession() at the start & end, it returns the same session ID, so my session isn’t changing, but the variables
$SavedFirst & $SavedLast are not being “remembered” between functions.


#3

Bump and more testing info.

Is their some setting in the PHP.INI File I can change ?

I run my PHP & WSDL on a local server & it works with my C# App.
I run the Same PHP & WSDL File on DreamHost and it fails :frowning:

The only change in the WSDL File is I either point to www.gw4y.com or 192.168.1.17.

included is the SOAP Env Envelopes I Get from Both Servers.

on www.gw4y.com I get this

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:HelloService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://www.gw4y.com" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
   <SOAP-ENV:Body>
      <ns1:GetCardTypeResponse>
         <CardReturn xsi:type="ns2:ACard">
            <sCardID xsi:type="xsd:string">PHP4139</sCardID>
            <sCardName xsi:type="xsd:string">A 4139 Card</sCardName>
            <sCardDescription xsi:type="xsd:string">Quad Die Card</sCardDescription>
         </CardReturn>
      </ns1:GetCardTypeResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

On 192.168.1.17 I Get This

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://192.168.1.17">
   <SOAP-ENV:Body>
      <ns1:GetCardTypeResponse>
         <CardReturn>
            <sCardID>PHP4139</sCardID>
            <sCardName>A 4139 Card</sCardName>
            <sCardDescription>Quad Die Card</sCardDescription>
         </CardReturn>
      </ns1:GetCardTypeResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

[hr]
The xsi:type=“xsd:string” additions are what I believe are killing the C# application from being able to process the data correctly.

How is the Dreamhost server adding it while both a ubuntu 11.04 server & windows server don’t add it?