// that this is a Client-side (consumer) error.
SOAPBody soapReqBody = soapReq.getSOAPBody();
Element uddiReq = (Element)soapReqBody.getFirstChild();
if (uddiReq == null)
throw new FatalErrorException("A UDDI request was not " +
"found in the SOAP message.");
// Grab the local name of the UDDI request element
// from the UDDI Request. If a value isn't returned
// (either null or an empty String is returned) then
// throw a FatalError exception. This is probably a
// configuration problem related to the XML Parser
// that jUDDI is using.
String operation = uddiReq.getLocalName();
if ((operation == null) || (operation.trim().length() == 0))
throw new FatalErrorException("The UDDI service operation " +
"could not be identified.");
// Grab the generic attribute value (version value). If
// one isn't specified or the value specified is not "2.0"
// then throw an exception (this value must be specified
// for all UDDI requests and currently only vesion 2.0
// UDDI requests are supported).
String version = uddiReq.getAttribute("generic");
if (version == null)
throw new FatalErrorException("A UDDI generic attribute " +
"value was not found for UDDI request: "+operation+" (The " +
"'generic' attribute must be present)");
// Verify that the appropriate endpoint was targeted for
// this service request. The validateRequest method will
// throw an UnsupportedException if anything's amiss.
validateRequest(operation,version,uddiReq);
// Lookup the appropriate XML handler. Throw an
// UnsupportedException if one could not be located.
HandlerMaker maker = HandlerMaker.getInstance();
IHandler requestHandler = maker.lookup(operation);
if (requestHandler == null)
throw new UnsupportedException("The UDDI service operation " +
"specified is unknown or unsupported: " +operation);
// Unmarshal the raw xml into the appropriate jUDDI
// request object.
RegistryObject uddiReqObj = requestHandler.unmarshal(uddiReq);
// Grab a reference to the shared jUDDI registry
// instance (make sure it's running) and execute the
// requested UDDI function.
RegistryObject uddiResObj = null;
RegistryEngine registry = RegistryServlet.getRegistry();
if ((registry != null) && (registry.isAvailable()))
uddiResObj = registry.execute(uddiReqObj);
else
throw new BusyException("The Registry is currently unavailable.");
// Lookup the appropriate response handler which will
// be used to marshal the UDDI object into the appropriate
// xml format.
IHandler responseHandler = maker.lookup(uddiResObj.getClass().getName());
if (responseHandler == null)
throw new FatalErrorException("The response object " +
"type is unknown: " +uddiResObj.getClass().getName());
// Create a new 'temp' XML element to use as a container
// in which to marshal the UDDI response data into.