} catch (SoapFault $soapfault) {
         //echo $soapfault->getMessage();
         echo $soapfault->getTraceAsString();
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     // sms: 7/2/2014 Added to support embedded version
 } else {
     if ($action == 'getUserProfileByEmail') {
         header('Content-Type: text/x-json');
         $email = $_POST['email'];
         try {
             $params = array('emailAddress' => $email);
             // print_r($params);
             $client = new SoapClient($wsdl, array('location' => $location));
             $result = $client->getUserProfileByEmail($params);
             echo json_encode($result);
         } catch (SoapFault $soapfault) {
             //echo $soapfault->getMessage();
             echo $soapfault->getTraceAsString();
         } catch (Exception $e) {
             echo $e->getMessage();
         }
     } else {
         if ($action == 'getDevaInsInfo') {
             header('Content-Type: text/x-json');
             if (isset($_POST['requestingUser'])) {
                 $requestingUser = $_POST['requestingUser'];
                 $username = $_POST['username'];
                 $course = $_POST['course'];
                 $resourceType = $_POST['resourceType'];