Class AbstractSoapClient<T>

java.lang.Object
org.projecthusky.xua.communication.clients.impl.AbstractSoapClient<T>
Type Parameters:
T - the type of the object
Direct Known Subclasses:
SimpleArtifactResolveClient, SimpleXuaClient

public abstract class AbstractSoapClient<T> extends Object
Abstract Class implementing a soap client based on httpclient.
Abstrakte Klasse welche einen SOAP Client implementiert auf Basis von Httpclient.
  • Constructor Details

    • AbstractSoapClient

      public AbstractSoapClient()
  • Method Details

    • createBody

      protected void createBody(Element aBodyElement, Element envelopElement)
      creates body of soap message.
      Parameters:
      aBodyElement - body element
      envelopElement - soap envelope element
    • createEnvelope

      protected Element createEnvelope() throws ParserConfigurationException
      creates SOAP envelope.
      Returns:
      created soap envelope
      Throws:
      ParserConfigurationException - will be thrown on error
    • createHeader

      protected void createHeader(Element aSecurityHeaderElement, WsaHeaderValue wsHeaders, Element envelopElement)
      creates SOAP header.
      Parameters:
      aSecurityHeaderElement - SOAP security header element
      wsHeaders - WSA headers
      envelopElement - soap envelope
    • createXmlString

      protected String createXmlString(Element aEnvelope) throws TransformerException
      creates XML String from passed SOAP envelope.
      Parameters:
      aEnvelope - soap envelope
      Returns:
      XML String
      Throws:
      TransformerException - will be thrown on transform errors
    • execute

      protected T execute(org.apache.hc.client5.http.classic.methods.HttpPost post) throws ClientSendException, IOException
      sends soap message.
      Parameters:
      post - http post
      Returns:
      response
      Throws:
      ClientSendException - will be thrown on errors
      IOException - will be thrown on errors
    • extractResponse

      protected String extractResponse(org.apache.hc.core5.http.HttpEntity responseEntity) throws IOException, ClientSendException
      Throws:
      IOException
      ClientSendException
    • getBoundary

      protected byte[] getBoundary(String value)
      method to get the boundary bytes.
      Parameters:
      value - the value
      Returns:
      the boundary as byte array
    • getConfig

      protected SoapClientConfig getConfig()
      Method to get soap client configuration.
      Returns:
      the soap client configuration
    • getHttpClient

      protected org.apache.hc.client5.http.impl.classic.CloseableHttpClient getHttpClient() throws ClientSendException
      Method to get HTTP client. This HTTP client uses keystore details from configuration.
      Returns:
      closeable HTTP client
      Throws:
      ClientSendException - will be thrown if an error occures.
    • getHttpPost

      protected org.apache.hc.client5.http.classic.methods.HttpPost getHttpPost()
      Method to get HTTP Post with URI from configuration. Application/soap+xml ist set as content type header.
      Returns:
      the httppost instance
    • getLogger

      protected org.slf4j.Logger getLogger()
      Method to get Logger.
      Returns:
      the logger
    • getNode

      protected Node getNode(Element element, String xPathExpression) throws XPathExpressionException
      Method to get Node of element with passed XPath expression.
      Parameters:
      element - element to search in
      xPathExpression - XPath expression
      Returns:
      found node
      Throws:
      XPathExpressionException - will be thrown on error
    • getRequestConfig

      protected org.apache.hc.client5.http.config.RequestConfig getRequestConfig()
      Method to get request configuration.
      Returns:
      request configuration
    • getResponseElement

      protected Element getResponseElement(String content, String nameSpaceUri, String localName) throws UnsupportedOperationException, XPathExpressionException, net.shibboleth.shared.xml.XMLParserException
      Method to get response element as Element from content. The passed local name and namespace is used to filter the response element.
      Parameters:
      content - response as xml
      nameSpaceUri - namespace
      localName - name of element
      Returns:
      response element
      Throws:
      UnsupportedOperationException - will be thrown on error
      XPathExpressionException - will be thrown on error
      net.shibboleth.shared.xml.XMLParserException - will be thrown on error
    • getSoapException

      protected SoapException getSoapException(Node faultnode)
      Method to get soap exception of Axis2 fault Node.
      Parameters:
      faultnode - the fault node
      Returns:
      extracted SOAP exception
    • parseResponse

      protected abstract T parseResponse(String content) throws ClientSendException
      Method to extract response from XML String.
      Parameters:
      content - XML String
      Returns:
      extracted element
      Throws:
      ClientSendException - will be thrown if an error occures.
    • parseResponseError

      protected T parseResponseError(String content) throws ClientSendException
      Method to extract error from XML response.
      Parameters:
      content - XML String
      Returns:
      extracted error
      Throws:
      ClientSendException - will be thrown if an error occures
    • setConfig

      protected void setConfig(SoapClientConfig config)
      Method to set SOAP client configuration.
      Parameters:
      config - the soap client configuration
    • setLogger

      protected void setLogger(org.slf4j.Logger logger)
      Method to set logger.
      Parameters:
      logger - the logger