incremented patch version 9
[openemr.git] / interface / jump_to_RelayHealth.php
blob51747e46997c4c5128d2ec6409e74c1d8d18e292
1 <?php
2 // Copyright (C) 2008 Phyaura, LLC <info@phyaura.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 include_once('globals.php');
10 include_once('../library/auth.inc');
11 include_once('../library/relayhealth.inc.php');
13 // verify globals are set
14 if ($GLOBALS['ssi']['rh']['ApplicationName']
15 && $GLOBALS['ssi']['rh']['ApplicationPassword']
16 && $GLOBALS['ssi']['rh']['PartnerName']
17 && $GLOBALS['ssi']['rh']['wsdl']) {
19 // verify user has a login set in user admin
20 $result = sqlQuery("select ssi_relayhealth from users where id={$_SESSION['authUserID']}");
21 $trimmed = trim($result['ssi_relayhealth']);
22 if (empty($trimmed)) {
23 xl('Relay Health credentials are missing from this user account.', 'e');
24 die;
27 // make soap call to RH
28 //$client = new SoapClient($GLOBALS['ssi']['rh']['wsdl'], array($classmap));
29 $client = new SoapClient($GLOBALS['ssi']['rh']['wsdl'], array(
30 'classmap' => $classmap,
31 'trace' => 1
32 ));
34 $rh = new RelayHealthHeader();
35 $rh->PartnerName = $GLOBALS['ssi']['rh']['PartnerName'];
36 $rh->ApplicationName = $GLOBALS['ssi']['rh']['ApplicationName'];
37 $rh->ApplicationPassword = $GLOBALS['ssi']['rh']['ApplicationPassword'];
38 $header = new SoapHeader("http://api.relayhealth.com/7.3/SSI", 'RelayHealthHeader', $rh, 1);
40 $vw = new ViewWelcome();
41 $vw->partnerUserId = $result['ssi_relayhealth'];
42 $params = new SoapVar($vw, SOAP_ENC_OBJECT, "ViewWelcome", "http://api.relayhealth.com/7.3/SSI");
44 try {
45 $token = $client->__soapCall("ViewWelcome",
46 array('partnerUserId' => $vw),
47 array(
48 'location' => $GLOBALS['ssi']['rh']['location'],
49 'uri' => 'http://api.relayhealth.com/7.3/SSI'
51 array($header));
52 } catch (Exception $e) {
53 echo "<pre>error $e\n";
55 header("Location: ". $token->Url);