You need to sign in to do that
Don't have an account?
Gautam_Kasukhela
Illegal character(s) in message header
Hello All,
I am facing a Callout exception which says " Illegal character(s) in message header value:
{"HEADER": {"APPLICATION-ID": "APP-0000010120", "CUST-ID": "P/001N000000p35DTIAY","REQUEST-TYPE": "REQUEST","REQUEST-TIME":"08092016 16:15:11"},"REQUEST": {"03":"PERSONAL LOAN","04":"421000","07":"DIRECT","11":"QA/UAT","21": {"01":"A B C"},"22":"MALE","27":"02091992","29":[ {"01":"RESIDENCE","03":"543543544","04":"Bihupuria","06":"Assam","05":"435435"}],"30":{"01":"YHGPS7560W"},"31":[{"01": "MOBILE","02":"9664561852"}],"36":"456465465464"}}
"
I have set the header if the request as follows:-
httpReq.setHeader('inputJson_',jsonRequestBody);
In the 'jsonRequestBody', I have set the content that is show above in curly braces.
Strange thing is that, if I use the same header value through a REST client (Postman), it works fine. From within Apex, I get the above mentioned issue. Can anyone let me know what is wrong here?
Regards,
Gautam.
I am facing a Callout exception which says " Illegal character(s) in message header value:
{"HEADER": {"APPLICATION-ID": "APP-0000010120", "CUST-ID": "P/001N000000p35DTIAY","REQUEST-TYPE": "REQUEST","REQUEST-TIME":"08092016 16:15:11"},"REQUEST": {"03":"PERSONAL LOAN","04":"421000","07":"DIRECT","11":"QA/UAT","21": {"01":"A B C"},"22":"MALE","27":"02091992","29":[ {"01":"RESIDENCE","03":"543543544","04":"Bihupuria","06":"Assam","05":"435435"}],"30":{"01":"YHGPS7560W"},"31":[{"01": "MOBILE","02":"9664561852"}],"36":"456465465464"}}
"
I have set the header if the request as follows:-
httpReq.setHeader('inputJson_',jsonRequestBody);
In the 'jsonRequestBody', I have set the content that is show above in curly braces.
Strange thing is that, if I use the same header value through a REST client (Postman), it works fine. From within Apex, I get the above mentioned issue. Can anyone let me know what is wrong here?
Regards,
Gautam.
Regards,
Gautam.
All Answers
Issue might be ( / ) of this char. try to omit this char from your JSON
Thanks
Karthik
I have tried by removing '/' and ':' (colon) but it did not help. It still shows the same error.
Regards,
Gautam.
Before sending request encode you JSON string using like this.
String myBase64String = EncodingUtil.base64Encode(Blob.valueof(myString));
its may help you.
Thanks
karthik
Regards,
Gautam.