Hello,
I need to call an MVC web method posting a json string.
To call the service I use the the following code:
As result I get False from j.Success and when I try to log the result using j.GetString I get an internal server error because of missing right content type.
So how may I set the ContentType "application/json;utf-8" ?
Fabrizio.
I need to call an MVC web method posting a json string.
To call the service I use the the following code:
B4X:
Dim ticket As Map
Dim p As Map
ticket.Initialize
ticket.Put("id",Main.id)
ticket.Put("user",Main.idOperatore)
ticket.Put("ticketsList",Main.tickets)
Dim jp As JSONGenerator
jp.Initialize(ticket)
Dim data As String = jp.ToString
Dim j As HttpJob
j.Initialize("", Me)
j.PostString("http://"&servletip&"/lvwebapi/SetTicket",data )
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
connection_Error = 0
Dim res As String
res = j.GetString
Else
connection_Error = 1
Log(j.GetString)
End If
j.Release
As result I get False from j.Success and when I try to log the result using j.GetString I get an internal server error because of missing right content type.
So how may I set the ContentType "application/json;utf-8" ?
Fabrizio.