Class SoapConnection
- 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 Summary
Constructors Constructor Description SoapConnection(String hostName, int port, String servicePath, String userName, Authentication authentication, com.oracle.bedrock.Option... options)Create aSoapConnectionthat uses the specified connection details.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpBasedAuthenticationgetAuthentication()Obtain the user name used by thisSoapConnectionto connect to the SOAP service.protected List<Object>getSOAPBodyContents(InputStream stream)Un-marshall the SOAP response from the specifiedInputStream.URLgetUrl()Obtain theURLod the SOAP service.StringgetUserName()Obtain the user name used by thisSoapConnectionto connect to the SOAP service.List<Object>send(org.w3c.soap.envelope.Envelope envelope)Send the specified SOAPEnvelopeto the SOAP service listening on the specifiedURL.protected List<Object>send(org.w3c.soap.envelope.Envelope envelope, HttpURLConnection httpConnection)Send the specified SOAPEnvelopeto the SOAP service listening on the specifiedHttpURLConnection.
-
-
-
Constructor Detail
-
SoapConnection
public SoapConnection(String hostName, int port, String servicePath, String userName, Authentication authentication, com.oracle.bedrock.Option... options)
Create aSoapConnectionthat uses the specified connection details.- Parameters:
hostName- the host name of the host running the SOAP serviceport- the port that the SOAP service is listening onservicePath- the service pathuserName- the name of the user to use to connect to the WinRM serviceauthentication- the authentication to use to connect to the WinRMoptions- theOptions controlling the session
-
-
Method Detail
-
getUserName
public String getUserName()
Obtain the user name used by thisSoapConnectionto connect to the SOAP service.- Returns:
- the user name used by this
SoapConnectionto connect to the SOAP service
-
getAuthentication
public HttpBasedAuthentication getAuthentication()
Obtain the user name used by thisSoapConnectionto connect to the SOAP service.- Returns:
- the user name used by this
SoapConnectionto connect to the SOAP service
-
send
public List<Object> send(org.w3c.soap.envelope.Envelope envelope) throws IOException
Send the specified SOAPEnvelopeto the SOAP service listening on the specifiedURL.- Parameters:
envelope- theEnvelopeto 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 SOAPEnvelopeto the SOAP service listening on the specifiedHttpURLConnection.- Parameters:
envelope- the SOAPEnvelopeto sendhttpConnection- theHttpURLConnectionto 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 specifiedInputStream.- Parameters:
stream- theInputStreamcontaining the XML to un-marshall- Returns:
- the un-marshaled JAXB objects
- Throws:
javax.xml.bind.JAXBException- when the contents can't be parsedIOException- when the IO stream failsSoapFaultException- when SOAP connection fails
-
-