Package org.serviceconnector.scmp

Examples of org.serviceconnector.scmp.SCMPMessageFault


      httpCon = (HttpURLConnection) url.openConnection();
      httpCon.connect();
      in = httpCon.getInputStream();
    } catch (Exception e) {
      // SCMP Version request
      SCMPMessageFault fault = new SCMPMessageFault(reqMessage.getSCMPVersion(), 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 - SCMP Version request
        reply = new SCMPMessage(reqMessage.getSCMPVersion());
        reply.setBody(new byte[0]);
        in.close();
        httpCon.disconnect();
        return reply;
      }
      // set up part request, no poll request - SCMP Version request
      reply = new SCMPMessage(reqMessage.getSCMPVersion());
      reply.setBody(fullBuffer, 0, readBytes);
      return reply;
    } catch (Exception e) {
      // SCMP Version request
      SCMPMessageFault fault = new SCMPMessageFault(reqMessage.getSCMPVersion(), e, SCMPError.SERVER_ERROR);
      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(SCMPVersion.LOWEST, SCMPError.SC_ERROR, th.getMessage());
    fault.setMessageType(SCMPMsgType.UNDEFINED);
    response.setSCMP(fault);
    response.write();
  }
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.