12.1 WebHandler error

Posted by Darren Parr on 21-Feb-2020 23:15

Hi

Any idea why oJSON = CAST(poRequest:Entity,JsonObject).  errors with "invalid cast from memptr to jsonobject etc". Its defintely valid json. Ive tested it in firefox. Its a PUT. On inspection it looks like the memptr object is empty. It has size 0 etc.

Content-Type is "application/json".

Response Headers

HTTP/1.1 500 500
Date: Fri, 21 Feb 2020 23:08:16 GMT
Server: Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.3.11
Access-Control-Allow-Origin: http://localhost
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: X-Client-Context-Id, Cache-Control, Expires, Last-Modified, Pragma, Content-Language, Content-Type
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-XSS-Protection: 1; mode=block
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Content-Type: application/json
Connection: close
Transfer-Encoding: chunked

Request Headers

Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0
Accept: application/json
Accept-Language: en-GB,en;q=0.5
Accept-Encoding: gzip, deflate
X-Requested-With: XMLHttpRequest
Connection: keep-alive
Referer: http://localhost/v12/
Cookie: GUID_8888=jSNHAEmpmQqqyiqJ30a5; JSESSIONID=71461B422644E2A6010872950F81E1457DA05553F0AE.V12PAS; OEMSESSIONID_9443=726b401d-a6e3-42a1-a78f-3a0dcde57717
Content-Length: 127
Origin: http://localhost
Pragma: no-cache
Cache-Control: no-cache

HTH

Darren

All Replies

Posted by Peter Judge on 22-Feb-2020 03:30

I wonder whether it has to do with the fact that the request has no Content-type header.
 
The OE.Web.WebRequest uses the internal IS-JSON attribute to decide whether to read JSON from the input steam of the form-long-infput (se github.com/.../WebRequest.cls) .
 
I believe that that value is set to true based on the incoming Content-Type.
 
 
 

Posted by Darren Parr on 24-Feb-2020 09:24

Thanks. I’ll add it manually in Firefox and see what happens.

This thread is closed