camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ayush Dixit <Ayush.Di...@sigma-systems.com>
Subject RE: Getting Error Bad HTTP Error
Date Thu, 28 Feb 2019 17:06:40 GMT
Hi Luiz,



Thanks for responding, If the request returns with below error it works

HTTP/1.1 200 OK

Server: Apache-Coyote/1.1

Date: Wed, 27 Feb 2019 18:13:42 GMT

Content-Type: application/xml

Content-Length: 141



Whereas when the request return response with below header it did not works

Server →Restlet-Framework/2.2.3

Date →Wed, 27 Feb 2019 23:16:05 GMT

Content-type →application/xml; charset=UTF-8

Request-time →2936

Content-length →140



Need to remove the red highlighted content-type.



Many Thanks

Ayush



-----Original Message-----
From: Luiz Eduardo Valmont <valmont@alis-sol.com.br>
Sent: February 28, 2019 4:58 PM
To: users@camel.apache.org
Cc: Sukhada Karhade <Sukhada.Karhade@sigma-systems.com>; Swarup Kulkarni <Swarup.Kulkarni@sigma-systems.com>
Subject: Re: Getting Error Bad HTTP Error



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.Dixit@sigma-systems.com<mailto:Ayush.Dixit@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

>
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message