This part of the stack trace:
Caused by: javax.ws.rs.WebApplicationException at
org.apache.cxf.jaxrs.client.AbstractClient.reportNoMessageHandler(AbstractClient.java:487)
looks like there's no message body writer. I've run into this kind of
problem when trying to return Collections, even collections of JAXB
elements, from JAX-RS endpoints. I usually solve it by wrapping the list in
a root class, and passing the wrapper rather than the Collection, like this:
@XmlRootElement(name="deviceList")
public class DeviceList {
@XmlElement
protected List<Device> devices;
}
Perhaps this might help in your case too, switching from
addDevice(List<Device> device) to addDevice(DeviceList deviceList).
Josh
On Tue, Oct 5, 2010 at 8:00 PM, oceanz <[email protected]> wrote:
>
> I changed it to:
> @Path("user/site/plant/device/addDevice1")
> @POST
> @Produces("text/xml")
> @Consumes("multipart/form-data;type=text/xml")
> Device addDevice(List<Device> device);
>
> But it still doesn't work.
> Same exception:Caused by: javax.ws.rs.WebApplicationException
> at
>
> org.apache.cxf.jaxrs.client.AbstractClient.reportNoMessageHandler(AbstractClient.java:487)
> at
>
> org.apache.cxf.jaxrs.client.AbstractClient.writeBody(AbstractClient.java:401)
> at
>
> org.apache.cxf.jaxrs.client.ClientProxyImpl$BodyWriter.handleMessage(ClientProxyImpl.java:514)
> ... 5 more
>
> Device is a JAXB Bean.:
> @Entity(name="device")
> @XmlRootElement(name="device")
> @XmlAccessorType(XmlAccessType.FIELD)
> public class Device extends DomainEntity {
>
> /**
> *
> */
> private static final long serialVersionUID = 1L;
>
> public Device() {}
>
>
> @XmlAttribute(name="deviceName")
> private String deviceName;
>
> @XmlAttribute(name="deviceType")
> private String deviceType;
>
> @XmlAttribute(name="modelNumber")
> private String modelNumber;
>
> @XmlAttribute(name="serialNumber")
> private String serialNumber;
> ..........
> }
>
> Who do I need to do next? Desparate to get this working.
> Thanks for all your help.
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Help-required-with-apache-cxf-multiparts-tp3199975p3200103.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>