"XMLStreamException: No open start element..." using JaxB
---------------------------------------------------------

                 Key: CXF-908
                 URL: https://issues.apache.org/jira/browse/CXF-908
             Project: CXF
          Issue Type: Bug
         Environment: Application on Jboss-4.2.1.GA, JRockit R27.2.0 jre 
1.5.0_10. 
            Reporter: Grzegorz Oledzki


When writing a service which implements only one method: 
public Set<Address> getAddresses(String par);

we get on the server-side an 
org.codehaus.xfire.fault.XFireFault: Couldn't write message.

caused by:
javax.xml.stream.XMLStreamException: No open start element, when trying to 
write end element

Client failes with the message:
org.codehaus.xfire.fault.XFireFault: Could not unmarshall type : unexpected 
element (uri:"http://schemas.xmlsoap.org/soap/envelope/";, local:"Envelope"). 
Expected elements are [...here comes the list of expected elements]
at org.codehaus.xfire.jaxb2.JaxbType.readObject(JaxbType.java:219) 
[...]

After debugging the XFire under Eclipse I discovered that:

the problem is caused by too many writeEndElement() compared to 
writeStartElement(), 
the error has to been somewhere in the area constrained by these calls:
AegisBindingProvider:220 # writeParameter() creates an ElementWriter with 
constructor NOT writing the start element,
CollectionType # writeObject() is called
ArrayType:279 # writeValue() is called
Since type is JaxbType this line is called: 
cwriter = writer;

Then after writing the object the writer is closed by:

cwriter.close();

which refers to:

ElementWriter:176 # close()

which writes the end-element (but there has been no start element written 
before, so it closes its parent)

My guess is that the ElementWriter#close() implementation should be changed. So 
that the end element is written only if the start element was written before.
Or... If not there, then maybe the ArrayType#writeValue()?



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to