Content is not allowed in prolog

S

Scott Hopkins

I am using Axis in combination with Xerces to connect to a .Net web service.
I get a response correctly but Xerces throws a "Content is not allowed in
prolog" exception when parsing. I believe this is because there is a Byte
Order Mark (BOM) in the response (the ? showing up right before the <?xml
version header). I've seen old messages about a problem with BOMs in UTF-8
files, but have not been able to ascertain if this still a problem. If it
is, is there a work around? Is there another Java parser that will work?


Here's my log from Axis:

8500 [main] DEBUG axis.SOAPPart - Exit: SOAPPart::getAsString(): ?<?xml
version='1.0' encoding='utf-8'?><soap:Envelope
xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<soap:Body>
<wmAirFlifoResponse
xmlns='http://localhost/wsAirServices/wmAirFlifoOut'><OTA_AirFlifoRS><Flight
InfoDetails TotalTripTime="0700"><FlightLegInfo FlightNumber=" 100"
JourneyDuration="07:00"><DepartureAirport LocationCode="JFK">New York-JFK,
NY, US</DepartureAirport><ArrivalAirport LocationCode="LHR"
Diversion="0">London-Heathrow, GB</ArrivalAirport><MarketingAirline
Code="AA">AMERICAN AIRLINES</MarketingAirline><Equipment
AirEquipType="777">BOEING 777-200/300 JET</Equipment><DepartureDateTime
Scheduled="2004-04-16T18:20:00" /><ArrivalDateTime
Scheduled="2004-04-17T06:20:00" /></FlightLegInfo><Comment>JFK LHR - MEMBER
OF ONEWORLD</Comment><Comment>FROM JFK - DEPARTS TERMINAL
8</Comment><Comment>TO LHR - ARRIVES TERMINAL 3</Comment><Comment>JFK LHR -
1/ MOVIE</Comment><Comment>JFK LHR - 2/ TELEPHONE</Comment><Comment>JFK
LHR - 4/ AUDIO PROGRAMMING</Comment><Comment>JFK LHR - 7/ DUTY FREE
SALES</Comment><Comment>JFK LHR - 9/ NON-SMOKING</Comment><Comment>JFK LHR -
12/ IN-SEAT POWER SOURCE
</Comment></FlightInfoDetails></OTA_AirFlifoRS></wmAirFlifoResponse>
</soap:Body></soap:Envelope>
8609 [main] DEBUG i18n.ProjectResourceBundle -
org.apache.axis.i18n.resource::handleGetObject(toAxisFault00)
8609 [main] INFO axis.enterprise - Mapping Exception to AxisFault
AxisFault
faultCode: {http://xml.apache.org/axis/}Server.userException
faultString: org.xml.sax.SAXParseException: Content is not allowed in
prolog.
faultActor: null
faultDetail:
stackTrace: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unkn
own Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
at
org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationCon
textImpl.java:232)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:546)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:377)
at org.apache.axis.client.Call.invokeEngine(Call.java:2132)
at org.apache.axis.client.Call.invoke(Call.java:2102)
at org.apache.axis.client.Call.invoke(Call.java:1851)
at org.apache.axis.client.Call.invoke(Call.java:1777)
at org.apache.axis.client.Call.invoke(Call.java:1315)
at
com.solartiscorp.wsAirServices.WsAirServicesSoapStub.wmAirFlifo(WsAirService
sSoapStub.java:4036)
at com.junit.TestFlifo.testService(TestFlifo.java:88)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
..java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:166)
at junit.framework.TestCase.runBare(TestCase.java:140)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:131)
at junit.framework.TestSuite.runTest(TestSuite.java:173)
at junit.framework.TestSuite.run(TestSuite.java:168)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
nner.java:392)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
java:276)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
..java:167)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top