Q: 10
HOTSPOT You create a 'Contoso Post" procedure to send an http POST request in JSON format. You publish the procedure to your environment. You write the following procedure code:
The procedure does not work as expected. You need to find and fix all errors in HTTP class usage. For each of the following statements, select Yes if the statement is true. Otherwise, select No. NOTE: Each correct selection is worth one point.
Your Answer
Discussion
Yep that matches the official pattern. Yes, Yes, No.
Should line 16 actually be ResponseMessage.Content.ReadAs(ResponseText)? Not sure if ReadAs used directly on ResponseMessage ever works in AL. Anyone seen this behave differently?
Makes a difference if you know that
ReadAs isn't on the HttpResponseMessage itself. No for line 16.Bit of an edge case here: if they specified a custom response object that had ReadAs directly, line 16 would be Yes. With standard AL though, it's Yes, Yes, No.
Yes for line 10 and line 11, No for line 16. WriteFrom and GetHeaders are used right in the AL HTTP classes, but ReadAs can't be called straight off ResponseMessage. That's usually where people get tripped up if coming from a C# background.
If the response variable was already the content, would ReadAs work on line 16? I think it's only a problem if you skip ResponseMessage.Content, right?
Wasn't this in a mock recently? It's Yes for line 10 and 11, No for line 16.
Yes, Yes, No. Had something like this in a mock and that's how it was keyed.
Yes, Yes, No. Official docs and practice questions always treat ReadAs as a method on the content, not the response. If you want to be sure for exam day, reviewing some real AL HTTP class code samples helps a ton.
Official docs and lab walkthroughs back this answer: Yes, Yes, No.
Be respectful. No spam.