Expand my Community achievements bar.

problems handling submitted forms

Avatar

Former Community Member
Hi all,



I'm trying to submit a form to my servlet but i have found some errors. My forms is done by LC Forms using XML + XDP and it has two send buttons. One of them is a HTTP button. If I send my form using this button, I received this error:



17:05:27,373 ERROR [STDERR] com.adobe.livecycle.formsservice.exception.ProcessFormSubmissionException: com.adobe.livecycle.formsservice.exception.FormServerException: Parse error on document: DataSets error: Parse error on document: FSRequest error: Content is not allowed in prolog.

17:05:27,373 ERROR [STDERR] at com.adobe.formServer.FormServer.doProcessFormSubmission(FormServer.java:393)

17:05:27,373 ERROR [STDERR] at com.adobe.formServer.FormServer.processFormSubmission(FormServer.java:419)

17:05:27,373 ERROR [STDERR] at com.adobe.formServer.docservice.FormsDocService.processFormSubmission(FormsDocService.java:693)

17:05:27,373 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

17:05:27,373 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

17:05:27,373 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

17:05:27,373 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)

17:05:27,373 ERROR [STDERR] at com.adobe.idp.dsc.component.impl.DefaultPOJOInvokerImpl.invoke(DefaultPOJOInvokerImpl.java:118)

17:05:27,373 ERROR [STDERR] at com.adobe.idp.dsc.interceptor.impl.InvocationInterceptor.intercept(InvocationInterceptor.java:140)

17:05:27,373 ERROR [STDERR] at com.adobe.idp.dsc.interceptor.impl.RequestInterceptorChainImpl.proceed(RequestInterceptorChainImpl.java:60)

17:05:27,373 ERROR [STDERR] at com.adobe.idp.dsc.transaction.interceptor.TransactionInterceptor$1.doInTransaction(TransactionInterceptor.java:74)

17:05:27,373 ERROR [STDERR] at com.adobe.idp.dsc.transaction.impl.ejb.adapter.EjbTransactionBMTAdapterBean.doRequiresNew(EjbTransactionBMTAdapterBean.java:218)

17:05:27,373 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor340.invoke(Unknown Source)

17:05:27,373 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

17:05:27,373 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)

17:05:27,373 ERROR [STDERR] at org.jboss.invocation.Invocation.performCall(Invocation.java:345)

17:05:27,373 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)

17:05:27,373 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:149)

17:05:27,373 ERROR [STDERR] at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:54)

17:05:27,373 ERROR [STDERR] at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)

17:05:27,373 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:106)

17:05:27,373 ERROR [STDERR] at

...

...
10 Replies

Avatar

Former Community Member
...<br />...17:05:27,389 ERROR [STDERR] at sun.rmi.transport.Transport.serviceCall(Transport.java:149)<br />17:05:27,389 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)<br />17:05:27,389 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)<br />17:05:27,389 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)<br />17:05:27,389 ERROR [STDERR] Caused by: com.adobe.livecycle.formsservice.exception.FormServerException: Parse error on document: DataSets error: Parse error on document: FSRequest error: Content is not allowed in prolog.<br />17:05:27,389 ERROR [STDERR] at com.adobe.formServer.DataSets.<init>(DataSets.java:175)<br />17:05:27,389 ERROR [STDERR] at com.adobe.formServer.FSRequest.getDataSets(FSRequest.java:1081)<br />17:05:27,389 ERROR [STDERR] at com.adobe.formServer.RunTimeContext.commonInit(RunTimeContext.java:370)<br />17:05:27,389 ERROR [STDERR] at com.adobe.formServer.RunTimeContext.<init>(RunTimeContext.java:303)<br />17:05:27,389 ERROR [STDERR] at com.adobe.formServer.FormServer.doProcessFormSubmission(FormServer.java:359)<br />17:05:27,389 ERROR [STDERR] ... 86 more<br /><br />My java code for this HTTP button is<br /><br />//Create a ServiceClientFactory object<br /> ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);<br />//Create a FormsServiceClient object<br /> FormsServiceClient formsClient = new FormsServiceClient(myFactory); <br /> String context = request.getContentType();<br /> //Get Form data to pass to the processFormSubmission method<br /> Document formData = new Document(request.getInputStream()); <br /> <br /> //Set run-time options<br /> RenderOptionsSpec processSpec = new RenderOptionsSpec(); <br /> processSpec.setLocale("en_US");<br /> <br /> //Invoke the processFormSubmission method<br /> FormsResult formOut;<br /> <br /> formOut = formsClient.processFormSubmission(formData,<br /> "CONTENT_TYPE=application/pdf&CONTENT_TYPE=application/vnd.adobe.xdp+xml&CONTENT_TYPE=text/xml",<br /> "",<br /> processSpec);<br /><br />and this error occurs when processFormSubmission is executed.<br /><br />The second button is a button with these javascript code on click event<br /><br /> var sURL = "http://localhost:8080/AdobeForms/receiveForm";<br /> var myDoc = event.target;<br /><br /> var sValors = "datasets,pdf";<br /> var aPaquetes = sValors.split(",");<br /> var sAs = "PDF";<br /><br /> try{<br /> xfa.host.messageBox("starting...");<br /> myDoc.submitForm({<br /> cURL:sURL, <br /> cSubmitAs:sAs,<br /> aPackets:aPaquetes});<br /> xfa.host.messageBox("finish");<br /> }<br /> catch(e){<br /> console.println(e);<br /> }<br /><br />but using this button, my servlet doesn't receive pdf form. <br /><br />Someone can help me? Any idea about these errors? Any tip will be very apreciated. <br /><br />Thanks in advance<br /><br />Daniel

Avatar

Level 10
I'm confused! Do you have all that code on the submit button within you form?



You don't need any code on the HTTP button on the form. The only thing you need to set is the target url of the button (where it submits to) and what it submits (PDF, XDP, XML).



The it'll post that to your servlet.



Am I missing something?



Jasmin

Avatar

Former Community Member
Hi Jasmin



I think I didn't explain it very well. Sorry for that. When I said "java code for this HTTP button" I wanted to say it's the java code in my servlet. it's execute when I click on HTTP button. But I have could resolve this error. I have change this http button for another button with submit event calling to my servlet. Now it's working but i have found a new problem.



I have this form xdp and a data connection with a xml file. When I render it with LC Forms I can see my form right but when I submit the form, I receive only data connection structure but not my xdp structure. I think it can be a design problem with my xdp. Any idea about this problem?



And I still the problem with second button



Thanks for your help Jasmin

Avatar

Level 10
"I receive only data connection structure but not my xdp structure"



When you submit the data, the data will follow the structure of the data connection. That's the purpose of a data connection, so you can do data binding with the fields on your form and have the data follow a certain structure.



If you don't have a data connection setup, then it'll follow the xdp structure.



What is the problem with the second button again?



Jasmin

Avatar

Former Community Member
Ah, ok, I understand it. My structure of the data connection was wrong. Now I receive the new structure with the fields on your form but it's empty. Don't should it send with datas or do I have to do a previous step?



About the second button it has this javascript code on click event



var sURL = "http://localhost:8080/AdobeForms/receiveForm";

var myDoc = event.target;



var sValors = "datasets,pdf";

var aPaquetes = sValors.split(",");

var sAs = "PDF";



try{

xfa.host.messageBox("starting...");

myDoc.submitForm({

cURL:sURL,

cSubmitAs:sAs,

aPackets:aPaquetes});

xfa.host.messageBox("finish");

}

catch(e){

console.println(e);

}



but clicking this button, my servlet doesn't receive the pdf form and I haven't idea about this error



Thanks Jasmin for your help.

Avatar

Former Community Member
I have fix the first error. I received the data structure empty because it didn't bind with my fields. It was a design problem but it's resolve and it works fine :)



Thanks again for your help



Daniel

Avatar

Level 10
For the second problem.



I would remove that script from the button. Make sure it's just a regular button with no script.



Then change the property of the button to be a Submit button and use the UI (submit tab) to change the target URL and the what you want to submit (XDP,XML,PDF).



Let's just use the built in stuff instead and see if that works first.



Jasmin

Avatar

Former Community Member
It works fine with your suggestion. Thank you very much for your help

Avatar

Former Community Member
Hi Jasmin,<br /><br />I have found another problem. I receive the structure with the fields on my form but some of these fields are in a dynamic table. This table has this structure on my xdp<br /><br />Table<br />-Field<br />--province<br />--road<br />--locations<br /><br />and you can add more fields with the same structure<br /><br />The xml file for this structure is<br /><Table><br /> <province></province><br /> <road></road><br /> <location></location><br /></Tabla><br /><br />My problem is with this xml file, if I add some more fields dynamically, I receive only the first file of my table. How could I do if I want to receive all fields and bind them with my xml file? Any idea?<br /><br />Thank you very much for your help<br /><br />Regards<br /><br />Dani

Avatar

Level 10
You should receive all fields in the xml.



Can you write the content to the file system to make sure you only have the one row. Your xPath expression might only give you the first row, but the rows might all be there.



Jasmin