I'm trying to post some json data to a web service, but it seems something is wrong and the web service doesn't accept the data.
My code :
And the error from server :
The server uses https so I've changed this line:
But how to set ContentType to application/json ?
My code :
B4X:
Dim job1 As HttpJob
job1.Initialize("Job1", Me)
Dim objMap As Map: objMap.Initialize
objMap.Put("id",123)
objMap.Put("params","XXX,YYY")
objMap.Put("method","apiLogin")
Dim objJSon As JSONGenerator: objJSon.Initialize(objMap)
job1.PostString("https://SITEADDRESS/api/jsonrpc/1_0", objJSon.ToPrettyString(2))
And the error from server :
B4X:
Catchable fatal error: Argument 1 passed to Zend_Json_Server_Request::setOptions() must be an array, null given, called in ...
The server uses https so I've changed this line:
B4X:
hc.InitializeAcceptAll("hc")
But how to set ContentType to application/json ?