whole_func_string: function(options, params) {
  
              // Create connection to qps
              var qpsApi = qps(options);
  
              // Returned object
              var task = new Task();
  
              // Ticket flow
              Rx.Observable
                  .from(qpsApi.ticket.post(params)) 
                  .catch((err) => {
                      if (err.match(/^Specified targetId .* was unknown$/)) {
                          
                          // if there was a problem with the target Id, try to generate another ticket by reseting target Id
                          task.running('warning', `Wrong targetId: '${params.TargetId}', generating a ticket to default location`);
                          delete params.TargetId;
  
                          return Rx.Observable.from(module.exports.getTicket(options, params));
                      } else {
                          return Rx.Observable.throw(new Error(err));
                      }
                  })
                  .subscribe(task);
                  
              if (returnObservable) {
                  return task;
              } else {
                  return task.toPromise(extPromise);
              }
          }
func_code_string: function(options, params) {
  
              // Create connection to qps
              var qpsApi = qps(options);
  
              // Returned object
              var task = new Task();
  
              // Ticket flow
              Rx.Observable
                  .from(qpsApi.ticket.post(params)) 
                  .catch((err) => {
                      if (err.match(/^Specified targetId .* was unknown$/)) {
                          
                          // if there was a problem with the target Id, try to generate another ticket by reseting target Id
                          task.running('warning', `Wrong targetId: '${params.TargetId}', generating a ticket to default location`);
                          delete params.TargetId;
  
                          return Rx.Observable.from(module.exports.getTicket(options, params));
                      } else {
                          return Rx.Observable.throw(new Error(err));
                      }
                  })
                  .subscribe(task);
                  
              if (returnObservable) {
                  return task;
              } else {
                  return task.toPromise(extPromise);
              }
          }
func_documentation_string: Generates a ticket on Qlik Sense QRS Api. If the targetId is not correct
  then the ticket will redirect to the hub
  
  @example
  ```javascript
  utils.getTicket({
  restUri: 'https://10.76.224.72',
  pfx: pfx,
  passPhrase: ''
  },
  {
  UserId: 'qlikservice',
  UserDirectory: '2008R2-0',
  Attributes: []
  }
  }).then(function(retVal) {
  console.log(retVal);
  });
  ```
  
  @memberOf Qlik
  
  @param {options}             options     Qlik Sense connection options
  @param {ticketParams}        params      the ticket parameters
  @returns {Task.<ticket>}                 a Task resolving to the generated ticket