Class SoapClient
- All Implemented Interfaces:
Client
- Direct Known Subclasses:
ApacheHttpClient,WSClient
Copyright 2014 Michael Rice
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturns theURLthat will be used in the connection.intBasic getterReturns theStringof the Cookie from the Set-Cookie header unless it was manually set in which case it returns that.intReturns the time in milliseconds that is set for the read timeoutGet the vim namespace used in SOAP payloadsstatic Stringhexify(byte[] bytes) This method will marshall the java payload object in to xml payload.Read an InputStream filled with an XML response from the server.voidsetBaseUrl(URL baseUrl) Set the baseUrl for use in this ClientvoidsetConnectTimeout(int timeoutMilliSec) Sets a specified timeout value, in milliseconds, to be used when opening a communications link to the resource referenced by this Client.voidPrimarily used to set the cookie from the Set-Cookie headervoidsetReadTimeout(int timeoutMilliSec) Set the read timeout.voidsetServerThumbprint(String thumbprint) voidsetSoapActionOnApiVersion(String apiVersion) Sets the api version.voidsetVimNameSpace(String vimNameSpace) Sets the vim name space for the SOAP payload.unMarshall(String returnType, InputStream is) This method will unmarshall the response inputstream to Java Object of returnType type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vmware.vim25.ws.Client
invoke, invokeAsString
-
Field Details
-
soapAction
-
baseUrl
-
cookie
-
thumbprint
-
vimNameSpace
-
connectTimeout
public int connectTimeout -
readTimeout
public int readTimeout -
trustManager
-
-
Constructor Details
-
SoapClient
public SoapClient()
-
-
Method Details
-
setSoapActionOnApiVersion
Description copied from interface:ClientSets the api version. The oldest supported will be v4.0- Specified by:
setSoapActionOnApiVersionin interfaceClient- Parameters:
apiVersion- String with the api version.
-
getBaseUrl
Returns theURLthat will be used in the connection.- Specified by:
getBaseUrlin interfaceClient- Returns:
URLof the vi server used by this Client
-
setBaseUrl
Set the baseUrl for use in this Client- Specified by:
setBaseUrlin interfaceClient- Parameters:
baseUrl-
-
getCookie
Returns theStringof the Cookie from the Set-Cookie header unless it was manually set in which case it returns that. -
setServerThumbprint
-
getServerThumbprint
-
computeX509CertificateThumbprint
-
hexify
-
setCookie
Primarily used to set the cookie from the Set-Cookie header -
getVimNameSpace
Description copied from interface:ClientGet the vim namespace used in SOAP payloads- Specified by:
getVimNameSpacein interfaceClient- Returns:
-
setVimNameSpace
Description copied from interface:ClientSets the vim name space for the SOAP payload.- Specified by:
setVimNameSpacein interfaceClient- Parameters:
vimNameSpace-
-
getConnectTimeout
public int getConnectTimeout()Description copied from interface:ClientBasic getter- Specified by:
getConnectTimeoutin interfaceClient- Returns:
- Time in milliseconds as an
int
-
setConnectTimeout
public void setConnectTimeout(int timeoutMilliSec) Description copied from interface:ClientSets a specified timeout value, in milliseconds, to be used when opening a communications link to the resource referenced by this Client. If the timeout expires before the connection can be established, a java.net.SocketTimeoutException is raised. A timeout of zero is interpreted as an infinite timeout. This is only used if your client supports this setting.Some non-standard implementation of this method may ignore the specified timeout. To see the connect timeout set, please call getConnectTimeout().
- Specified by:
setConnectTimeoutin interfaceClient- Parameters:
timeoutMilliSec-
-
getReadTimeout
public int getReadTimeout()Returns the time in milliseconds that is set for the read timeoutThis time may not be the same as what the underlying client uses. If for example the client does not support this and is for some reason hard coded to some value this value.
- Specified by:
getReadTimeoutin interfaceClient- Returns:
- int
-
setReadTimeout
public void setReadTimeout(int timeoutMilliSec) Set the read timeout.Sets the read timeout to a specified timeout, in milliseconds. A non-zero value specifies the timeout when reading from Input stream when a connection is established to a resource. If the timeout expires before there is data available for read, a java.net.SocketTimeoutException is raised. A timeout of zero is interpreted as an infinite timeout.
This value will be used by the underlying http client used if it is supported. By default that is the WSClient which uses HTTPURLConnection which uses URLConnection
- Specified by:
setReadTimeoutin interfaceClient- Parameters:
timeoutMilliSec- int
-
getTrustManager
- Specified by:
getTrustManagerin interfaceClient
-
readStream
Description copied from interface:ClientRead an InputStream filled with an XML response from the server.- Specified by:
readStreamin interfaceClient- Parameters:
is-- Returns:
- Throws:
IOException
-
marshall
This method will marshall the java payload object in to xml payload. -
unMarshall
This method will unmarshall the response inputstream to Java Object of returnType type.- Specified by:
unMarshallin interfaceClient- Parameters:
returnType-is-- Returns:
- Object - Converted Response inputstream
- Throws:
Exception
-