0 Replies Latest reply: Apr 15, 2013 9:54 PM by ksaavedra RSS

    WebTicket - DMS  Failed open document.

      Hi all.... I recently installed QV11.2 in 3 machines. Machine1 QVS, machine2 QVP and machine3 QVWS IIS7.5...... I tried to use QMS API... to open a document, but I have a problem using webTickets.... with DMS

       

      Apparently I get the webticket... but when the document is opened I get two errors message:

       

      ***When I try to open with QvAjaxZfc: "You do not have permission to view this directory or page"

      url: http://tcaWeb/qvajaxzfc/authenticate.aspx?type=html&try=tcaWeb/qvajaxzfc/opendoc.htm?document=pr.qvw&webticket=HFO+b8ZTGg8X0K1SuHmOJnztub6y3PxXneijFzI/

       

      ***when i try to open with QvPlugin: "Failed to open document, You don't have access to this document"

      url: http://tcaWeb/QvPlugin/opendoc.htm?document=pr.qvw&webticket=HFO+b8ZTGg8X0K1SuHmOJnztub6y3PxXneijFzI/

       

      I have my IIS server with anonymous auth , the default web site with anonymus auth, also the app QvAjaxZfc with anonymous auth, and the webticket.aspx with windows auth ....

       

      I think my C # code gets the webticket in a wrong way. Because when I concatenate it with a url I get that errors.

      1. QVSàtcaQvs
      2. QVPàtcaQvp
      3. QVWSàtcaWeb
      4. p.s. when I configure the document with "All users" permission, QvPlugin opens the document correctly, but this isn't that I want.

       

       

      public static string getTicket(string User)
              {
                  string usergroups=@"";
                  string QlikViewServerURL = "http://tcaWeb/QVAJAXZFC/GetWebTicket.aspx";
                  StringBuilder groups = new StringBuilder();
                  if (!string.IsNullOrEmpty(usergroups))
                  {
       groups.Append("<GroupList>");
       foreach (string group in usergroups.Split(new char[] { ',' }))
       {
       groups.Append("<string>");
       groups.Append(group);
       groups.Append("</string>");
       }
       groups.Append("</GroupList>");
       groups.Append("<GroupsIsNames>");
       groups.Append("true");
       groups.Append("</GroupsIsNames>");
                  }
                  string webTicketXml = string.Format("<Global method='GetWebTicket'><UserId>{0}</UserId></Global>", User);
      
                  HttpWebRequest client = (HttpWebRequest)WebRequest.Create(new Uri(QlikViewServerURL));
                  string uri = client.RequestUri.ToString();
       client.PreAuthenticate = true;
       client.Method = "POST";
       client.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
      
      
                  NetworkCredential myCred = new NetworkCredential("user", "pwd", "domain");
                  CredentialCache myCache = new CredentialCache();
      
       myCache.Add(new Uri(uri), "NTLM", myCred);
       client.Credentials = myCache;
      
                  var writer = new StreamWriter(client.GetRequestStream());
       writer.Write(webTicketXml);
       writer.Flush();
                  var reader = new StreamReader(client.GetResponse().GetResponseStream());
                  var xmlDocument = new XmlDocument();
       xmlDocument.LoadXml(reader.ReadToEnd());
                  return xmlDocument.InnerText;
       }