[
http://jira.codehaus.org/browse/XFIRE-911?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_90191
]
Frédéric Desmoulins commented on XFIRE-911:
-------------------------------------------
Note that the SOAP response is not XML well formed.
Regards,
Fred
> SOAP response of a collection containing JAXB 2.0 annotated objects is not
> serialized
> -------------------------------------------------------------------------------------
>
> Key: XFIRE-911
> URL: http://jira.codehaus.org/browse/XFIRE-911
> Project: XFire
> Issue Type: Bug
> Components: JAX-WS, JAXB 2.0, Spring
> Affects Versions: 1.2.5
> Environment: Java 6 (build 1.6.0-b105)
> jaxws-2.1fcs
> XFire 1.2.5
> Reporter: Frédéric Desmoulins
> Assigned To: Dan Diephouse
> Attachments: xfire-bogue.zip
>
>
> When exposing a service that returns a collection of type T : Collection<T>
> doStuff() the response cannot be serialized by SoapSerializer. Everything
> works as espected with simple java types (i.e Collection of String) but when
> my webmethod returns a Collection of JAXB annotated objects it crashes while
> the response is serialized.
> Example of object:
> {code}
> @XmlType(name = "xFakeObject", namespace = MODEL_NS)
> public class XFakeObject {
> private String value;
> public XFakeObject() {
> }
> public XFakeObject(String string) {
> this.value = string;
> }
> public String getValue() {
> return value;
> }
> }
> {code}
> Example of web service:
> {code}
> @WebService(serviceName = "FakeService", targetNamespace = SERVICE_NS)
> public class FakeService {
> @WebMethod
> public List<XFakeObject> fakeWebMethod() {
> ArrayList<XFakeObject> list = new ArrayList<XFakeObject>();
> list.add(new XFakeObject("My string..."));
> return list;
> }
> }
> {code}
> The WSDL
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions targetNamespace="http://tofino.homelinux.org/services"
> xmlns:ns1="http://model.example.fragbase.com"
> xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding"
> xmlns:tns="http://tofino.homelinux.org/services"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
> <wsdl:types>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> attributeFormDefault="qualified" elementFormDefault="qualified"
> targetNamespace="http://tofino.homelinux.org/services">
> <xsd:element name="fakeWebMethod">
> <xsd:complexType/>
> </xsd:element>
> <xsd:element name="fakeWebMethodResponse">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element maxOccurs="1" minOccurs="1" name="out" nillable="true"
> type="ns1:ArrayOfXFakeObject"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> attributeFormDefault="qualified" elementFormDefault="qualified"
> targetNamespace="http://model.example.fragbase.com">
> <xsd:complexType name="ArrayOfXFakeObject">
> <xsd:sequence>
> <xsd:element maxOccurs="unbounded" minOccurs="0" name="xFakeObject"
> nillable="true" type="ns1:xFakeObject"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://model.example.fragbase.com" version="1.0">
> <xs:complexType name="xFakeObject">
> <xs:sequence/>
> </xs:complexType>
> </xs:schema>
> </wsdl:types>
> <wsdl:message name="fakeWebMethodResponse">
> <wsdl:part name="parameters" element="tns:fakeWebMethodResponse">
> </wsdl:part>
> </wsdl:message>
> <wsdl:message name="fakeWebMethodRequest">
> <wsdl:part name="parameters" element="tns:fakeWebMethod">
> </wsdl:part>
> </wsdl:message>
> <wsdl:portType name="FakeServicePortType">
> <wsdl:operation name="fakeWebMethod">
> <wsdl:input name="fakeWebMethodRequest"
> message="tns:fakeWebMethodRequest">
> </wsdl:input>
> <wsdl:output name="fakeWebMethodResponse"
> message="tns:fakeWebMethodResponse">
> </wsdl:output>
> </wsdl:operation>
> </wsdl:portType>
> <wsdl:binding name="FakeServiceHttpBinding" type="tns:FakeServicePortType">
> <wsdlsoap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
> <wsdl:operation name="fakeWebMethod">
> <wsdlsoap:operation soapAction=""/>
> <wsdl:input name="fakeWebMethodRequest">
> <wsdlsoap:body use="literal"/>
> </wsdl:input>
> <wsdl:output name="fakeWebMethodResponse">
> <wsdlsoap:body use="literal"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> <wsdl:service name="FakeService">
> <wsdl:port name="FakeServiceHttpPort"
> binding="tns:FakeServiceHttpBinding">
> <wsdlsoap:address
> location="http://localhost:8080/Blank4XFoo/services/FakeService"/>
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
> {code}
> The soap response while calling the webmethod
> {code:xml}
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><fakeWebMethodResponse
> xmlns="http://tofino.homelinux.org/services"><out
> xmlns="http://tofino.homelinux.org/services"><soap:Envelope
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Couldn't
> write message.</faultstring></soap:Fault></soap:Body></soap:Envelope>
> {code}
> The stack trace while calling the webmethod
> {code}
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:129) -
> Invoking handler org.codehaus.xfire.service.binding.PostInvocationHandler in
> phase service
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:115) -
> Invoking phase post-invoke
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:129) -
> Invoking handler org.codehaus.xfire.soap.handler.SoapSerializerHandler in
> phase post-invoke
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:115) -
> Invoking phase policy
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:115) -
> Invoking phase user
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:115) -
> Invoking phase transport
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:129) -
> Invoking handler org.codehaus.xfire.soap.handler.SoapActionOutHandler in
> phase transport
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:115) -
> Invoking phase send
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:129) -
> Invoking handler org.codehaus.xfire.handler.OutMessageSender in phase send
> ERROR 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.service.binding.PostInvocationHandler.invoke(PostInvocationHandler.java:40)
> - org.codehaus.xfire.fault.XFireFault: Couldn't write message.
> INFO 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.DefaultFaultHandler.invoke(DefaultFaultHandler.java:39)
> - Fault occurred!
> javax.xml.stream.XMLStreamException: No element was found to write:
> java.lang.ArrayIndexOutOfBoundsException: -1
> at
> com.sun.xml.stream.writers.XMLStreamWriterImpl.writeEndElement(XMLStreamWriterImpl.java:946)
> at
> org.codehaus.xfire.soap.SoapSerializer.writeMessage(SoapSerializer.java:83)
> at
> org.codehaus.xfire.transport.http.HttpChannel.writeWithoutAttachments(HttpChannel.java:56)
> at
> org.codehaus.xfire.transport.http.XFireServletChannel.sendViaServlet(XFireServletChannel.java:87)
> at
> org.codehaus.xfire.transport.http.XFireServletChannel.send(XFireServletChannel.java:44)
> at
> org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
> at
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
> at
> org.codehaus.xfire.service.binding.PostInvocationHandler.invoke(PostInvocationHandler.java:36)
> at
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
> at
> org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java:64)
> at
> org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:38)
> at
> org.codehaus.xfire.transport.http.XFireServletController.invoke(XFireServletController.java:304)
> at
> org.codehaus.xfire.transport.http.XFireServletController.doService(XFireServletController.java:129)
> at
> org.codehaus.xfire.transport.http.XFireServlet.doPost(XFireServlet.java:116)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at
> com.fragbase.example.context.IdentityFilter.doFilter(IdentityFilter.java:42)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
> at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
> at
> com.sun.xml.stream.writers.XMLStreamWriterImpl$ElementStack.pop(XMLStreamWriterImpl.java:1948)
> at
> com.sun.xml.stream.writers.XMLStreamWriterImpl.writeEndElement(XMLStreamWriterImpl.java:921)
> ... 32 more
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.addHandler(HandlerPipeline.java:64)
> - adding handler [EMAIL PROTECTED] to phase post-invoke
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.addHandler(HandlerPipeline.java:64)
> - adding handler [EMAIL PROTECTED] to phase transport
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.addHandler(HandlerPipeline.java:64)
> - adding handler [EMAIL PROTECTED] to phase send
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.addHandler(HandlerPipeline.java:64)
> - adding handler [EMAIL PROTECTED] to phase user
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:115) -
> Invoking phase post-invoke
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:129) -
> Invoking handler org.codehaus.xfire.soap.handler.FaultSoapSerializerHandler
> in phase post-invoke
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:115) -
> Invoking phase policy
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:115) -
> Invoking phase user
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:129) -
> Invoking handler org.codehaus.xfire.handler.CustomFaultHandler in phase user
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:115) -
> Invoking phase transport
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:129) -
> Invoking handler
> org.codehaus.xfire.transport.http.XFireServletController$FaultResponseCodeHandler
> in phase transport
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:115) -
> Invoking phase send
> DEBUG 20:54:24 [http-8080-Processor24]
> org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:129) -
> Invoking handler org.codehaus.xfire.fault.FaultSender in phase send
> {code}
> I attach all the stuff in the zip file.
> Hope this helps,
> Fred
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email