Jump to content
knoker

PHP + SOAP

Recommended Posts

knoker

Boas,

tou aki num projecto k ta a dar cmg em doido.

O caso é o seguinte... existe um servidor que disponibiliza webServices.... em que um desses webservices é o login, até ai td bem corro o login, e corro outro metodo desse webservice e sem espinhas, mas para aceder aos outros webservices pelo que entendi tenho k manter a mesma sessão do login... o problem é como é que eu fasso isso....

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        $wsdl_url = 'https://*******/******/userLoginWS.asmx?WSDL';
        $client = new SOAPClient($wsdl_url, Array('trace' => 1));
        $params = array(
            'userCode' => "<****",
            'password' => "****",
            'applicationID' => "",
        );
        $return = $client->userLogin($params);
        echo "REQUEST HEADERS:\n" . $client->__getLastRequestHeaders() . "\n";
        echo"<BR><br>";print_r($return);
        echo "<br><br>RESPONSE HEADERS:\n" . $client->__getLastResponseHeaders() . "\n";
        echo"<BR><BR><BR><BR>";


        $params = array(
        );
        $return = $client->getUsCompanies($params);
        echo "REQUEST HEADERS:\n" . $client->__getLastRequestHeaders() . "\n";
        echo"<BR><br>";print_r($return);
        echo "<br><br>RESPONSE HEADERS:\n" . $client->__getLastResponseHeaders() . "\n";
        echo"<BR><BR><BR><BR>";


        $wsdl_url2 = 'https://**********/******/clws.asmx?WSDL';
        $client2 = new SOAPClient($wsdl_url2);
        $params = array(
        );
        $return = $client2->getAllRecords($params);
        //$return = $client->__soapCall("getAllRecords", $params);
        echo "REQUEST HEADERS:\n" . $client2->__getLastRequestHeaders() . "\n";
        echo"<BR><br>";print_r($return);
        echo "<br><br>RESPONSE HEADERS:\n" . $client2->__getLastResponseHeaders() . "\n";
        ?>
    </body>
</html>

o output é algo deste género:

REQUEST HEADERS: POST /65B69F15/userLoginws.asmx HTTP/1.1 Host: sis.*****.com Connection: Keep-Alive User-Agent: PHP-SOAP/5.3.1 Content-Type: text/xml; charset=utf-8 SOAPAction: "http://www.***.pt/userLogin" Content-Length: 345

stdClass Object ( [userLoginResult] => stdClass Object ( [messages] => stdClass Object ( ) [result] => stdClass Object ( [GenericVO] => stdClass Object ( [ChangedFields] => stdClass Object ( [Fields] => stdClass Object ( ) [Values] => stdClass Object ( ) ) [Operation] => None [logInfo] => [ousrinis] => Admin [ousrdata] => 2011-02-25T00:00:00 [ousrhora] => 14:32:17 [usrinis] => Admin [usrdata] => 2011-02-25T00:00:00 [usrhora] => 14:32:17 [syshist] => [usstamp] => 433-4cb8-9870-ca86f0ef8f6 [usercode] => eduardo [username] => Eduardo [userno] => 11 [usavanc] => [esa] => 1 [inactivo] => [area] => [faz**manutencao] => 1 [jaini] => 1 [codpais] => [email] => eduardo.oliveira@******.com [companies] => stdClass Object ( [usCompanyVO] => stdClass Object ( [ChangedFields] => stdClass Object ( [Fields] => stdClass Object ( ) [Values] => stdClass Object ( ) ) [Operation] => None [logInfo] => [ousrinis] => Admin [ousrdata] => 2011-02-25T00:00:00 [ousrhora] => 14:32:17 [usrinis] => Admin [usrdata] => 2011-02-25T00:00:00 [usrhora] => 14:32:17 [syshist] => [usercompanystamp] => e9d-4786-a620-fe2c90ce518 [usstamp] => 433-4cb8-9870-ca86f0ef8f6 [companystamp] => -maincompany- [name] => Empresa000265 [dbtitle] => DemoMaisRitmo**201010 [active] => [status] => Updated [errorCode] => [tablesOutdated] => 0 [tablesUpdated] => 0 ) ) [products] => stdClass Object ( ) [appproducts] => stdClass Object ( ) [bookmarks] => stdClass Object ( ) [menuItems] => stdClass Object ( ) [panels] => stdClass Object ( ) [permissions] => stdClass Object ( ) [recentforms] => stdClass Object ( ) [openforms] => stdClass Object ( ) [userasks] => stdClass Object ( ) ) ) ) )

RESPONSE HEADERS: HTTP/1.1 200 OK Cache-Control: private, max-age=0 Content-Length: 1820 Content-Type: text/xml; charset=utf-8 Server: Microsoft-IIS/7.0 X-AspNet-Version: 4.0.30319 Set-Cookie: ASP.NET_SessionId=5jxxkixnb4ce4l5b5pfnlr4y; path=/; HttpOnly X-Powered-By: ASP.NET Date: Mon, 28 Feb 2011 13:10:49 GMT



REQUEST HEADERS: POST /65B69F15/userLoginws.asmx HTTP/1.1 Host: sis.*****.com Connection: Keep-Alive User-Agent: PHP-SOAP/5.3.1 Content-Type: text/xml; charset=utf-8 SOAPAction: "http://www.***.pt/getUsCompanies" Content-Length: 221 Cookie: ASP.NET_SessionId=5jxxkixnb4ce4l5b5pfnlr4y;

stdClass Object ( [getUsCompaniesResult] => stdClass Object ( [messages] => stdClass Object ( ) [result] => stdClass Object ( [GenericVO] => stdClass Object ( [ChangedFields] => stdClass Object ( [Fields] => stdClass Object ( ) [Values] => stdClass Object ( ) ) [Operation] => None [logInfo] => [ousrdata] => 0001-01-01T00:00:00 [usrdata] => 0001-01-01T00:00:00 [syshist] => [companystamp] => -maincompany- [name] => Empresa000265 [dbtitle] => **********201010 [active] => [status] => Updated [errorCode] => [tablesOutdated] => 0 [tablesUpdated] => 0 ) ) ) )

RESPONSE HEADERS: HTTP/1.1 200 OK Cache-Control: private, max-age=0 Content-Length: 866 Content-Type: text/xml; charset=utf-8 Server: Microsoft-IIS/7.0 X-AspNet-Version: 4.0.30319 X-Powered-By: ASP.NET Date: Mon, 28 Feb 2011 13:10:49 GMT



REQUEST HEADERS:

stdClass Object ( [getAllRecordsResult] => stdClass Object ( [messages] => stdClass Object ( [MessageVO] => stdClass Object ( [ChangedFields] => stdClass Object ( [Fields] => stdClass Object ( ) [Values] => stdClass Object ( ) ) [Operation] => None [logInfo] => [ousrdata] => 0001-01-01T00:00:00 [usrdata] => 0001-01-01T00:00:00 [syshist] => [messageCode] => errors.Business.UserLogin.UserNotLoggedIn [messageError] => [messageData] => stdClass Object ( ) ) ) [result] => stdClass Object ( ) ) )

RESPONSE HEADERS:

Pah agradecia qualquer tipo de ajuda....

Cumprimentos,

Eduardo Oliveira

Share this post


Link to post
Share on other sites
visualshotmac

knoker conseguiste resolver esse teu problema?

Estou exactamente com o mesmo problema, para ligar aos mesmos webservices que tu...

Consigo aceder a outros métodos dentro do login, mas tal como tu ao aceder ao clws.asmx?wsdl queixa-se que não tenho sessão iniciada...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.