Android Question HttpUtils2 / XMLRPC

Discussion in 'Android Questions' started by MarcoRome, Jul 17, 2015.

  1. MarcoRome

    MarcoRome Expert Licensed User

    Hi all. I try traslate this code in pyton:

    DEV_KEY = 'RwYtcwQz85DUpn6FPQCU7ImB2MBM8Dfl'

    s1 = 
    s2 = Server('')

    token = s1.autenticazione.Accedi(DEV_KEY, 

    res = s2.paline.Previsioni(token, 
    '70101', 'it')
    i have in main this code:

    Dim bus As busromaclass
    and in my class busromaclass i have this code:

    Public Sub Initialize(password As String)
    Dim job1 As HttpJob
    "MyJob", Me)
    "autenticazione.Accedi"Array As String(password, ""))

    End Sub

    Private Sub JobDone(job As HttpJob)

    If job.Success Then
    Dim res As String
            res = job.GetString
    Log("Response from server: " & res)
    ToastMessageShow("Error: " & job.ErrorMessage, True)
    End If
    End Sub
    No errors, Sub Initialize work without problem but finish there.
    He does not come in JobDone.
    ( In attachment source )
    Any idea ?
    Thank you all

    Attached Files:

    Last edited: Jul 17, 2015
    ArminKH likes this.
  2. ArminKH

    ArminKH Well-Known Member

    jobdone raised for me without any error and all things are perfect
    what u mean?
    MarcoRome likes this.
  3. MarcoRome

    MarcoRome Expert Licensed User

    already... i dont know for now. But i think that i wrong. I hope that one master response. I continue to study for solution
    ArminKH likes this.
  4. ArminKH

    ArminKH Well-Known Member

    maybe you need to update your libraries
  5. MarcoRome

    MarcoRome Expert Licensed User

    okHttp 1.00 --> V1.00 - Adds support for digest authentication.
    I dont think that is this
    ArminKH likes this.
  6. Erel

    Erel Administrator Staff Member Licensed User

    See this warning:

  7. MarcoRome

    MarcoRome Expert Licensed User

    Thank you Erel for your response.
    Yes i see already, but i dont see another way.
    I will like understand as this code can traslate in B4A.
  8. DonManfred

    DonManfred Expert Licensed User

    You you have any developer-documentation about their protocol? In english?
    I dont know python
  9. MarcoRome

    MarcoRome Expert Licensed User

    Hi dear DonMandred dont exist in english. But i traslate for you.

    The following example shows how 
    to authenticate with the API Getting around Rome (you must have a key developer), and invoke a method. You can simply paste the code below into a Python shell, after the necessary amendments to variable DEV_KEY.
    2 Python import
      from xmlrpclib import 
    except ImportError:
    3 Python import
      from xmlrpc.client import 

    from pprint import pprint

    DEV_KEY = 
    'Insert your key'

    s1 = 
    Server ('')
    s2 = Server ('')

    token = s1.autenticazione.Accedi (DEV_KEY, 

    res = s2.paline.Previsioni (token, 
    '70101', 'en')
    pprint (res)

    Other languages
    The use of the API 
    in other languages is similar to the case of Python. You need to download a library XML-RPC for its language and to study the documentation.
    Developers are invited 
    to share code samples in different programming languages.
    The Key is: RwYtcwQz85DUpn6FPQCU7ImB2MBM8Dfl

    Now i'm already try with THIS LIBRARY and work only if you have 1 parameter:

    Sub Globals
    'These global variables will be redeclared each time the activity is created.
        'These variables can only be accessed from this module.
        Dim XMLRPC1 As XMLRPC

    End Sub

    Sub Activity_Create(FirstTime As Boolean)
    If FirstTime Then
    End If
    'Get Token
    Dim vedi As String = XMLRPC1.objectCall2("autenticazione.Accedi","QCOT7MBQwaC8dQI3BcVEC58kTCeriOOi","")
    Log(vedi) '<---- Return Token

    'Get Palina Value
    Dim previsioni As Object  = XMLRPC2.objectCall3("paline.Previsioni",vedi,70101,"")
    Log(previsioni) ' i wait that here return value
    The first result is ok (XMLRPC1 ), come back token without problem.
    The second result (XMLRPC2 ) dont work
    in Log Previsioni i have this result:
    {id_richiesta=11d4dc1182cc01abde46f3a23c362914, risposta={primi_per_palina=[Ljava.lang.Object;@41b52ac0, arrivi=[Ljava.lang.Object;@41b50fd0, nome=LGT GIANICOLENSE/REGINA COELI, collocazione=LTV GIANICOLENSE, 70 M. PRIMA SBOCCO PONTE MAZZINI}}

    in another cases Erel response that is possible connect with web service with Http Library
    example HERE

    But i dont undestand ....
  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