Example #1
0
    @Override
    public T invokeClient(
        String theResponseMimeType,
        Reader theResponseReader,
        int theResponseStatusCode,
        Map<String, List<String>> theHeaders)
        throws IOException, BaseServerResponseException {
      EncodingEnum respType = EncodingEnum.forContentType(theResponseMimeType);
      if (respType == null) {
        throw NonFhirResponseException.newInstance(
            theResponseStatusCode, theResponseMimeType, theResponseReader);
      }
      IParser parser = respType.newParser(myContext);
      T retVal = parser.parseResource(myType, theResponseReader);

      if (myId != null) {
        retVal.setId(myId);
      }

      MethodUtil.parseClientRequestResourceHeaders(theHeaders, retVal);

      return retVal;
    }
Example #2
0
    @Override
    public OperationOutcome invokeClient(
        String theResponseMimeType,
        Reader theResponseReader,
        int theResponseStatusCode,
        Map<String, List<String>> theHeaders)
        throws IOException, BaseServerResponseException {
      EncodingEnum respType = EncodingEnum.forContentType(theResponseMimeType);
      if (respType == null) {
        return null;
      }
      IParser parser = respType.newParser(myContext);
      OperationOutcome retVal;
      try {
        retVal = parser.parseResource(OperationOutcome.class, theResponseReader);
      } catch (DataFormatException e) {
        ourLog.warn("Failed to parse OperationOutcome response", e);
        return null;
      }
      MethodUtil.parseClientRequestResourceHeaders(theHeaders, retVal);

      return retVal;
    }