java.lang.Object
com.oracle.bedrock.runtime.remote.windows.winrm.SoapConnection

public class SoapConnection extends Object
This class encapsulate the sending of a SOAP message and the processing of the response. This encapsulation is primarily to allow mocks and stubs to be used for testing.

Copyright (c) 2015. All Rights Reserved. Oracle Corporation.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.

Author:
Jonathan Knight
  • Constructor Details

    • SoapConnection

      public SoapConnection(String hostName, int port, String servicePath, String userName, Authentication authentication, com.oracle.bedrock.Option... options)
      Create a SoapConnection that uses the specified connection details.
      Parameters:
      hostName - the host name of the host running the SOAP service
      port - the port that the SOAP service is listening on
      servicePath - the service path
      userName - the name of the user to use to connect to the WinRM service
      authentication - the authentication to use to connect to the WinRM
      options - the Options controlling the session
  • Method Details

    • getUrl

      public URL getUrl()
      Obtain the URL od the SOAP service.
      Returns:
      the URL od the SOAP service
    • getUserName

      public String getUserName()
      Obtain the user name used by this SoapConnection to connect to the SOAP service.
      Returns:
      the user name used by this SoapConnection to connect to the SOAP service
    • getAuthentication

      public HttpBasedAuthentication getAuthentication()
      Obtain the user name used by this SoapConnection to connect to the SOAP service.
      Returns:
      the user name used by this SoapConnection to connect to the SOAP service
    • send

      public List<Object> send(org.w3c.soap.envelope.Envelope envelope) throws IOException
      Send the specified SOAP Envelope to the SOAP service listening on the specified URL.
      Parameters:
      envelope - the Envelope to send
      Returns:
      the un-marshaled result returned from the SOAP service
      Throws:
      IOException - if an error occurs
    • send

      protected List<Object> send(org.w3c.soap.envelope.Envelope envelope, HttpURLConnection httpConnection) throws IOException
      Send the specified SOAP Envelope to the SOAP service listening on the specified HttpURLConnection.
      Parameters:
      envelope - the SOAP Envelope to send
      httpConnection - the HttpURLConnection to send the message to
      Returns:
      the response from the SOAP service
      Throws:
      IOException - if an error occurs
    • getSOAPBodyContents

      protected List<Object> getSOAPBodyContents(InputStream stream) throws javax.xml.bind.JAXBException, IOException, SoapFaultException
      Un-marshall the SOAP response from the specified InputStream.
      Parameters:
      stream - the InputStream containing the XML to un-marshall
      Returns:
      the un-marshaled JAXB objects
      Throws:
      javax.xml.bind.JAXBException - when the contents can't be parsed
      IOException - when the IO stream fails
      SoapFaultException - when SOAP connection fails