Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. <?php
  2. include_once('../tecnologia/Sistema.php');
  3.  
  4. $usuario = $_SESSION['usuario'];
  5. $senha = $_SESSION['senha'];
  6. $senhaNaoCriptografada = $_SESSION['senhaNaoCriptografada'];
  7.  
  8. $tipo = Sistema::getPost('tipo');
  9. $tipoHandle = Sistema::getPost('tipoHandle');
  10. $viagem = Sistema::getPost('viagem');
  11. $viagemHandle = Sistema::getPost('viagemHandle');
  12. $data = date('Y-m-d', strtotime(Sistema::getPost('data')));
  13. $quantidade = Sistema::getPost('quantidade');
  14. $ValorUnitario = Sistema::getPost('ValorUnitario');
  15. $ValorTotal = Sistema::getPost('ValorTotal');
  16. $despesa = Sistema::getPost('despesa');
  17. $despesaHandle = Sistema::getPost('despesaHandle');
  18. $fornecedor = Sistema::getPost('fornecedor');
  19. $fornecedorHandle = Sistema::getPost('fornecedorHandle');
  20. $FormaPagamento = Sistema::getPost('FormaPagamento');
  21. $FormaPagamentoHandle = Sistema::getPost('FormaPagamentoHandle');
  22. $CondicaoPagamento = Sistema::getPost('CondicaoPagamento');
  23. $CondicaoPagamentoHandle = Sistema::getPost('CondicaoPagamentoHandle');
  24. $observacao = Sistema::getPost('observacao');
  25. $anexo = Sistema::getPost('anexo');
  26.  
  27.  
  28.  
  29. ini_set('default_socket_timeout', 600);
  30. ini_set("soap.wsdl_cache_enabled", "0");
  31. libxml_disable_entity_loader(false);
  32.  
  33.  
  34. $context = [
  35. 'ssl' => [
  36. 'verify_peer' => false,
  37. 'verify_peer_name' => false,
  38. ],
  39. 'socket' => ['bindto' => 'IP:PORTA']
  40. ];
  41.  
  42.  
  43. $options = array(
  44. 'trace' => true,
  45. 'exceptions' => true,
  46. 'keep_alive' => false,
  47. 'connection_timeout' => 6000,
  48. 'stream_context' => stream_context_create($context)
  49. );
  50.  
  51. //Inicia o envio ao Web Service
  52. $clientSoap = new SoapClient( "http://IP:PORTA/webservice/Operacional.asmx?wsdl", $options);
  53.  
  54. $params = array("
  55. 'viagem' => '".$viagemHandle."',
  56. 'despesa' => '".$despesaHandle."',
  57. 'data' => '".$data."',
  58. 'quantidade' => '".$quantidade."',
  59. 'valorUnitario' => '".$ValorUnitario."',
  60. 'valorTotal' => '".$ValorTotal."',
  61. 'tipo' => '".$tipoHandle."',
  62. 'fornecedor' => '".$fornecedorHandle."',
  63. 'formaPagamento' => '".$FormaPagamentoHandle."',
  64. 'condicaoPagamento' => '".$CondicaoPagamentoHandle."'
  65. 'observacao' => '".$observacao."'
  66. ");
  67.  
  68. $auth = array('Username' => 'lucas.vota', 'Password' => '#lucas');
  69.  
  70. $header = new SoapHeader('http://tempuri.org/', 'Authentication', $auth, false);
  71. $clientSoap->__setSoapHeaders(array($header));
  72.  
  73. //print_r($clientSoap->__getTypes());
  74. //var_dump($clientSoap->__getLastRequest());
  75. //var_dump($clientSoap->__getLastResponse());
  76.  
  77.  
  78. $result = $clientSoap->InserirViagemDespesa($params);
  79.  
  80. print_r($result);
  81.  
  82. $retorno = $result->InserirViagemDespesaResponse;
  83.  
  84. $mensagem = $retorno->mensagem;
  85.  
  86. print_r($mensagem);
  87.  
  88.  
  89. //Recebe o retorno do Web Service
  90. /*if($result){
  91. $retorno = ($clientSoap->__getLastResponse());
  92.  
  93. print_r(var_dump($retorno));
  94. }
  95. else{
  96. echo 'Erro ao comunicar com o Web Service';
  97. }*/
  98. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement