0

I am making an apex callout to external system using HttpRequest. I am getting a

common.apex.runtime.impl.ExecutionException: Unexpected character ('\u003C' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at input location 
[1,2]"|0x3f13b14b

when making the callout and I do not know why this error is occuring. Any insight to this problem?

Here is a debug information I get:

10:55:06.0 (638787581)|CALLOUT_REQUEST|[43]|System.HttpRequest[Endpoint=https://xyz, Method=GET]
10:55:06.0 (686402163)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:623
10:55:06.0 (686488894)|CALLOUT_RESPONSE|[43]|System.HttpResponse[Status=Service Temporarily Unavailable, StatusCode=503]
10:55:06.0 (686505921)|HEAP_ALLOCATE|[43]|Bytes:443
10:55:06.0 (686523664)|VARIABLE_SCOPE_BEGIN|[43]|res|System.HttpResponse|true|false
10:55:06.0 (686567999)|VARIABLE_ASSIGNMENT|[43]|res|"System.HttpResponse[Status=Service Temporarily Unavailable, StatusCode=503]"|0x1bc0960b
10:55:06.0 (686573201)|STATEMENT_EXECUTE|[45]
10:55:06.0 (686585135)|METHOD_EXIT|[61]|01p5C00000010jE|MyClass.sendRequest(Xys__c)
10:55:06.0 (686652412)|HEAP_ALLOCATE|[61]|Bytes:408
10:55:06.0 (686737328)|HEAP_ALLOCATE|[61]|Bytes:24
10:55:06.0 (686751044)|SYSTEM_METHOD_ENTRY|[1]|JSON.JSON()
10:55:06.0 (686753711)|STATEMENT_EXECUTE|[1]
10:55:06.0 (686764642)|SYSTEM_METHOD_EXIT|[1]|JSON
10:55:06.0 (686776641)|METHOD_ENTRY|[61]||System.JSON.deserializeUntyped(String)
10:55:06.0 (686978112)|METHOD_EXIT|[61]||System.JSON.deserializeUntyped(String)
10:55:06.0 (687006996)|VARIABLE_SCOPE_BEGIN|[78]|e|Exception|true|false
10:55:06.0 (687046591)|VARIABLE_ASSIGNMENT|[78]|e|"common.apex.runtime.impl.ExecutionException: Unexpected character ('\u003C' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at input location [1,2]"|0x3f13b14b
10:55:06.0 (687051768)|STATEMENT_EXECUTE|[78]
10:55:06.0 (687053234)|STATEMENT_EXECUTE|[79]
10:55:06.0 (687057739)|HEAP_ALLOCATE|[79]|Bytes:7

1 Answer 1

2

You're getting a 503 error, which means the service is not available. The return body is apparently an XML/HTML string instead of a JSON string, so you get an error because the first character the parser runs in to is \u003c ("<"). Check your service provider for more information.

5
  • I suspect the web server is returning a webpage (hence the HTML) along with the 503... which is why he sees that error. I've seen that a lot. Feb 23, 2017 at 16:18
  • Awesome. Thank you so much for quick responses. Appreciate that. One thing I am wondering is the external system is testing using a Tool to hit the endpoint from there end and they are getting a response but from salesforce I get this error. Is there could be any reason that we might get this service unavailable error when hitting from Salesforce?
    – SfdcBat
    Feb 23, 2017 at 16:40
  • @SebastianKessel thanks I appreciate your response. DO you have any comments for my above comment :)
    – SfdcBat
    Feb 23, 2017 at 16:41
  • 3
    @SfdcBat It'd be great if you could include the body of the response in your question; we need to see what's going on to debug this further.
    – sfdcfox
    Feb 23, 2017 at 16:49
  • 1
    Agree with @sfdcfox 100%. We need to see the request and response. Also, If you're getting a 503 (and you are), then the problem is in the destination server, not in SFDC (perhaps it needs to whitelist some IP addresses?). if you were getting a 200, then it would be a different explanation. Feb 23, 2017 at 16:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .