On Thu, 17 Oct 2002, Rohra, Prakash N. ,,DMDC/BEAU wrote:

> Date: Thu, 17 Oct 2002 11:23:29 -0400
> From: "Rohra, Prakash N. ,,DMDC/BEAU" <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
> Subject: RE: Can V in MVC be Swing in Struts?
>
> We have a similar situation where Server side Struts components (Actions and
> JavaBean business components) will be accessed by a client Swing Java
> application (not a browser).
>
> We are also looking at various alternatives like SOAP, XML-RPC or simple
> HTTP POST requests (with XML data or Serialized objects).
>
> I have 2 questions:
>
> (1) Does STRUTS support sending serialized VO objects (as against HTML or
> XML text strings) back and forth between client app and server. What needs
> to be changed in STRUTS components to suport this?
>

There are at least two different ways to accomplish this:

* Have your Action write the XML output directly to the response,
  and then return null (indicates that the response has been completed,
  so no forwarding is necessary).

* Have the JSP pages you forward to (for the view) render "text/xml"
  instead of "text/html".  You won't be using the struts-html tags
  in this scenario, but you'll be able to fill in dynamic parts of
  the response with things like <bean:write> or <bean:message>:

  <customer>
    ...
    <name><bean:write name="customer" property="name"/></name>
    ...
  </customer>

In some scenarios, you will also want to transform the XML output
depending on what the user agent is, or for other similar reasons.  Check
out the STXX framework (search in Google to find it), which layers on top
of Struts and lets you specify a pipeline of XSLT transformations to be
performed on the response that your app itself generates.

> (2) Does SOAP (Web services) support client sessions ? i.e. will I be able
> to maintain individual client's session state (which might be full business
> object JavaBeans) or Web services are suited for state-less method calls??
> Any pointers will be appriciated ??
>

SOAP is generally designed to be stateless -- I know that during the
design of JAX-RPC (the standard Java API for SOAP-based web services),
there was discussion of supporting HTTP sessions but do not remember how
that came out.

If you are rolling your own XML output (per one of the suggestions above),
and your client is aware of how servlet-based sessions work, you can
support stateful transactions by having your client include the
appropriate cookie (or the jsessionid path parameter) in the requests that
it sends.

In either scenario, this is not likely to be interoperable with
non-servlet-API based SOAP servers, or with clients that don't understand
servlet sessions.

> thanks
>

Craig


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

Reply via email to