Error: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog while using parseXML() for XMLDocument2()

AirSquire
Tera Guru

Complete Error Log: (sys_id of the script include is removed intentionally and highlighted in bold)

com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [2,18]: org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [2,18]: org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:297)
org.apache.axiom.om.impl.dom.DocumentImpl.getOMDocumentElement(DocumentImpl.java:446)
org.apache.axiom.om.impl.dom.DocumentImpl.getDocumentElement(DocumentImpl.java:458)
com.glide.util.XMLStreamDocument.getDocumentElement(XMLStreamDocument.java:397)
com.glide.util.XMLStreamDocument.isValid(XMLStreamDocument.java:225)
com.glide.util.XMLStreamDocument.parse(XMLStreamDocument.java:211)
com.glide.script.XMLDocument2.jsFunction_parseXML(XMLDocument2.java:49)
sun.reflect.GeneratedMethodAccessor472.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.mozilla.javascript.MemberBox.invoke(MemberBox.java:138)
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:670)
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:614)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2582)
org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
org.mozilla.javascript.gen.sys_script_include_<sys_id_of_script_include>_script_5825._c_anonymous_2(sys_script_include.<sys_id_of_script_include>.script:207)
org.mozilla.javascript.gen.sys_script_include_<sys_id_of_script_include>_script_5825.call(sys_script_include.<sys_id_of_script_include>.script)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:2651)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2590)
org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
org.mozilla.javascript.gen._refname__568._c_script_0(<refname>:12)
org.mozilla.javascript.gen._refname__568.call(<refname>)
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:563)
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3429)
org.mozilla.javascript.gen._refname__568.call(<refname>)
org.mozilla.javascript.gen._refname__568.exec(<refname>)
com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:279)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:118)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:82)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:73)
com.glide.script.Evaluator.evaluateString(Evaluator.java:96)
com.snc.automation.ScriptJob.execute(ScriptJob.java:43)
com.glide.schedule.JobExecutor.lambda$executeJob$0(JobExecutor.java:108)
com.glide.schedule.JobExecutor.executeJob(JobExecutor.java:111)
com.glide.schedule.JobExecutor.execute(JobExecutor.java:95)
com.glide.schedule_v2.SchedulerWorkerThread.executeJob(SchedulerWorkerThread.java:329)
com.glide.schedule_v2.SchedulerWorkerThread.lambda$process$0(SchedulerWorkerThread.java:192)
com.glide.worker.TransactionalWorkerThread.executeInTransaction(TransactionalWorkerThread.java:35)
com.glide.schedule_v2.SchedulerWorkerThread.process(SchedulerWorkerThread.java:192)
com.glide.schedule_v2.SchedulerWorkerThread.run(SchedulerWorkerThread.java:100)

I am getting the above error() everytime I am using parseXML() function of XMLDocument2().

Details:
The table structure is below:
1. Staging Table
2. Main table
3. Related tables(6)

We have created a scripted soap message, which is consumed and a record is created in the Staging Table with the complete request XML(which is nested to several layers) saved in a field of the resulting record.

Now we are running a schedule job to pick records from this table and populate data in main table and the other related tables.

Everytime when I use below piece of code to iterate through the child nodes, where doc is the main node, i am getting the above error for line using parseXML(). 

 var wnodelist = doc.getNode("//Shp");
var witer = wnodelist.getChildNodeIterator();

while (witer.hasNext()) {
var wn = witer.next();
var xmlDoc1 = new XMLDocument2();
xmlDoc1.parseXML(wn);
.
.
.
.
.
}

 

Any help will be appreciated.

Regards
Air

4 REPLIES 4

Omkar Mone
Mega Sage

Hi 

Are you sure you are getting the doc in XML format? Can you check the wsdl file url once ? Check if you are retriving the info from the correct source.

Refer this ans found on stackoverflow as well, 

https://stackoverflow.com/questions/18761597/java-web-service-error-com-ctc-wstx-exc-wstxeofexceptio...

find_real_file.png

 

Hope this helps.

 

Regards,

Omkar Mone

Mine is an inbound web service. And parsing the request XML generated error.

Ashvini Kadus1
Kilo Guru

Hi,

Please refer below link it might get helpful for you:

 

https://community.servicenow.com/community?id=community_question&sys_id=784c4b65db9cdbc01dcaf3231f96...

 

Kindly mark correct or helpful if it helps you to solve your problem.

 

Thank You,

Ashvini k

Not working. The XML is valid and still error logs are generated.