Problem viewing the image file from the web portal after submitting a fax through JobSubmitService

Hi @mparvathi_2021,


I have an issue with the image file that I'm sending through JobSubmitService API. I can confirm on my side that the file is existing in the my directory and I think I set the path correctly in the code but when I view it from the web portal, all I see is the cover page and a blank page with an "x" mark. Please see downloaded file below:

Please see the part of the code that attaches the file below:

List attachedFiles = PluginUtil.getOriginalFilePaths(target);
		    DocDataType data2 =
	          new DocDataType();
	      data2.setFormat(DocEncodingFormat.text);
	      data2.set_value(notes);
	      DocumentType doc2 =
	          new DocumentType();
	      doc2.setDocType(DOCTYPE_TEXT);
	      doc2.setDocData(data2);
	      doc2.setRef("test");
	       
	      ContentPartType part =
		    		new ContentPartType();
	      part.setDocument(doc2);
	      part.setTreatment(TreatmentType.body);
		     
				int count = 0;
				ContentPartType[] partArr = new ContentPartType[attachedFiles.size()+1];
		    partArr[count] = part;
		     
		    for (int i = count; i < attachedFiles.size(); i++) {
			    count++;
					doc.setFilename(new EncodableStringType());
					System.out.println("attachedFiles.get(i).toString():::::::::::::::::::: "+attachedFiles.get(i).toString());
			     
				  doc.getFilename().set_value(attachedFiles.get(i).toString());
				  part = new ContentPartType();
				  part.setDocument(doc);
				  part.setTreatment(TreatmentType.attachment);
				     
				  partArr[count] = part;
				     
				}

     

The code works with no errors and the status code returned is 0.

Can you check what I've done wrong or is there a similar issue that's discussed here in this forum?

Please let me know

Answers

  • Please share us the Job Number

    Prabhakaran R
    OpenText

  • @Prabhakr_2018 thanks for your reply.

    Below are 2 of the recent job IDs that was tested recently.

    1929709621

    1929710750

    Its also found in the filename attached in my previous comment.

  • Prabhakr_2018
    edited June 29, 2021 #4
    <DocType>JPEG</DocType>
    <Filename>F:/R3/Platform/TikalPlatform/data/scan/ds/DataStore/JobData/scan_queue/acfddbf1-93ad-45a9-a857-2a6c3a96383c/0001.tif</Filename>
    <DocData format="base64">/9j/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQk4fD3wCv8O1k9QRlbUSshija6RjS5rLBrRmJyl1nBJLGNkkkksYSSSSxhJJJLGEkkksYSSSSxhJJJLGEkkksYSSSSxj//2Q==</DocData>
    

    I could see tif image is passed for jpeg type which is wrong

    Please attach a valid jpg file and test once.

    Prabhakaran R
    OpenText

  • angief
    edited June 25, 2021 #5

    Does it only support JPEG? I tried setting the doc type to TIFF but it throws parse error. What are other image formats that it can support aside from JPEG?

    Btw, I have tested JPEG before and it works. I also just tested it now by attaching a jpeg file but I encountered the XOA Service Error again when I try to view it. Please see attached.


  • Prabhakr_2018
    edited June 25, 2021 #6

    If we are trying to view the Job which are in Completed*(Means the job has some issue) Please check the status in portal dashboard. . It will fail with Xoa Service Error.

    Try to view the Job which has status as completed. It will give the proper result. JPG, PNG, TIFF,GIF are supported when you configure the same for your profile. Please contact solution consultant for the same.

    Prabhakaran R
    OpenText

  • After configuring your profile. Modify the code as per the below samples.


    Please Note: DOCDATA AND DOCTYPE has to match and the base64 string should be valid one(Check using online tools to see whether you get the proper image). Single letter change in base64 will result in invalid image.

    Prabhakaran R
    OpenText

  • angief
    edited June 28, 2021 #8

    Thanks for all your help.

    I have followed your instruction and made sure that I have the correct base64 with a jpeg format.

    However, the status all returned with an asterisk (Completed*) even if I revert all the changes to the code that used to work before.

    Can you please help me check what's wrong with the jobs below with the latest job ids?

    1930693740

    1930693325

    I'm not sure how/where to check the request xml or save the xml but in the code, i reviewed my request values and it seems to look good.

    Can you confirm or was there something changed in the profile?

    Below is the latest portion of the code that I used for the document:

    		    // Document(s)
    		    DocDataType data =
    		    		new DocDataType();
    		    data.setFormat(DocEncodingFormat.text);
    		    data.set_value(notes);
    	      DocumentType doc =
    		    		new DocumentType();
    		         
    	      doc.setDocType(DOCTYPE_TEXT);
    	      doc.setDocData(data);
    	      doc.setRef("test");
    	       
    	      /***** Attach files ********/
    		    List attachedFiles = PluginUtil.getOriginalFilePaths(target);
    		    String fileNameRule = (String) paramWrap.getParamAsObj(PluginConstants.FILE_NAME);
    
    	      ContentPartType part =
    		    		new ContentPartType();
    	      part.setDocument(doc);
    	      part.setTreatment(TreatmentType.body);
    		     
    				int count = 0;
    				ContentPartType[] partArr = new ContentPartType[attachedFiles.size()+1];
    		    partArr[count] = part;
    		     
    		    for (int i = count; i < attachedFiles.size(); i++) {
    			    count++;
    					DocDataType data2 =
    		          new DocDataType();
    			     
    		      data2.setFormat(DocEncodingFormat.base64);
    			    String base64String = PluginUtil.encodeFileToBase64Binary(new File("C:\\Users\\Administrator\\Desktop\\grand1.jpeg"));
    			    System.out.println("base64String::: "+base64String);
    			    data2.set_value(base64String);
    			    DocumentType doc2 =
    		          new DocumentType();
    //			    if (nameRule.endsWith(".jpg") || nameRule.endsWith(".jpeg"))
    			    	doc2.setDocType(DOCTYPE_JPEG);
    			    doc2.setDocData(data2);
    			    doc2.setRef("test");
    		       
    			    doc2.setFilename(new EncodableStringType());
    //					System.out.println("attachedFiles.get(i).toString(): "+attachedFiles.get(i).toString());
    				  doc2.getFilename().set_value("grand1.jpeg");
    //				  doc2.getFilename().set_value(nameRule);
    				  part = new ContentPartType();
    				  part.setDocument(doc2);
    				  part.setTreatment(TreatmentType.attachment);
    				     
    				  partArr[count] = part;
    				     
    				}
    


  • Prabhakr_2018
    edited June 29, 2021 #9

    As said earlier in https://forums.opentext.com/forums/developer/discussion/307810/xoa-service-error-encountered-when-viewing-the-document-sent-through-fax

    Here, docdata is sending empty content as highlighted.

     <Part>
    <Document ref="test">
    <DocType>text</DocType>
    <DocData format="text"/>
    </Document>
    <Treatment>body</Treatment>
    </Part>
    

    what is the value of  "notes" that is being set here data.set_value(notes); ?


    Base64decode of the image now looks correct. Please try submitting a new job and let me know if you face any issues

    Prabhakaran R
    OpenText