Package org.serviceconnector.scmp

Examples of org.serviceconnector.scmp.SCMPMessageFault


            + Constants.SLASH + path + remoteFileName);
        httpCon = (HttpURLConnection) url.openConnection();
        httpCon.connect();
        in = httpCon.getInputStream();
      } catch (Exception e) {
        SCMPMessageFault fault = new SCMPMessageFault(SCMPError.SERVER_ERROR, httpCon.getResponseMessage() + " "
            + e.getMessage());
        LOGGER.warn("Download file request failed " + httpCon.getResponseMessage());
        return fault;
      }
      // set session to streaming mode
View Full Code Here


    try {
      httpCon = (HttpURLConnection) url.openConnection();
      httpCon.connect();
      in = httpCon.getInputStream();
    } catch (Exception e) {
      SCMPMessageFault fault = new SCMPMessageFault(SCMPError.SERVER_ERROR, httpCon.getResponseMessage() + " "
          + e.getMessage());
      LOGGER.warn("List file request failed " + httpCon.getResponseMessage());
      return fault;
    }
    try {
      // write the data to the client
      SCMPMessage reply = null;
      byte[] fullBuffer = new byte[Constants.DEFAULT_MESSAGE_PART_SIZE];
      int readBytes = in.read(fullBuffer);
      if (readBytes < 0) {
        // this is the end
        reply = new SCMPMessage();
        reply.setBody(new byte[0]);
        in.close();
        httpCon.disconnect();
        return reply;
      }
      // set up part request, no poll request
      reply = new SCMPMessage();
      reply.setBody(fullBuffer, 0, readBytes);
      return reply;
    } catch (Exception e) {
      SCMPMessageFault fault = new SCMPMessageFault(e);
      LOGGER.warn("List file failed " + httpCon.getResponseMessage());
      return fault;
    }
  }
View Full Code Here

    if (th instanceof HasFaultResponseException) {
      ((HasFaultResponseException) e).setFaultResponse(response);
      response.write();
      return;
    }
    SCMPMessageFault fault = new SCMPMessageFault(SCMPError.SC_ERROR, th.getMessage());
    fault.setMessageType(SCMPMsgType.UNDEFINED);
    response.setSCMP(fault);
    response.write();
  }
View Full Code Here

    this.headKey = SCMPHeaderKey.EXC;
    String header = "msn=" + msgSequenceNr + "\n" + "bty=" + bodyType.getValue() + "\n" + "mty=" + msgType.getValue() + "\n";

    String expectedString = TestUtil.getSCMPString(headKey, header, body);

    SCMPMessage encodeExc = new SCMPMessageFault();
    encodeExc.setHeader(encodeScmp);
    encodeExc.setBody(body.getBytes());

    OutputStream os = new ByteArrayOutputStream();
    try {
      coder.encode(os, encodeExc);
    } catch (Exception e) {
View Full Code Here

    if (th instanceof HasFaultResponseException) {
      ((HasFaultResponseException) th).setFaultResponse(response);
      response.write();
      return;
    }
    SCMPMessageFault fault = new SCMPMessageFault(SCMPError.SC_ERROR, th.getMessage()
        + " caught exception in web responder request handler");
    fault.setMessageType(SCMPMsgType.UNDEFINED);
    response.setSCMP(fault);
    response.write();
  }
View Full Code Here

    Assert.assertEquals(error.getErrorCode(), result.getHeaderInt(SCMPHeaderAttributeKey.SC_ERROR_CODE).intValue());
  }

  public static void checkReply(SCMPMessage message) throws Exception {
    if (message.isFault()) {
      SCMPMessageFault fault = (SCMPMessageFault) message;
      Exception ex = fault.getCause();
      if (ex != null) {
        throw ex;
      }
      throw new Exception(fault.getHeader(SCMPHeaderAttributeKey.SC_ERROR_TEXT));
    }
  }
View Full Code Here

    if (th instanceof HasFaultResponseException) {
      ((HasFaultResponseException) th).setFaultResponse(response);
      response.write();
      return;
    }
    SCMPMessageFault fault = new SCMPMessageFault(SCMPError.SC_ERROR, th.getMessage());
    fault.setMessageType(SCMPMsgType.UNDEFINED);
    response.setSCMP(fault);
    response.write();
  }
View Full Code Here

    String serviceName = reqMessage.getServiceName();
    SCMPMessage fault = null;
    SCMPVersion scmpVersion = reqMessage.getSCMPVersion();
    if (ex instanceof IdleTimeoutException) {
      // operation timeout handling - SCMP Version request
      fault = new SCMPMessageFault(scmpVersion, SCMPError.OPERATION_TIMEOUT,
          "Operation timeout expired on SC csc abort subscription sid=" + sid);
    } else if (ex instanceof IOException) {
      fault = new SCMPMessageFault(scmpVersion, SCMPError.CONNECTION_EXCEPTION,
          "broken connection on SC csc abort subscription sid=" + sid);
    } else {
      fault = new SCMPMessageFault(scmpVersion, SCMPError.SC_ERROR, "executing csc abort subscription failed sid=" + sid);
    }
    // forward server reply to client
    fault.setIsReply(true);
    fault.setServiceName(serviceName);
    fault.setMessageType(SCMPMsgType.CSC_ABORT_SUBSCRIPTION);
View Full Code Here

    LOGGER.warn("receive exception sid=" + sid + " " + ex.toString());
    SCMPMessage fault = null;
    SCMPVersion scmpVersion = this.requestMessage.getSCMPVersion();
    if (ex instanceof IdleTimeoutException) {
      // operation timeout handling - SCMP Version request
      fault = new SCMPMessageFault(scmpVersion, SCMPError.OPERATION_TIMEOUT, "Operation timeout expired on SC sid=" + sid);
    } else if (ex instanceof IOException) {
      fault = new SCMPMessageFault(scmpVersion, SCMPError.CONNECTION_EXCEPTION, "broken connection to server sid=" + sid);
    } else {
      fault = new SCMPMessageFault(scmpVersion, SCMPError.SC_ERROR, "error executing " + this.msgType + " sid=" + sid);
    }
    // caching
    SCCache cache = AppContext.getSCCache();
    if (cache.isCacheEnabled() == true) {
      cache.cacheMessage(this.requestMessage, fault);
View Full Code Here

    LOGGER.warn("receive exception sid=" + sid + " " + ex.toString());
    SCMPMessage fault = null;
    SCMPVersion scmpVersion = reqMessage.getSCMPVersion();
    if (ex instanceof IdleTimeoutException) {
      // operation timeout handling - SCMP Version request
      fault = new SCMPMessageFault(scmpVersion, SCMPError.OPERATION_TIMEOUT, "Operation timeout expired on SC sid=" + sid);
    } else if (ex instanceof IOException) {
      fault = new SCMPMessageFault(scmpVersion, SCMPError.CONNECTION_EXCEPTION, "broken connection on SC sid=" + sid);
    } else if (ex instanceof InvalidMaskLengthException) {
      fault = new SCMPMessageFault(scmpVersion, SCMPError.HV_WRONG_MASK, ex.getMessage() + " sid=" + sid);
    } else {
      fault = new SCMPMessageFault(scmpVersion, SCMPError.SC_ERROR, "executing " + this.msgType + " failed sid=" + sid);
    }
    fault.setSessionId(this.request.getMessage().getSessionId());
    String serviceName = reqMessage.getServiceName();
    // forward server reply to client
    fault.setIsReply(true);
View Full Code Here

TOP

Related Classes of org.serviceconnector.scmp.SCMPMessageFault

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.