Hi.
I've been looking for the "PostMultipart Module" for b4i. I couldn't find it, and i decided to modify the subrutine SendMulipartJob of B4A, but after two days of work i cant't fix all the problems.
My target was send a map objet to a WebService (aspx), but i finally create a simple class called KeyValue: (Here the def)
Here is Sub SendMultipartJob edited. The problem is in the last 3 lines.
ERROR:
Parsing code. Error
Error parsing program.
Error description: Syntax error.
Occurred on line: 39
job.GetRequest.
In B4i, set, SetContentType and SetContentEncoding, where are declarated?
I need help to send map to WebService.aspx or to fix the problem in the edited method.
Thanks a lot.
I've been looking for the "PostMultipart Module" for b4i. I couldn't find it, and i decided to modify the subrutine SendMulipartJob of B4A, but after two days of work i cant't fix all the problems.
My target was send a map objet to a WebService (aspx), but i finally create a simple class called KeyValue: (Here the def)
B4X:
'Class module
Sub Class_Globals
Private key As String
Private value As String
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(parKey As String, parValue As String)
key=parKey
value=parValue
End Sub
Public Sub getKey As String
Return key
End Sub
Public Sub getValue As String
Return value
End Sub
Here is Sub SendMultipartJob edited. The problem is in the last 3 lines.
ERROR:
Parsing code. Error
Error parsing program.
Error description: Syntax error.
Occurred on line: 39
job.GetRequest.
In B4i, set, SetContentType and SetContentEncoding, where are declarated?
B4X:
Sub SendMultipartJob (JobName As String, TargetModule As Object, Url As String, Parametros() As KeyValue)
Dim boundary As String
boundary = "---------------------------1461124740692"
Dim stream As OutputStream
stream.InitializeToBytesArray(20)
Dim EOL As String
EOL = Chr(13) & Chr(10) 'CRLF constant matches Android end of line character which is chr(10).
Dim b() As Byte
Dim a As String
If Parametros.Length<>0 Then
For i=0 To Parametros.Length-1
Dim kv As KeyValue
kv=Parametros(i)
Log("key= " & kv.getkey & " value= " & kv.getvalue)
a="--" & boundary & EOL & "Content-Disposition: form-data; name=" & QUOTE & kv.getkey & QUOTE & EOL & EOL & kv.getvalue & EOL
b = a.GetBytes("UTF8")
stream.WriteBytes(b, 0, b.Length)
Next
End If
a=EOL & "--" & boundary & "--" & EOL
b = a.GetBytes("UTF8")
stream.WriteBytes(b, 0, b.Length)
b = stream.ToBytesArray
Dim job As HttpJob
job.Initialize(JobName, TargetModule)
job.PostBytes(Url, b)
job.GetRequest.set
job.GetRequest.SetContentType("multipart/form-data; boundary=" & boundary)
job.GetRequest.SetContentEncoding("UTF8")
End Sub
I need help to send map to WebService.aspx or to fix the problem in the edited method.
Thanks a lot.