Interface Client
- All Known Implementing Classes:
ApacheHttpClient,SoapClient,WSClient
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.
-
Method Summary
Modifier and TypeMethodDescriptionReturns 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 payloadsInvoke a given method with suppliedArgumenton the remote vi server.invokeAsString(String methodName, Argument[] paras) Invoke a given method with suppliedArgumenton the remote vi server.Marshal the JAVA Object into a XML payload to send to the serverreadStream(InputStream stream) 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.voidsetSoapActionOnApiVersion(String apiVersion) Sets the api version.voidsetVimNameSpace(String vimNameSpace) Sets the vim name space for the SOAP payload.unMarshall(String returnType, InputStream is) Convert from an InputStream filled with an XML response from the server to a given JAVA Object of returnType
-
Method Details
-
invoke
Invoke a given method with suppliedArgumenton the remote vi server. This method typically creates the payload needed to send to the vi server. For example you would pass in RetrieveServiceContent for the methodName, next the params needed for the method. Next give the returnType the parser should convert the response to in this case the string ServiceContentReturns an
Objectof the given return type. Using the example above you would get aServiceContentObject.- Parameters:
methodName- Name of the method to executeparas- Array of Arguments aka params for the methodreturnType- String name of the return type- Returns:
- Object
- Throws:
RemoteException
-
invokeAsString
Invoke a given method with suppliedArgumenton the remote vi server. Returns aStringBufferThis works the same as the above call except there is no conversion done on the return data and instead you just get back the StringBuffer content.- Parameters:
methodName- Name of the method to executeparas- Array of Arguments aka params for the method- Returns:
- StringBuffer with the
- Throws:
RemoteException
-
getBaseUrl
URL getBaseUrl()Returns theURLthat will be used in the connection.- Returns:
URLof the vi server used by this Client
-
setBaseUrl
Set the baseUrl for use in this Client- Parameters:
baseUrl-URLto be used by this Client
-
getCookie
String getCookie()Returns theStringof the Cookie from the Set-Cookie header unless it was manually set in which case it returns that.- Returns:
- String from the Set-Cookie header
-
setCookie
Primarily used to set the cookie from the Set-Cookie header- Parameters:
cookie- String from the Set-Cookie header
-
getVimNameSpace
String getVimNameSpace()Get the vim namespace used in SOAP payloads- Returns:
- vim namespace used in SOAP Payloads
-
setVimNameSpace
Sets the vim name space for the SOAP payload.- Parameters:
vimNameSpace- String
-
getConnectTimeout
int getConnectTimeout()Basic getter- Returns:
- Time in milliseconds as an
int
-
setConnectTimeout
void setConnectTimeout(int timeoutMilliSec) Sets 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().
- Parameters:
timeoutMilliSec- anintthat specifies the connect timeout value in milliseconds
-
getReadTimeout
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.
- Returns:
- Time in milliseconds
-
setReadTimeout
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
- Parameters:
timeoutMilliSec- Integer time in milliseconds
-
getTrustManager
TrustManager getTrustManager() -
setSoapActionOnApiVersion
Sets the api version. The oldest supported will be v4.0- Parameters:
apiVersion- String with the api version.
-
marshall
Marshal the JAVA Object into a XML payload to send to the server- Parameters:
methodName- String Name of the method to executeparas- Array of Arguments aka params for the method- Returns:
-
unMarshall
Convert from an InputStream filled with an XML response from the server to a given JAVA Object of returnType- Parameters:
returnType-is-- Returns:
- Throws:
Exception
-
readStream
Read an InputStream filled with an XML response from the server.- Parameters:
stream-- Returns:
- Throws:
IOException
-