Skip navigation
Currently Being Moderated

extractToXML exception with web services

Apr 9, 2008 2:53 PM

Guys

I´ve got "An unexpected exception was encountered: There is an error in XML document" when execute the "Quick Start: Decoding barcoded form data using the web service API" (http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/ww help/wwhimpl/js/html/wwhelp.htm). Curiously the "Quick Start: Decoding barcoded form data using the Java API" (http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/ww help/wwhimpl/js/html/wwhelp.htm) run succesfull. Of course I am using the same LiveCycle instalation and the same pdf.

The exception is fired into extractToXML method of BarcodedFormsServiceService class. See a some lines of the code:

//Decode form data
XML decodedFormData = barcodedFormsClient.decode(inPDFForm,
true,
false,
false,
false,
false,
false,
false,
false,
CharSet.UTF_8);

//Convert the data to XDP data
object[] convertedData = barcodedFormsClient.extractToXML(decodedFormData,
Delimiter.Tab,
Delimiter.Tab,
XMLFormat.XDP);

Thanks

Marcelo
 
Replies
  • Currently Being Moderated
    Apr 10, 2008 4:20 AM   in reply to (MARCELO_MACIEL)
    Just to confirm, the test image you are trying to decode includes a barcode that has tab delimited data including headers?
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 10, 2008 5:57 AM   in reply to (MARCELO_MACIEL)
    Hi Marcelo, extract to XML is designer to work on tab delimited data that includes field names.

    Your decoded output is pipe delimited and excludes any header information. You will need to delimit the data yourself using xPath or build yourself a simple component.

    Split the value of "content" into different elements and then populate your XML document. You could also use the XSLT component to do this (Java snippet = dataElements = nodesToDelete.split("|"); )
     
    |
    Mark as:
  • Currently Being Moderated
    May 29, 2008 12:07 AM   in reply to (MARCELO_MACIEL)
    Hi Marcelo and Lee ...<br /><br />I used Microsoft Visual Studio .Net to invoke ES server barcoded form decoding service with web service API ... you can see the output as below and I found that the first Tag in output as "<?xml version=\"1.0\"?> without "encoding=UTF-8" ... it is the problem ...  why ???   <br /><br />I also have specified CharSet.UTF-8 in barcodedFormsClient.decode function ... <br /><br />Mason Pai 05-29-2008<br /><br />**** output ***** <br />"<?xml version=\"1.0\"?><br /><xb:scanned_image path=\"tif\" version=\"1.0\" <br />xmlns:xb=\"http://decoder.barcodedforms.adobe.com/xmlbeans\"><br /><xb:decode><br /><xb:date>2008-05-27T10:27:59.854+08:00</xb:date><br /><xb:host_name>pscadobelces</xb:host_name><br /><xb:status type=\"success\"><br /><xb:message/><br /></xb:status><br /></xb:decode><br /><xb:barcode id=\"1\"><br /><xb:header symbology=\"pdf417\"><br /><xb:location page_no=\"1\"><br /><xb:coordinates><br /><xb:point x=\"0.21775147\" y=\"0.24512196\"/><br /><xb:point x=\"0.43353057\" y=\"0.24512196\"/><br /><xb:point x=\"0.43353057\" y=\"0.30731708\"/><br /><xb:point x=\"0.21775147\" y=\"0.30731708\"/><br /></xb:coordinates><br /></xb:location><br /></xb:header><br /><xb:body><br /><xb:content encoding=\"utf-8\">Label\tTextField1\tTextField2\t&#xd;f9f3dcc4-2592- 49d0-<br />a6ec-fcabbac11e2a\t&iuml;&iquest;&frac12;&iuml;&iquest;&frac12;&ium l;&iquest;&frac12;&iuml;&iquest;&frac12;&iuml;&iquest;&frac12;&iuml;&i quest;&frac12;&iuml;&iquest;&frac12;&iuml;&iquest;&frac12;&egrave;&#71 0;&ccedil;&#8249;&iexcl;\t&iuml;&iquest;&frac12;&iuml;&iquest;&frac12; &iuml;&iquest;&frac12;&iuml;&iquest;&frac12;&iuml;&iquest;&frac12;&egr ave;&#710;&egrave;&laquo;&eacute;°&iuml;&iquest;&frac12;<br />\t</xb:content><br /></xb:body><br /></xb:barcode><br /></xb:scanned_image>"
     
    |
    Mark as:
  • Currently Being Moderated
    May 29, 2008 4:21 AM   in reply to (MARCELO_MACIEL)
    It looks like the decode is working well but the form data is not encoded in UTF-8. Do you specify the encoding mechanism in your form?
     
    |
    Mark as:
  • Currently Being Moderated
    May 29, 2008 6:21 AM   in reply to (MARCELO_MACIEL)
    Hi Lee : <br /> <br />Many thanks for your kindly reply ... <br /> <br />I am not clearly sure how to check if I have specified the encoding mechanism correctly in form design ... I would like to say in a detail way that I used LC designer to design a PDF form embedded a 2D Barcode and filled in data fields in Adobe reader then print it as a paper form including 2D Barcode ... Faxed this paper form to fax server and put the fax image into a watch folder ( I also created a decode process in workbench ) , I can see the decode output data is OK ( <?xml version="1.0" encoding="utf-8?"?> and all the UTF-8 Chinese code is OK ) but it will be <?xml version="1.0"?> and UTF-8 Chinese code not OK if I used web service API to decode 2D Barcode ... <br />As to this problem , I think it should not be the form design problem ... and possibly is the web service API usages mistake ... <br /> <br />My .Net program source as : <br /> <br />using System; <br />using System.Collections; <br />using System.ComponentModel; <br />using System.Data; <br />using System.IO; <br />using System.Text; <br />using BarcodedForms.barcoded; <br /> <br />namespace BarcodedForms <br />{ <br /> class Decoder <br /> { <br /> public string execute(String path, String user, String password) <br /> { <br /> try <br /> { <br /> //Create a BarcodedFormsServiceService object and set authentication <br />values <br /> BarcodedFormsServiceService barcodedFormsClient = new <br />BarcodedFormsServiceService(); <br /> barcodedFormsClient.Credentials = new System.Net.NetworkCredential <br />(user, password); <br /> //Reference a PDF form <br /> BLOB inPDFForm = new BLOB(); <br /> <br /> FileStream fsPDF = new FileStream(path, FileMode.Open); <br /> //Get the length of the file stream <br /> int lenPDF = (int)fsPDF.Length; <br /> byte[] bytePDF = new byte[lenPDF]; <br /> <br /> //Populate the byte array with the contents of the FileStream <br /> fsPDF.Read(bytePDF, 0, lenPDF); <br /> inPDFForm.binaryData = bytePDF; <br /> <br /> //Decode form data <br /> <br /> XML decodedFormData = barcodedFormsClient.decode(inPDFForm, <br /> true, <br /> false, <br /> false, <br /> false, <br /> false, <br /> false, <br /> false, <br /> false, <br /> CharSet.UTF_8); <br /> if (decodedFormData != null) <br /> { <br /> Console.WriteLine("A:"+decodedFormData.ToString()); <br /> <br /> return decodedFormData.document; <br /> } <br /> else return null;
     
    |
    Mark as:
  • Currently Being Moderated
    May 30, 2008 4:00 AM   in reply to (MARCELO_MACIEL)
    Hi Lee :

    As to my raised problem about ES server 2D Barcode decoding service called with ES web service API by .Net C# .... we guessed it maybe Jboss running something wrong ( Jboss be started by windows service ), we try to stop Jboss and restart by CMD command : run -c all ... fortunately !! everything work well ...

    Thanks a lot ...

    I would like to request "Adobe LC barcode form best practice" online tutorial presentation materials from you ... I think it should be helpful for me to conduct a internal PDF 2D Barcode form in my office ...

    Best Regards ...

    Mason Pai 05-30-2008
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)