eclipse-ee4j / jaxb-fi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

StAXParser has issue with attrubutes encoded using built-in algorithms

Tomas-Kraus opened this issue · comments

The problem I'm seeing is that the response I get from Noemax calling echoStruct() operation is
differently decoded using DOMDocumentParser vs StAXDocumentParser (the former being correct).
Attached to this email you find the response. Here is the code that should verify my analysis (sorry for
the ugly code):

private void unmarshallDOM() throws Exception

{ InputStream is = new FileInputStream("/home/alessio/Desktop/echoStructResponse.out"); InputStream ins = new BufferedInputStream(is); DOMDocumentParser parser = new DOMDocumentParser(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document resDoc = builder.newDocument(); parser.parse(resDoc, ins); DOM2Writer wr = new DOM2Writer(); System.out.println("DOM***** -> "+wr.nodeToString(resDoc.getDocumentElement())); }

private void unmarshallStAX() throws Exception

{ InputStream is = new FileInputStream("/home/alessio/Desktop/echoStructResponse.out"); InputStream in = new BufferedInputStream(is); XMLStreamReader staxReader = new StAXDocumentParser(in); W3CDOMStreamWriter writer = new W3CDOMStreamWriter(); StaxUtils.copy(staxReader, writer); in.close(); DOM2Writer wr = new DOM2Writer(); System.out.println("StAX****-> "+wr.nodeToString(writer.getDocument().getDocumentElement())); }

you'll get what follows:

DOM***** -> <s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing"
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><a:Action
s:mustUnderstand="1">http://www.noemax.com/wcf/benchmark/IBenchmarkService/EchoStructRespo
nse</a:Action><a:RelatesTo>urn:uuid:42b92303-de3d-451f-bcd1-
b04b52736b80</a:RelatesTo></s:Header><s:Body>d10:DataStructd10:DateTimeField2009-12-
25T11:14:32</d10:DateTimeField>d10:FloatField55.5</d10:FloatField>d10:IntField55</d10:In
tField><d10:StringField
i:nil="true"/></d10:DataStruct></s:Body></s:Envelope>

StAX****-> <s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing"
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><a:Action
s:mustUnderstand="1">http://www.noemax.com/wcf/benchmark/IBenchmarkService/EchoStructRespo
nse</a:Action><a:RelatesTo>urn:uuid:42b92303-de3d-451f-bcd1-
b04b52736b80</a:RelatesTo></s:Header><s:Body>d10:DataStructd10:DateTimeField2009-12-
25T11:14:32</d10:DateTimeField>d10:FloatField55.5</d10:FloatField>d10:IntField55</d10:In
tField><d10:StringField
i:nil=""/></d10:DataStruct></s:Body></s:Envelope>

As you can see the latter has a <d10:StringField i:nil=""/> which I think is the reason for the exception
I get using JBossWS-CXF:

javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: null
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145)
at $Proxy41.echoStruct(Unknown Source)
at org.jboss.test.ws.fastinfoset.NoemaxClient.echoStruct(NoemaxClient.java:124)
at org.jboss.test.ws.fastinfoset.NoemaxClient.run(NoemaxClient.java:96)
at org.jboss.test.ws.fastinfoset.NoemaxClient.main(NoemaxClient.java:182)
Caused by: org.apache.cxf.interceptor.Fault: Unmarshalling Error: null
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:629)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:527)
at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:108)
at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:102)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:641)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPCond
uit.java:2108)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:
1987)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1912)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:611)
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage
(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:469)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
... 4 more
Caused by: java.lang.NullPointerException
at com.sun.xml.bind.DatatypeConverterImpl._parseBoolean(DatatypeConverterImpl.java:258)
at com.sun.xml.bind.v2.runtime.unmarshaller.XsiNilLoader.selectLoader(XsiNilLoader.java:66)
at com.sun.xml.bind.v2.runtime.unmarshaller.ProxyLoader.startElement(ProxyLoader.java:53)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$IntercepterLoader.startElement(ElementBeanInfoIm
pl.java:231)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.
java:455)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.j
ava:433)
at
com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:7
1)
at
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConn
ector.java:275)
at
com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:20
9)
at
com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:339)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:607)
... 21 more

Environment

Operating System: All
Platform: Macintosh

Affected Versions

[current]

@glassfishrobot Commented
Reported by oleksiys

@glassfishrobot Commented
oleksiys said:
fixed

Tag: FastInfoset-1_2-branch
User: oleksiys
Date: 2009-04-24 11:34:48+0000
Modified:
fi/FastInfoset/src/com/sun/xml/fastinfoset/sax/AttributesHolder.java
fi/FastInfoset/src/com/sun/xml/fastinfoset/stax/StAXDocumentParser.java

Log:
fix issue #22

@glassfishrobot Commented
oleksiys said:
change target milestone

@glassfishrobot Commented
Was assigned to oleksiys

@glassfishrobot Commented
This issue was imported from java.net JIRA FI-22

@glassfishrobot Commented
Marked as fixed on Thursday, April 23rd 2009, 9:38:21 pm