httputils

JonPM

Well-Known Member
Licensed User
Longtime User
You are not reading it correctly. You need to download the file and add it to your project.

Sent from my DROIDX
 
Upvote 0

caillaud

Member
Licensed User
Longtime User
thanks for your answer
I understand I have to
1) download
HttpUtilsExample.zip
2)create in my application a service module named httputils
insert in this module
httputils.bas
I did that it does not work
I still miss something

very sincerely
michel
 
Upvote 0

caillaud

Member
Licensed User
Longtime User
thanks for your answers and your patience
something is still wrong:
Error description: Unknown type: httpclient
Dim hc As HttpClient
in the httputlisservice module

sincerely
michel
 
Upvote 0

caillaud

Member
Licensed User
Longtime User
the librarie http is loaded in the project
I get the following error in the httputilsservice:
Compiling code. Error
Error parsing program.
Error description: Syntax error.
Occurred on line: 22
Sub Service_Create

the sub is:
Sub Service_Create
If TempFolder = "" Then
TempFolder = File.DirInternalCache '<-----new
hc.Initialize("hc")
End If
end sub
the next and last sub of the module is:
Sub Service_Start
If httputils.Tasks.IsInitialized = False Then Return '<-----new
taskToRequest.Initialize
finishTasks = 0

End Sub
sincerely
michel
 
Upvote 0

admac231

Active Member
Licensed User
Longtime User
What version of httpUtils do you have? It should say at the top of HttpUtilsService.

My Service_Create sub looks like this:

B4X:
Sub Service_Create
   If init = False Then Process_Globals
   If TempFolder = "" Then TempFolder = File.DirInternalCache
   If hcIsInitialized = False Then
      hc.Initialize("hc")
      hcIsInitialized = True
   End If
End Sub
 
Upvote 0

caillaud

Member
Licensed User
Longtime User
Hi
thanks for your patience:
Version=1.50
I have the same error with the sub service_create you sent as the precedent one:
Compiling code. Error
Error parsing program.
Error description: Syntax error.
Occurred on line: 28
Sub Service_Create
'-------------------------------
I add Dim init As Boolean Process_Globals
'------------------------------
Sub Service_Create
If init = False Then Process_Globals
If TempFolder = "" Then TempFolder = File.DirInternalCache
If hcIsInitialized = False Then
hc.Initialize("hc")
hcIsInitialized = True
End If
End Sub
sincerely
michel
 
Upvote 0

caillaud

Member
Licensed User
Longtime User
Hi
how can I upload the project?
there are 3 modules:
main
httputils
httputilservice
in fact you are right the version seems to be 1.04:
'Version=1.50
'@EndOfDesignText@
'Version 1.04

@EndOfDesignText@
is commented because generating an error
sincerely
michel
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
Your zip only contains the contents of your Files folder, which is your layout file.

You need to go to File > Export as Zip using the B4A 'File' Menu in the program (IDE).


But from what I have seen, you are manually calling the Process_Globals sub? I don't know what doing that may result in but I don't think that sub should be called manually. That sub is basically a place to put your global declarations and is "processed" automatically by default. What all have you got in that sub?

Edit:
And what is on line 28?
 
Last edited:
Upvote 0

caillaud

Member
Licensed User
Longtime User
Hi
thanks very much for your patience
I am just trying to imitate:
http://www.b4x.com/forum/basic4andr...android-ms-sql-server-tutorial.html#post74199
and getting a string from the server
according to your last message I made modifications
please have a look to caillaudhttputilsnew.zip instead the other file

I still get the same error message:
Compiling code. Error
Error parsing program.
Error description: Syntax error.
Occurred on line: 28
Sub Service_Create

sincerely
michel
 

Attachments

  • caillaudhttpultis.zip
    9.2 KB · Views: 294
  • caillaudhttputilsnew.zip
    9.2 KB · Views: 269
Upvote 0

caillaud

Member
Licensed User
Longtime User
Hi
thanks for your answer
sorry I get a new problem in the main module:
-----------------------
Compiling code. Error
Error compiling program.
Error description: Unknown member: poststring
Occurred on line: 23
httputils.PostString("Job1",ServerUrl,"hotelselect")
Word: poststring
----------------------------
the sub is:
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
httputils.CallbackActivity = "Main"
httputils.CallbackJobDoneSub = "JobDone"
End If
httputils.PostString("Job1",ServerUrl,"hotelselect")

End Sub

in httputils module there is a sub called Postsring:
Sub PostString(JobName As String, URL As String, Text As String)
PostBytes(JobName, URL, Text.GetBytes("UTF8"))
End Sub
sincerely
michel
 
Upvote 0

admac231

Active Member
Licensed User
Longtime User
Ok, you had httpUtils as a service module instead of a code module. In future, use Project >> Add Existing Module rather than Project >> Add New Module to avoid this.

I have attached a new copy of your app which compiles fine.
 

Attachments

  • newHotelByNet.zip
    10.3 KB · Views: 298
Upvote 0
Top