Search code examples
soapweb-servicesreturn-type

How can I send ArrayList over Web Service?


Subject is my real question but i wonder that another issue about web services.

What is the key points of web services to return something?

  1. Serializable (Because everything converts to XML before adding them to SOAP Message)
  2. ? (What should i do for generic class)
  3. ?? (How can i put everything (which are serializable classes) to one return type like Object type)
  4. ??? (How can i pass exceptions over Web Services?)

alt text http://docs.sun.com/source/819-3669/images/saaj-noAttach.gif alt text
(source: dret.net)

alt text


Solution

  • You will have to return complex type messages to return ArrayList.

    To do this, you will have to define this message in your WSDL file.

    Check http://fusesource.com/docs/framework/2.2/wsdl/WSDLDefiningArrays.html

    Similarly, you will have to return SOAP Fault messages, in case of exception.