UnMarshaling JAXB肥皂CD数据

时间:2014-12-23 23:36:32

标签: java xml soap utf-8 jaxb

我正在尝试解组具有CD数据的SOAP XML,但我得到的Exception如下所示。

JAXBContext jc = JAXBContext.newInstance(Itemse.class);

XMLInputFactory xif = XMLInputFactory.newInstance();
StreamSource xml = new StreamSource(new FileInputStream("//usr//local//Simulator//test.xml"));
XMLStreamReader xsr = xif.createXMLStreamReader(xml);
xsr.nextTag();
while (!xsr.getLocalName().equals("Item")) {
    xsr.nextTag();
}    


Unmarshaller unmarshaller = jc.createUnmarshaller();
JAXBElement<GetSingleItemResponseType> jb = unmarshaller.unmarshal(xsr, GetSingleItemResponseType.class);
xsr.close();

System.out.println(jb.getValue().getItem().getPostalCode());

GetSingleItemResponseType ref = jb.getValue();

System.out.println(ref.getItem().getLocation());

例外:

Exception in thread "main" javax.xml.bind.UnmarshalException
 - with linked exception:
[com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 middle byte 0x73 (at char #7669, byte #3999)]
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:432)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:368)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:345)
    at ariba.spotbuy.ebayadaptor.simulator.JaxbTestItemDetails.main(JaxbTestItemDetails.java:46)
Caused by: com.ctc.wstx.exc.WstxIOException: Invalid UTF-8 middle byte 0x73 (at char #7669, byte #3999)
    at com.ctc.wstx.sr.StreamScanner.constructFromIOE(StreamScanner.java:625)
    at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:997)
    at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:1036)
    at com.ctc.wstx.sr.StreamScanner.getNextChar(StreamScanner.java:785)
    at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2670)
    at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1072)
    at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:197)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:366)
    ... 2 more
Caused by: java.io.CharConversionException: Invalid UTF-8 middle byte 0x73 (at char #7669, byte #3999)
    at com.ctc.wstx.io.UTF8Reader.reportInvalidOther(UTF8Reader.java:314)
    at com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:205)
    at com.ctc.wstx.io.ReaderSource.readInto(ReaderSource.java:87)
    at com.ctc.wstx.io.BranchingReaderSource.readInto(BranchingReaderSource.java:57)
    at com.ctc.wstx.sr.StreamScanner.loadMore(StreamScanner.java:991)
    ... 8 more

0 个答案:

没有答案