function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rajbarath GovindanRajbarath Govindan 

retrieve knowledge article page using FrontDoor.jsp In java Code

We would want to extract Salesforce knowledge articles as PDF. We tried using Frontdoor.jsp to login through java code. (as a precursor, to get the session id to pass to frontdoor jsp, we call connector class to get the connection.) Our requirement is to read the html response of the knowledge article page and then save that as PDF. However a desired html response is not obtained which can be converted into PDF. We are g
EnterpriseConnection connection= null;
                  ConnectorConfig config = new ConnectorConfig();
                              + "/services/Soap/c/32.0");
                  try {
                        connection = Connector.newConnection(config);
              "LOGGER::::Enterprise Connection established");
              "LOGGER::::Auth EndPoint: "
                                    + config.getAuthEndpoint());
              "LOGGER::::Service EndPoint: "
                                    + config.getServiceEndpoint());
              "LOGGER::::Username: " + config.getUsername());
                  } catch (ApiFault apiFault) {
                                    "Exception Occured while connecting to Salesforce due to Api Fault",
                        connection = null;
                        throw apiFault;
          "Session id" +connection.getSessionHeader().getSessionId());
      String sUrl=""+connection.getSessionHeader().getSessionId()+"&retURL=/knowledge/articlePrintableView.apexp?id=kA0f00000000JgZ";
      HttpClient httpclient = new HttpClient();
      GetMethod get = null;try{
      get = new GetMethod(sUrl);
      get.addRequestHeader("Content-Type" , "plain/text");
                 "Response code"+get.getStatusCode());
    {"Webpage Not Available. Please Run after some time ");
    }catch(Exception e){
Here is the response we get when it is printed out on console.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"></head><body><script>var tm=null;function lhdoredir(){tm&&(window.clearTimeout(tm),tm=null);window.location.replace?window.location.replace(""):window.location.href=""}window.setTimeout?tm=window.setTimeout(lhdoredir,1E3):lhdoredir();var SFDCSessionVars={"uid":"005i0000003UV8J","exp":1435209016000,"host":"","oid":"00De0000005VPg9","server":"","act":"u"};SFDCSessionVars.callback=lhdoredir;</script><script src="/jslibrary/1427810574000/sfdc/SfdcSessionBase190.js"></script><noscript>You do not have Javascript enabled. Javascript is required to use Please enable Javascript, then click <a href="">here</a> to continue.</noscript></body></html>
If there are any guidance to how to proceed that would really help?
Ross KerrRoss Kerr
If you have the user name and password you can login through the URL,[user name]&pw=[password]&startURL=/knowledge/articlePrintableView.apexp?id=kA0f00000000JgZ.

startURL will need to be URLEncoded.

We have been having the same problem using an auth token with frontdoor.jsp and are using this as a workaround for now.