iOS Question PostMultipart.SendMultipartJob

Discussion in 'iOS Questions' started by Rokiu86, Apr 1, 2015.

  1. Rokiu86

    Rokiu86 Member Licensed User


    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)

    '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)
    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.

    Parsing code. Error
    Error parsing program.
    Error description: Syntax error.
    Occurred on line: 39

    In B4i, set, SetContentType and SetContentEncoding, where are declarated?

    Sub SendMultipartJob (JobName As String, TargetModule As Object, Url As String, Parametros() As KeyValue)
    Dim boundary As String
       boundary = 
    Dim stream As OutputStream
    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
    Log("key= " & kv.getkey & " value= " & kv.getvalue)  
    "--" & boundary & EOL & "Content-Disposition: form-data; name=" & QUOTE & kv.getkey & QUOTE & EOL & EOL & kv.getvalue & EOL
            b = a.GetBytes(
    0, b.Length)
    End If
       a=EOL & 
    "--" & boundary & "--" & EOL
       b = a.GetBytes(
    0, b.Length)
       b = stream.ToBytesArray
    Dim job As HttpJob
       job.Initialize(JobName, TargetModule)
       job.PostBytes(Url, b)
    "multipart/form-data; boundary=" & boundary)
    End Sub
    I need help to send map to WebService.aspx or to fix the problem in the edited method.

    Thanks a lot.
  2. Erel

    Erel Administrator Staff Member Licensed User

    Moved to the questions forum.

    Make sure to use iHttp v1.01. The correct XML file is attached.

    Attached Files:

  3. Rokiu86

    Rokiu86 Member Licensed User


    ihttp.xml version of the IDE was 1.0.0. I changed it to v.1.0.1!!!!

    But I have the same problem at line:
    When I tip the second "." the IDE don't show me method "set" (see image 1).

    Someone can help me? Maybe another way to connect to WebService(aspx).


    Attached Files:

  4. Erel

    Erel Administrator Staff Member Licensed User

    There is no such method. I don't know where this line came from.
  5. Rokiu86

    Rokiu86 Member Licensed User

    The metod is in the first post, second code block.

    Until you pass me the version ihttp.xml, I had errors on the last three lines of code. Since I changed the ihttp.xml I only have issues on the third line from the end. (job.GetRequest.set) (no count "End sub").

  6. Erel

    Erel Administrator Staff Member Licensed User

    You should delete this line.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice