Advertisement
Guest User

Untitled

a guest
Aug 4th, 2015
2,546
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.79 KB | None | 0 0
  1. <?php
  2.  
  3. $invoiceNumber = "1245678992222";
  4. getOrderStatus($invoiceNumber);
  5.  
  6.  
  7. function getOrderStatus($invoiceNumber)
  8. {
  9.  try
  10.  {
  11.   $soap_client = new SoapClient(null, array(
  12.    "location" => "https://qa1.mypaga.com/paga-webservices/merchantService/",
  13.    "uri" => "http://pagatech.com/merchant/messages",
  14.    "soap_version" => SOAP_1_2,
  15.    "trace" => 1, // enable trace to view what is happening
  16.    "exceptions" => 1, // disable exceptions
  17.    "cache_wsdl" => 0,
  18.    "use" => SOAP_LITERAL
  19.   ));
  20.  
  21.   $params = new SoapVar("<ns1:invoiceNumber>" . $invoiceNumber . "</ns1:invoiceNumber>", XSD_ANYXML);
  22.     $soap_client->__setSoapHeaders(wssecurity_header("EC9DC953-183C-4C55-89F1-FD00ECFF1136", "password1"));
  23.     $out_arr = $soap_client->getTransactionDetailsByInvoiceNumberRequest($params);
  24.     return $out_arr;
  25. }
  26. catch (Exception $e)
  27. {
  28.   echo $e->getMessage();
  29.   return array();
  30. }
  31.  
  32.  
  33. function wssecurity_header($username, $password)
  34. {
  35.         $auth = '<wsse:Security env:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">' . '<wsse:UsernameToken wsu:Id="UsernameToken-1" xmlns:wsu="http
  36. ://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">' . '<wsse:Username>' . $username . '</wsse:Username>' . '<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-
  37. username-token-profile-1.0#PasswordText">' . $password . '</wsse:Password>' . '</wsse:UsernameToken>' . '</wsse:Security>' . '<paga:PagaServiceRequestType xmlns:paga="http://pagatech.com/authentication">Merchant</pa
  38. ga:PagaServiceRequestType>';
  39.  
  40.         $authvalues = new SoapVar($auth, XSD_ANYXML);
  41.         $header = new SoapHeader("http://pagatech.com/merchant/messages", "Security", $authvalues, true);
  42.  
  43.         return $header;
  44. }
  45.  
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement