I'm not sure what there is to fix.
If you look at the Struts src.. all ActionForms implement Serializable.
That's why I said that there might be an issue with your SOAP config.
-Tim

-----Original Message-----
From: António Santos [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 10, 2003 4:53 PM
To: [EMAIL PROTECTED]
Subject: RE: Serializing ActionForm (Urgent)



Hi Andrew and Gin,

Thanks for your help. I will try to use intermediate DTOs (simple Javabeans)
and hope that AXIS serialize them well (I'm afraid about FormFile). However,
and since ActionForms comply to the JavaBean specification, I was wondering
if
it would be a good idea to have this serialization problem fixed. I don't
think that it's that handy to have ActionForms to hold the data entered in a
HTML form and then having to copy the data to a simple DTO in the Action
class
in order to have it serialized and sent through an RPC.

Thanks for your tips,

António Santos
FEUP - Portugal

---

Hmm. I was about to finger the ActionServlet reference, and the
MultipartRequestWrapper ref, but they are both transient, so can't be
causing the problem.
My next suspect would be the FormFile (but its the actionservletwrapper its
listing in the except... ahhh... but of course its a wrapper - not the ref
itself - the ActionServlet reference is transient, but the *wrapper* object
a new instance of which is returned on each call to getServletWrapper()
doesnt implement Serializable.

Hmm. You cant do much about that. IMHO given that ActionForm claims to
implement Serializable, thats would be a bug!

<silly-idea>
heres a nasty hack: Perhaps you could add a transient field to your action
form:

public transient boolean _disableWrapper = false;

And override getServletWrapper thusly:

public ActionServletWrapper getServletWrapper()
{
 return _disableWrapper ? null : super.getServlet();
}

Prior to serialisation set the field to true. Serialise and then set it
back.

Oh and lose the formfiles, as for sure they will be the next problem -
unless you make their fields transient in your form.
</silly-idea>

Why on earth are you using an ActionForm as a parameter to an RPC though?
ActionForms are VIEW components. Very bad karma to use them as DTOs.

<better-idea>
You would do better to create a normal bean class with the properties you
want and serialise that (you can use PropertyUtils.copyProperties() to
transfer the data from the ActionForm to the DTO if you dont fancy a lot of
typing...).
</better-idea>


---

I'm assuming it's a configuration issue with your AXIS implementation.
But rather then get into that... why not just create a interim bean that
will store the data then BeanUtil.copyProperties it back to the ActionForm?
-Tim


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to