0

I need to add a webservice to my b4a project .. please help me I really don't know how to do it..I've tried the https://www.b4x.com/android/forum/threads/how-call-a-web-services-in-b4a.10577/ and https://www.b4x.com/android/forum/threads/web-service-consume-in-b4a.17446/ but it does'nt work

mari Mir
  • 39
  • 1
  • 7

2 Answers2

0

What is your webservice? (Soap or Restful or XmlRPC)

For soap user https://www.b4x.com/android/forum/threads/soap-is-easier-with-soap-class.56164/#content

For XmlRPC use https://www.b4x.com/android/forum/threads/manage-xmlrpc-with-okhttputils-easily-b4x.82527/#content

For restful use OkHttp also

0

you can use httpjob . add this two libraries to your b4a : Okhttp and okhttputils2 . search b4x forum for httjob examples.

Dim job1 As HttpJob
DIm SoapXML  As String= your xml here
job1.Initialize("Job1", Me)
job1.poststring (webserviceaddress, SoapXML)
job1.GetRequest.SetContentType("text/xml")

you can get result on jobdone event.and parse it using saxxmlparser library

 Sub JobDone (Job As HttpJob)
   If Job.Success = True Then
           parser.Parse(Job.GetInputStream ,"Parser")
       Else
      Log("Error: " & Job.ErrorMessage)
      End If
   Job.Release
End Sub

Sub Parser_EndElement (Uri As String, Name As String, Text As StringBuilder)

 ...
End Sub
Shahram Banazadeh
  • 500
  • 1
  • 5
  • 15