8 Replies Latest reply: May 30, 2008 4:00 AM by (Mason_Pai) RSS

    extractToXML exception with web services

      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/wwhelp/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/wwhelp/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
        • 1. Re: extractToXML exception with web services
          Just to confirm, the test image you are trying to decode includes a barcode that has tab delimited data including headers?
          • 2. Re: extractToXML exception with web services
            Community Member
            Yes Lee... as you see above this is the content of decodedFormData variable. After that the method extractToXML throws an exeception and the same Java methods doesn´t thrown.<br /><br /><?xml version="1.0" encoding="UTF-8" ?> <br />- <xb:scanned_image xmlns:xb="http://decoder.barcodedforms.adobe.com/xmlbeans" path="tif" version="1.0"><br />- <xb:decode><br />  <xb:date>2008-04-09T19:33:04.998-03:00</xb:date> <br />  <xb:host_name>lacbra001sun401</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.025641026" y="0.32317072" /> <br />  <xb:point x="0.34990138" y="0.32317072" /> <br />  <xb:point x="0.34990138" y="0.41585365" /> <br />  <xb:point x="0.025641026" y="0.41585365" /> <br />  </xb:coordinates><br />  </xb:location><br />  </xb:header><br />- <xb:body><br />  <xb:content encoding="utf-8">2008-04-07|02998154000140|2008-04-09|1|PEDRO HENRIQUE|PAULO HENRIQUE|XXXXXXXX VANDA R R SANTIAGO|26065054844|BANCO REAL|375|0416|3711816|MAMAE|0|1|66.99 banco real|375|0416|3711816|1|1500</xb:content> <br />  </xb:body><br />  </xb:barcode><br />  </xb:scanned_image><br /><br />Regards<br /><br />Marcelo
            • 3. Re: extractToXML exception with web services
              Community Member
              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("|"); )
              • 4. Re: extractToXML exception with web services
                Community Member
                OK Lee, the "solution" posted by you I've already know. The main question is why the Java sample with EJB works and the C# sample with Web Service doesn't work ? Both program languages have the same structure and only extractToXML method fires the exception.
                By the way "Quick Start: Decoding barcoded form data using the web service API" (http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/wwhelp/wwhimpl/js/html /wwhelp.htm) has a little bug. When you see String decodedFormData = barcodedFormsClient.decode(inPDFForm,... should be XML decodedFormData = barcodedFormsClient.decode(inPDFForm,

                Regards

                Marcelo
                • 5. Re: extractToXML exception with web services
                  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;&iuml;&iquest;&frac12;&i uml;&iquest;&frac12;&iuml;&iquest;&frac12;&iuml;&iquest;&frac12;&iuml;&iquest;&frac12;&ium l;&iquest;&frac12;&egrave;&#710;&ccedil;&#8249;&iexcl;\t&iuml;&iquest;&frac12;&iuml;&iques t;&frac12;&iuml;&iquest;&frac12;&iuml;&iquest;&frac12;&iuml;&iquest;&frac12;&egrave;&#710; &egrave;&laquo;&eacute;°&iuml;&iquest;&frac12;<br />\t</xb:content><br /></xb:body><br /></xb:barcode><br /></xb:scanned_image>"
                  • 6. Re: extractToXML exception with web services
                    Community Member
                    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?
                    • 7. Re: extractToXML exception with web services
                      Community Member
                      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;
                      • 8. Re: extractToXML exception with web services
                        Community Member
                        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