Writing an RPC-based SOAP service is a very
trivial undertaking, and really only involves
the following two basic steps:
In a Java based service implementation, you may throw a SOAPException to indicate that some error has occurred when processing the request. Throwing a SOAPException(FAULT_CODE_CLIENT, ...) will allow your service implementation to indicate that the failure was due to a client error, whereas throwing a SOAPException(FAULT_CODE_SERVER, ...) will indicate that your service implementation was at fault. (If you throw any other type of exception, the server will catch it, and will pass it on as a SOAPException(FAULT_CODE_SERVER, ...)) See the SOAP v1.1 specification for more information on SOAP Faults.
Java services can also be Apache SOAP-aware. Methods with an initial parameter of type SOAPContext can be invoked by a SOAP RPC call that passes the other parameters. The provider will invoke the method with the SOAPContext of the current request as the first parameter. The SOAPContext includes a bag (Hashtable) of instances, including the current HttpServlet, HttpSession, HttpServletRequest, HttpServletResponse, and DeploymentDescriptor. These are accessed through the getProperty method. The Constants class contains constants (beginning with BAG_) to use as parameters to getProperty. This mechanism provides services with the ability to access a great deal of information about the environment in which they are executing.
Java services can also use an Apache SOAP-provided interface ConfigurableService to receive initialization parameters. Upon instantiation, a service implementing this interface will have the configure method called. The parameters for this method are hashtables of initialization parameters for the service (from the deployment descriptor options tags), the servlet and the servlet context (web application).
Last updated 6/24/2002 by Scott Nichol <snicholnews@scottnichol.com>.