public static DecodeResponseMessage ( byte byteArr ) : |
||
byteArr | byte | The payload. |
Результат |
/// <summary> /// Send the byte array of PCHC message using https transport . /// </summary> /// <param name="httpRequestPayload">The http request payload.</param> /// <returns>The pchc response message.</returns> private RESPONSE_MESSAGE SendByte(byte[] httpRequestPayload) { // Set the timeout of http. int timeout = 20000; byte[] payloadBuffer = null; HttpWebResponse httpWebResponse; this.httpClientTransport.Send(HttpVersion.Version10, null, httpRequestPayload, HttpMethod.POST, timeout); try { httpWebResponse = this.httpClientTransport.Receive(ref payloadBuffer); } catch (WebException e) { if (e.Message.Contains(HttpStatusCode.Unauthorized.ToString())) { throw new HttpStatusCode401Exception(); } else if (e.Message.ToLower().Contains("timed out".ToLower())) { throw new NoRESPONSEMESSAGEException(); } else { // Un expected exception is received. throw; } } this.httpResponseMethod = httpWebResponse.Method; this.httpResponseUri = httpWebResponse.ResponseUri; if (payloadBuffer == null) { throw new NoRESPONSEMESSAGEException(); } try { this.responseMessage = DecodeMessage.DecodeResponseMessage(payloadBuffer); } catch (ArgumentOutOfRangeException e) { throw new NoRESPONSEMESSAGEException(e.Message); } return(this.responseMessage); }