PD4ML v4 Forums PD4ML v3 Archived Forums (Read Only) Troubleshooting PD4ML Lotus Domino 8.5.3 Basic Authentification

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #26703

    Hello

    I cannot find out what is wrong. It seems that Basic Authentication is broken with Domino. I get the following Error

    http://apps04.strong.com.do/Customers/JSD.BS/JSDBS1/DSERequest/Template/DS-EReq-NTF-01.Nsf/0/9BF0B5AA67548CF6042579CB00039C8C?OpenDocument not found.
    java.net.SocketException: socket closed
    at java.net.SocketInputStream.read(SocketInputStream.java:140)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:229)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:269)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:328)
    at sun.net.www.MeteredStream.read(MeteredStream.java:128)
    at org.zefer.cache.e.getResourceAsBytes(Unknown Source)
    at org.zefer.html.doc.PD4MLHtmlParser.parse(Unknown Source)
    at org.zefer.html.doc.PD4MLHtmlParser.buildDocument(Unknown Source)
    at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)
    at org.zefer.pd4ml.PD4ML.render(Unknown Source)
    at org.zefer.pd4ml.PD4ML.render(Unknown Source)
    at PdfAgent.runConverter(Unknown Source)
    at PdfAgent.NotesMain(Unknown Source)
    at lotus.domino.AgentBase.runNotes(Unknown Source)
    at lotus.domino.NotesThread.run(Unknown Source)
    java.lang.NullPointerException
    at org.zefer.pd4ml.PD4ML.o00000(Unknown Source)
    at org.zefer.pd4ml.PD4ML.render(Unknown Source)
    at org.zefer.pd4ml.PD4ML.render(Unknown Source)
    at PdfAgent.runConverter(Unknown Source)
    at PdfAgent.NotesMain(Unknown Source)
    at lotus.domino.AgentBase.runNotes(Unknown Source)
    at lotus.domino.NotesThread.run(Unknown Source)

    Here is the code, of course the Username and password is correct i changed it to publish here. It works with Anonymous Manager but that would be a no go. Any Hints?

    /*
    * ===========================================================================
    * PD4ML: HTML to PDF Converter for Java.
    * DXL-to-PDF converting agent
    *
    * http://pd4ml.com, 2007-2008
    * ===========================================================================
    */

    import java.awt.Dimension;
    import java.awt.Insets;
    import java.io.BufferedInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.io.StringReader;
    import java.net.MalformedURLException;
    import java.net.URL;

    import lotus.domino.*;
    import java.util.HashMap;
    import java.util.Map;
    import org.xml.sax.SAXException;
    import org.zefer.pd4ml.PD4Constants;
    import org.zefer.pd4ml.PD4ML;
    import org.zefer.pd4ml.PD4PageMark;

    public class PdfAgent extends AgentBase {

    private final static String xslName = “dxl4pd4ml.xsl”;

    /* configuration switch: XSL location */
    private final static boolean readXslFromJar = true;

    private final static String xslDocumentFormName = “XSL4PD4ML”;
    private final static String xslDocumentFieldName = “XSLT”;
    protected Dimension format = PD4Constants.A4;

    protected boolean landscapeValue = false;

    protected int topValue = 10;

    protected int leftValue = 10;

    protected int rightValue = 10;

    protected int bottomValue = 10;

    protected String unitsValue = “mm”;

    protected String proxyHost = “”;

    protected int proxyPort = 0;

    protected int userSpaceWidth = 780;

    public void NotesMain() {
    try {
    Session session = getSession();
    AgentContext agentContext = session.getAgentContext();
    Agent agent = agentContext.getCurrentAgent();
    Document doc = agentContext.getCurrentDatabase().getDocumentByID(agent.getParameterDocID());
    Database db = agentContext.getCurrentDatabase();
    Name nam = session.createName(db.getServer());
    Document pDoc = db.getProfileDocument(“ProfileDoc01″,”STRONG”);
    System.out.println(pDoc.getItemValueString(“DBHostName01”));
    System.out.println(“Parameter ID: ” + agent.getParameterDocID());
    doc.replaceItemValue(“form”, “eRequest01_PV”);
    doc.save(true, true);
    System.out.println(“AGENT starts now.”);

    //File fos = new File(“C:\pd4ml.pdf”);
    File pdf = File.createTempFile(“pd4ml”, “.pdf”);
    java.io.FileOutputStream fos = new java.io.FileOutputStream(pdf);

    String sPath = “http://”+pDoc.getItemValueString(“DBHostName01”)+pDoc.getItemValueString(“DBURL”) +”/0/”+ doc.getUniversalID() + “?OpenDocument”;
    System.out.println(sPath);
    runConverter(sPath, pdf);

    RichTextItem obj = (RichTextItem) doc.getFirstItem(“PdfAttachment”);
    if (obj == null) {
    RichTextItem attx = doc.createRichTextItem(“PdfAttachment”);
    attx.embedObject(EmbeddedObject.EMBED_ATTACHMENT, null,
    pdf.getAbsolutePath(), “pdfattachment”);
    fos.flush();
    fos.close();
    } else {
    doc.removeItem(“PdfAttachment”);
    doc.save(true, true);
    RichTextItem attx = doc.createRichTextItem(“PdfAttachment”);
    attx.embedObject(EmbeddedObject.EMBED_ATTACHMENT, null,
    pdf.getAbsolutePath(), “pdfattachment”);
    fos.flush();
    fos.close();
    }
    doc.save(true, true, true);

    doc.replaceItemValue(“form”, “eRequest01”);
    doc.save(true, true);

    System.out.println(“AGENT done.”);

    } catch (Exception e) {
    e.printStackTrace();
    }
    }

    private void runConverter(String urlstring, File output) throws IOException {

    if (urlstring.length() > 0) {

    if (!urlstring.startsWith(“http://”) && !urlstring.startsWith(“file:”)) {

    urlstring = “http://” + urlstring;
    }
    java.io.FileOutputStream fos = new java.io.FileOutputStream(output);
    if ( proxyHost != null && proxyHost.length() != 0 && proxyPort != 0 ) {
    System.getProperties().setProperty(“proxySet”, “true”);
    System.getProperties().setProperty(“proxyHost”, proxyHost);
    System.getProperties().setProperty(“proxyPort”, “” + proxyPort);
    }

    Map m = new HashMap();
    m.put(PD4Constants.PD4ML_BASIC_AUTHENTICATION, “user: :password”);

    PD4ML pd4ml = new PD4ML();
    pd4ml.enableDebugInfo();
    pd4ml.setDynamicParams(m);
    System.out.println(m);
    try {
    pd4ml.setDynamicParams(m);
    pd4ml.setPageSize( landscapeValue ? pd4ml.changePageOrientation( format ): format );
    } catch (Exception e) {
    e.printStackTrace();
    }
    if ( unitsValue.equals(“mm”) ) {
    pd4ml.setPageInsetsMM( new Insets(topValue, leftValue,
    bottomValue, rightValue) );
    } else {
    pd4ml.setPageInsets( new Insets(topValue, leftValue,
    bottomValue, rightValue) );
    }
    pd4ml.setHtmlWidth( userSpaceWidth );
    System.out.println(“beginrender”);
    pd4ml.render( urlstring, fos );
    System.out.println(“endrender”);
    }
    }

    #28929

    It is expected you pass actual login/password with the call:

    [language=java:36ql6k8m]m.put(PD4Constants.PD4ML_BASIC_AUTHENTICATION, “guest:segreto”);[/language:36ql6k8m]

    #28930

    The user:password is actual correct i just changed it to not post the real user and password

    #28931

    Got it working you need to enable SSO for the Domino Web Server

    #28932

    Glad you found a solution!
    And thank you for sharing it with us!

Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘Troubleshooting’ is closed to new topics and replies.