Hi Ayush! In the error message, is the last tic part of the header? What is exactly the Content-Type header? Can you repeat the request over the command line or postman interface and send us the verbose result?
Thanks! On Thu, 28 Feb 2019, 13:25 Ayush Dixit, <ayush.di...@sigma-systems.com> wrote: > Hi, > > We are getting an exception from client side when we are returning a > response it is getting the below error we have used the camel restlet. We > are not able to get the exact reason of this error. Kind help us to > identify the exact cause of this error. > > Getting below error at server side > > > ERROR MSM: ht_error: 0: --> > + Bad HTTP header encountered, token = Content-type: application/xml; > charset=UT > + F-8' > > > Please find below the code > public class OrderResponseProcessor implements Processor { > > /** The Constant LOGGER. */ > private static final Logger LOGGER = LoggerFactory > .getLogger(OrderResponseProcessor.class.getName()); > private static final Map<String, String> successMap; > > static { > successMap = > IcomsCustomErrorHandling.getErrorMap(TranslatorConstants.SUCCESS_KEY.value()); > } > > /* > * (non-Javadoc) > * > * @see org.apache.camel.Processor#process(org.apache.camel.Exchange) > */ > @Override > public void process(Exchange exchange) throws HZNException { > try { > final String orderRes = exchange.getIn().getBody(String.class); > final OrderResponse orderResponse = (OrderResponse) > XmlUtil.getInstance().toObject(orderRes, > OrderResponse.class); > String response = ""; > if (orderResponse != null) { > if ("OK".equalsIgnoreCase(orderResponse.getStatus())) { > response = getSuccessMsg(orderResponse.getOrderId()); > } else { > String orderId = orderResponse.getOrderId(); > String extId = > exchange.getIn().getHeader(TranslatorConstants.EXT_KEY.value(), > String.class); > String ordExtMsg = > String.format(TranslatorConstants.ORD_EXT_MSG.value(), extId, orderId); > if > (orderResponse.getError().get(0).getMessage().equalsIgnoreCase(ordExtMsg)) { > response = getSuccessMsg(orderId); > } else { > throw new HZNException("", > orderResponse.getError().get(0).getMessage()); > } > } > } > exchange.getIn().setBody(response); > } catch (Exception e) { > LOGGER.error("Exception in OrderResponseProcessor :- {}", e); > final Map<String, String> errorMap = IcomsCustomErrorHandling > .getErrorMap(TranslatorConstants.FAIL_KEY.value()); > final String errorCode = > IcomsCustomErrorHandling.getValue(TranslatorConstants.ERR_CD.value(), > errorMap); > final String errorMsg = > IcomsCustomErrorHandling.getValue(TranslatorConstants.ERR_MSG.value(), > errorMap); > throw new HZNException(errorCode, errorMsg + e.getMessage()); > } > > } > > public final String getSuccessMsg(String orderId) throws HZNException { > String successMsg = CommonUtil.INSTANCE.getIIPrspnsResponse( > > IcomsCustomErrorHandling.getValue(TranslatorConstants.ERR_CD.value(), > successMap), > > IcomsCustomErrorHandling.getValue(TranslatorConstants.ERR_MSG.value(), > successMap) + orderId); > return successMsg; > } > > } > > > Many Thanks > Ayush >