} 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 == 'getUserProfileByUsername') {
         header('Content-Type: text/x-json');
         $username = $_POST['username'];
         try {
             $params = array('userName' => $username);
             // print_r($params);
             $client = new SoapClient($wsdl, array('location' => $location));
             $result = $client->getUserProfileByUsername($params);
             echo json_encode($result);
         } 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);