WebServicesAdaptor

public abstract class WebServicesAdaptor extends SOAPHttpAdaptor

WebServicesAdaptor is a SOAPHttpAdaptor which handles web services request. This adaptor can only handles document style web services. It invokes either one of the following methods in the subclass for handling the request:

  1. public Element[] serviceRequested(Element[] bodies)
  2. public SOAPElement[] serviceRequested(SOAPElement[] bodies)
  3. public void serviceRequested(SOAPMessage req, SOAPMessage resp)
  4. public void serviceRequested(WebServicesRequest req, WebServicesResponse resp)
Author:Hugo Y. K. Lam

Methods

createElement

protected SOAPElement createElement(String name, String value, String namespace, String xsdType)

Creates a SOAP element.

Parameters:
  • name – the element name.
  • value – the element value.
  • namespace – the namespace.
  • xsdType – the XSD data type.
Throws:
  • SOAPException – if unable to create the element.
Returns:

the newly created element.

createElement

protected SOAPElement createElement(String local, String namespace)

createElement

protected SOAPElement createElement(String local, String namespace, String value)

createText

protected SOAPElement createText(String name, String value, String namespace)

Creates a text element.

Parameters:
  • name – the element name.
  • value – the element value.
  • namespace – the namespace.
Throws:
  • SOAPException – if unable to create the element.
Returns:

the newly created text element.

doStartRequest

public boolean doStartRequest(HttpServletRequest request, HttpServletResponse response)

Responses with a web services descriptor if the request’s query is “wsdl” or the request is a “get” method.

Parameters:
  • request – the servlet request.
  • response – the servlet response.
Throws:
Returns:

true if the request is not a “wsdl” request, false otherwise.

See also: hk.hku.cecid.piazza.commons.servlet.http.HttpRequestListener.doStartRequest(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)

getChildElementArray

protected SOAPElement[] getChildElementArray(SOAPElement element)

getText

protected String getText(Element[] elements, String nodename)

Gets the text value of the element with the specified node name in the given elements.

Parameters:
  • elements – the elements containing the target node.
  • nodename – the target node name.
Returns:

the text value of the specified node.

isElement

protected boolean isElement(SOAPElement element, String local, String namespace)

processDescriptorRequest

protected void processDescriptorRequest(OutputStream outs)

Processes the WSDL request. Override to provide specific descriptor.

Parameters:
  • outs – the output stream to which the descriptor should be written.
Throws:

processRequest

public void processRequest(SOAPRequest request, SOAPResponse response)

Prcoesses the SOAP request.

Parameters:
  • request – the SOAP request.
  • response – the SOAP response.
Throws:

See also: hk.hku.cecid.piazza.commons.soap.SOAPRequestListener.processRequest(hk.hku.cecid.piazza.commons.soap.SOAPRequest, hk.hku.cecid.piazza.commons.soap.SOAPResponse)