3 Replies Latest reply on Aug 25, 2008 3:44 AM by dylan vr

    PDFGenerator DSC_CONTEXT

    dylan vr Level 1
      Hi

      I'm trying to run PDFGenerator on websphere 6.1.0.15 with LiveCycle ES 8.2
      when I try and call the service I get this error
      ALC-PDG-001-000-Conversion failed because of an exception.
      No Credential or Context set
      Caused by: ALC-DSC-213-000: com.adobe.idp.dsc.DSCException: No Credential or Context set

      I have credentials but no context, what value should I put for the DSC_CONTEXT
        • 1. Re: PDFGenerator DSC_CONTEXT
          Can you provide the details on how you are calling PDFGenerator? When you say "I have credentials but no context...", can you provide the code snippet you are using?
          • 2. Re: PDFGenerator DSC_CONTEXT
            dylan vr Level 1
            Hi Kent

            Thanks for the reply. Here is a code snippet of the constructer which has the properties and below is the method call. The last property is DSC_CONTEXT property which is were I could use your help. I'm using the createPDF2() method because the documentaion said that the createPDF() method was depricated. Thanks again.

            public GeneratePDF()
            {
            Properties ConnectionProps = new Properties();

            ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "iiop://localhost:2809");

            ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,Service ClientFactoryProperties.DSC_EJB_PROTOCOL);

            ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, ServiceClientFactoryProperties.DSC_WEBSPHERE_SERVER_TYPE);

            ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");

            ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");

            //?????
            ConnectionProps.setProperty(ServiceClientFactoryProperties.DSC_CONTEXT, "");

            }

            /**
            *
            * @param docIn Document to be converted
            * @param fileName Name of file to be converted
            * @return Converted PDF
            * @throws ConversionException
            * @throws InvalidParameterException
            * @throws FileFormatNotSupportedException
            * @throws IOException
            */
            public byte[] generatePDF(byte[] docIn, String fileName) throws ConversionException, InvalidParameterException, FileFormatNotSupportedException, IOException
            {
            ServiceClientFactory factory = ServiceClientFactory.createInstance(connectionProps);
            Document inDoc = new Document(docIn);
            String adobePDFSettings = "Standard";
            String securitySettings = "No Security";
            String fileTypeSettings = "Standard";

            CreatePDFResult result = null;

            result = new GeneratePdfServiceClient(factory).createPDF2(inDoc,fileName, fileTypeSettings, adobePDFSettings,securitySettings, null, null);

            // Get the newly created document

            Document createdDocument = result.getCreatedDocument();


            InputStream createdDocumentStream = createdDocument.getInputStream();
            byte [] createdDocumentAsBytes = new byte[createdDocumentStream.available()];
            createdDocumentStream.read(createdDocumentAsBytes);
            createdDocumentStream.close();

            return createdDocumentAsBytes;
            }
            • 3. Re: PDFGenerator DSC_CONTEXT
              dylan vr Level 1
              Hi

              Fixed the problem myself. Here is the code.
              This creates the credentials and places it in the context.

              AuthenticationManagerServiceClient authClient = new AuthenticationManagerServiceClient(factory);

              // Authenticate the user
              String username = "administrator";
              String password = "password";
              AuthResult authResult = authClient.authenticate(username, password.getBytes());

              Context context = new Context();
              context.initPrincipal(authResult);
              factory.setContext(context);