Changing version from PHP4 to PHP5

View: New views
1 Messages — Rating Filter:   Alert me  

Changing version from PHP4 to PHP5

by I.N.T. - Luis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everybody,

We have some code written for PHP4 using the SOAP libraries for connect
as a CLIENT to a web service. The web service SERVER is not ours, we
don“t know how it is programed. The code is:

require_once('lib/nusoap.php'); // where we are publishing the SOAP
libraries

function checkUser($user, $pass)
{
        $client = new
soapclient("http://80.32.91.149:25000/servicioXYZ.asmx?WSDL", "wsdl");
        $params = array(
                                    'RutaTabla'  => "d:\\ourpw\\",
                                    'ElUsuario'  => $user,
                                    'ElPassword' => $pass,
                                    'QuienEs'    => 'CLIENTE'
                                  );

        $theProxy = $client->getProxy();
        $ok = $theProxy->AutentificaPW($params);

        $result = $ok["AutentificaPWResult"];

        $tagsToSearch = Array("nombre", "situacion", "email", "codigo",
"pagina");

        $tagObj = publis_TagsToArray($result, $tagsToSearch);  // this
is a internal function we use

        return $tagObj;
}

IT WORKED FINE!!!

Now we have actualized our systems to PHP5 obligatory.

The error is:

*Warning*: SoapClient::SoapClient() expects parameter 2 to be array,
string given in *xxx.php* on line *13*

*Fatal error*: Uncaught SoapFault exception: [Client]
SoapClient::SoapClient() [<a
href='soapclient.soapclient'>soapclient.soapclient</a>]: Invalid
parameters in xxx.php:13 Stack trace: #0 xxx.php(13):
SoapClient->SoapClient('http://80.32.91...', 'wsdl') #1 xxx.php(163):
checkUser('XXX', 'YYY') #2 {main} thrown in *xxx.php* on line *13

*OK, looking for "new" SOAP functions, I change my code as:

//require_once('lib/nusoap.php'); // using internal SOAP PHP libraries

function checkUser($user, $pass)
{
        $client = new
soapclient("http://80.32.91.149:25000/servicioXYZ.asmx?WSDL");
        $params = array(
                                    'RutaTabla'  => "d:\\ourpw\\",
                                    'ElUsuario'  => $user,
                                    'ElPassword' => $pass,
                                    'QuienEs'    => 'CLIENTE'
                                  );

        $theProxy = $client->getProxy();
        $ok = $theProxy->AutentificaPW($params);

        $result = $ok["AutentificaPWResult"];

        $tagsToSearch = Array("nombre", "situacion", "email", "codigo",
"pagina");

        $tagObj = publis_TagsToArray($result, $tagsToSearch);  // this
is a internal function we use

        return $tagObj;
}

The error is:

*Fatal error*: Uncaught SoapFault exception: [Client] Function
("getProxy") is not a valid method for this service in xxx.php:22 Stack
trace: #0 [internal function]: SoapClient->__call('getProxy', Array) #1
xxx.php(22): SoapClient->getProxy() #2 xxx.php(163): checkUser('XXX',
'YYY') #3 {main} thrown in *xxx.php* on line *22

*As you can see I need the variable $theProxy to authenticate the
password against the proxy. Looking for help in the web, I haven't find
valid ideas to correct this.

How could I do it? The code, in my opinion is very simple, but I'm not
able to correct or adapt it to PHP5 with ne new SOAP libraries (functions).

What's wrong? Any idea?

Thank you very much