Advertisement
Guest User

Untitled

a guest
Sep 12th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. class Server {
  2.  
  3. public function getUsers( ) {
  4. $retorno = file_get_contents('php://input');
  5. return $retorno;
  6. }
  7.  
  8. $oSoapServer = new SoapServer(NULL, array( 'uri' => 'http://local.com.br/soap/' ) );
  9. $oSoapServer->setClass("Server");
  10. $oSoapServer->handle();
  11.  
  12. ini_set("soap.wsdl_cache_enabled", "0");
  13. $options = array(
  14. 'location' => 'http://local.com.br/soap/server.php?wsdl',
  15. 'uri' => 'http://local.com.br/soap/'
  16. );
  17. $oSoapClient = new SoapClient(NULL,$options);
  18.  
  19. $Auth = new stdClass();
  20. $Auth->SystemId = "DATA";
  21. $Auth->UserName = "USERNAME";
  22. $Auth->Password = "PASSWORD";
  23.  
  24. $auth_object = new SoapVar($Auth, SOAP_ENC_OBJECT);
  25. $header = new SoapHeader('http://local.com.br/soap/', 'Authorization', $auth_object);
  26.  
  27. $oSoapClient->__setSoapHeaders($header);
  28.  
  29. echo "<pre>";
  30.  
  31. /* Executing a fuction, for example isAlive method */
  32. $response = $oSoapClient->__soapCall("getUsers", array($auth_object));
  33. // $xml = simplexml_load_string($response);
  34. var_dump($response);
  35. echo "</pre>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement