com.oroad.stxx.xform
Class XMLFormService

java.lang.Object
  extended bycom.oroad.stxx.xform.XMLFormService

public class XMLFormService
extends java.lang.Object

Exposes XML forms as a message-style SOAP web service. This service is tied to Axis and HTTP to integrate smoothly with Struts. It takes one or more XML elements, validates them, then returns one or more corresponding result elements including any errors raised in the validation. If validation succeeds, the form's save method will be called and its return code put in the result element.

This service is not thread-safe so it should only be in the request or session scope.

This class requires service options to be set in the WSDD:

Author:
brownd

Field Summary
protected  XMLForm xmlform
          The xml form
 
Constructor Summary
XMLFormService()
           
 
Method Summary
protected  void encodeViolations(java.util.List violations, org.w3c.dom.Element result)
          Encodes the validation errors as DOM elements and stores them in the result.
protected  org.w3c.dom.Document importElement(org.w3c.dom.Element e)
          Converts the element to its own Document for processing.
protected  void loadForm()
          Loads the XML form from Axis service options in the WSDD.
 org.w3c.dom.Element[] process(org.w3c.dom.Element[] elems)
          Service method, validates, saves, and encodes the results of the XML it receives.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xmlform

protected XMLForm xmlform
The xml form

Constructor Detail

XMLFormService

public XMLFormService()
Method Detail

process

public org.w3c.dom.Element[] process(org.w3c.dom.Element[] elems)
Service method, validates, saves, and encodes the results of the XML it receives.

Parameters:
elems - an array of DOM Elements, one for each form XML
Returns:
an array of result DOM Elements, including errors if appplicable

encodeViolations

protected void encodeViolations(java.util.List violations,
                                org.w3c.dom.Element result)
Encodes the validation errors as DOM elements and stores them in the result. Any error keys will be looked up in the Struts message resources in the default locale.

Parameters:
violations - A list of validation errors
result - The result element to attach the error DOM elements

importElement

protected org.w3c.dom.Document importElement(org.w3c.dom.Element e)
Converts the element to its own Document for processing.

Parameters:
e - The element to convert
Returns:
The element imported in its own document

loadForm

protected void loadForm()
Loads the XML form from Axis service options in the WSDD.