Search in sources :

Example 1 with ClientHttpRequest

use of com.emc.cloud.platform.clientlib.ClientHttpRequest in project coprhd-controller by CoprHD.

the class UCSMHttpTransportWrapper method postEntity.

public <T> T postEntity(String serviceURI, JAXBElement<T> jaxbElement, Class<T> returnType) throws ClientGeneralException {
    URL ucsmURL = null;
    ClientHttpRequest httpRequest = null;
    try {
        ucsmURL = new URL(serviceURI);
    } catch (MalformedURLException ex) {
        throw new ClientGeneralException(ClientMessageKeys.MALFORMED_URL);
    }
    if (ucsmURL.getProtocol().equalsIgnoreCase("https")) {
        httpRequest = ucsSSLTransportRequestFactory.create();
    } else {
        httpRequest = ucsTransportRequestFactory.create();
    }
    T result = null;
    try {
        result = httpRequest.httpPostXMLObject(serviceURI, jaxbElement, returnType);
    } catch (ClientGeneralException e) {
        LOGGER.info(e.getLocalizedMessage(), e);
        throw e;
    }
    return result;
}
Also used : MalformedURLException(java.net.MalformedURLException) ClientHttpRequest(com.emc.cloud.platform.clientlib.ClientHttpRequest) URL(java.net.URL) ClientGeneralException(com.emc.cloud.platform.clientlib.ClientGeneralException)

Aggregations

ClientGeneralException (com.emc.cloud.platform.clientlib.ClientGeneralException)1 ClientHttpRequest (com.emc.cloud.platform.clientlib.ClientHttpRequest)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1