Hello,
I have an Axis2 1.5.1 (Java) client, auto-generated by wsdl2java with
XmlBeans framework.
I'm integrating with a new vendor that has a SOAP web service written in
.Net. The service is basically a wrapper around a legacy telephony
switch. The service returns 1-9 binary numbers in its response in one of
the XML elements. I have to point out that I our (client) side we do not
even need to use that element at all, it just has some meaningless
data... Apparently our vendor's other clients are all using .Net and the
.Net framework does not care about inserting or parsing illegal
characters in the SOAP Body ...
So, I'm getting an exception (see below).
I tried solving this problem by writing a custom Axis2 client module
where I get access to the XML element that contains illegal characters
and either set it's text value to blank string, or detach and get rid of
the whole XML element altogether (since I don't need it). However, every
time I iterate to the bad XML element - the parser blows up with the
parsing error again inside my custom module. Also, due to the fact that
Axis is using pull parsing method - there is no way to jump over the
element with binary data, so I was not able to copy the entire XML DOM
into a new DOM document skipping over the bad element.
I could not find a way to get low level access to XML stream where I
could, for example, read from an input stream and write to an output
stream, and skip over the illegal character.
Can anyone recommend another solution?
==============================
org.apache.axis2.AxisFault: [com.ctc.wstx.exc.WstxLazyException] Illegal
character entity: expansion character (code 0x8) not a valid XML
character
at [row,col {unknown-source}]: [1,13020]
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at
leadpoint.voice.service.paetec.callrecords.client.ServiceStub.fromOM(Ser
viceStub.java:3315)
at
leadpoint.voice.service.paetec.callrecords.client.ServiceStub.getEnhance
dCDR(ServiceStub.java:1063)
at
leadpoint.voice.service.paetec.callrecords.client.ServiceTest.testgetEnh
ancedCDR(ServiceTest.java:184)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at
com.intellij.junit3.JUnit3IdeaTestRunner.doRun(JUnit3IdeaTestRunner.java
:108)
at
com.intellij.junit3.JUnit3IdeaTestRunner.startRunnerWithArgs(JUnit3IdeaT
estRunner.java:42)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUni
tStarter.java:165)
at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:110)
Caused by: [com.ctc.wstx.exc.WstxLazyException]
com.ctc.wstx.exc.WstxParsingException: Illegal character entity:
expansion character (code 0x8) not a valid XML character
at [row,col {unknown-source}]: [1,13020]
at
com.ctc.wstx.exc.WstxLazyException.throwLazily(WstxLazyException.java:45
)
at com.ctc.wstx.sr.StreamScanner.throwLazyError(StreamScanner.java:704)
at
com.ctc.wstx.sr.BasicStreamReader.safeFinishToken(BasicStreamReader.java
:3657)
at
com.ctc.wstx.sr.BasicStreamReader.getTextCharacters(BasicStreamReader.ja
va:830)
at
javax.xml.stream.util.StreamReaderDelegate.getTextCharacters(StreamReade
rDelegate.java:158)
at
org.apache.axiom.om.impl.builder.SafeXMLStreamReader.getTextCharacters(S
afeXMLStreamReader.java:113)
at
org.apache.axiom.om.impl.llom.OMStAXWrapper.getTextCharacters(OMStAXWrap
per.java:418)
at
org.apache.axiom.om.util.OMXMLStreamReaderValidator.getTextCharacters(OM
XMLStreamReaderValidator.java:239)
at
org.apache.xmlbeans.impl.store.Locale.loadXMLStreamReader(Locale.java:11
54)
at
org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:843)
at
org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:826)
at
org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoa
derBase.java:231)
at
com.paetec.e800ws.xmlservices.GetEnhancedCDRResponseDocument$Factory.par
se(GetEnhancedCDRResponseDocument.java:165)
at
leadpoint.voice.service.paetec.callrecords.client.ServiceStub.fromOM(Ser
viceStub.java:3226)
... 23 more
Caused by: com.ctc.wstx.exc.WstxParsingException: Illegal character
entity: expansion character (code 0x8) not a valid XML character
at [row,col {unknown-source}]: [1,13020]
at
com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:6
05)
at
com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:461)
at
com.ctc.wstx.sr.StreamScanner.reportIllegalChar(StreamScanner.java:2375)
at
com.ctc.wstx.sr.StreamScanner.checkAndExpandChar(StreamScanner.java:2321
)
at
com.ctc.wstx.sr.StreamScanner.resolveSimpleEntity(StreamScanner.java:118
0)
at
com.ctc.wstx.sr.BasicStreamReader.readTextSecondary(BasicStreamReader.ja
va:4675)
at
com.ctc.wstx.sr.BasicStreamReader.readCoalescedText(BasicStreamReader.ja
va:4124)
at
com.ctc.wstx.sr.BasicStreamReader.finishToken(BasicStreamReader.java:369
9)
at
com.ctc.wstx.sr.BasicStreamReader.safeFinishToken(BasicStreamReader.java
:3647)
... 34 more
==============================
Thank you,
Oleg.