Android Question Simple intructions to urlencode and decode with httputils

simon w

Member
Licensed User
Longtime User
Hi,
I know this has been asked and answered in bits and pieces . i"m a nubie to basic4android.

what i"m trying to do is call a webservice

http://server1/INVC/Default.aspx?component=BU-042BLK

and get back a list which will be displayed.

result string looks like this
[{"Location":"I19A"},{"Location":"I19C"},{"Location":"I19D"},{"Location":"G9B"}]

this servicce is running on server 2003 tested from multiple computers

i"m lost

i created a basic layout with an edit text box (to enter part number)
a button to sent the HTTP request
a button to clear results(for new query
and a list view to display the the results


can someone please guide me the appropriate steps to take to get this to work

thanks a million,
Simon
 

simon w

Member
Licensed User
Longtime User
thank you for your response.
this is code i have so far.
#Region Project Attributes
#ApplicationLabel:Get Locations
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region

Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Server1 As String
Server1="http://server1/INVC/Default.aspx"
Dim Label1 As Label
Dim ListView1 As ListView
Dim txtPartNumber As EditText
Dim btnGetLocatiions As Button
Dim GetLocations As HttpJob
Dim btnClearData As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Main")
GetLocations.Initialize("GetLocation",Me)
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub JobDone (Job As HttpJob)
Msgbox(Job.ErrorMessage,"Error Message")
End Sub
Sub btnGetLocatiions_Click
If txtPartNumber.Text = "" Then
Msgbox("No Part Entered","Warning")
Return
End If
GetLocations.Download2(Server1, Array As String("component", txtPartNumber.Text))
End Sub
Sub btnClearData_Click
txtPartNumber.Text=""
ListView1.Clear
End Sub

i get this error in job done
java.net.UnknownHostException: Unable to resolve host "server1": No address associated with hostname
how can i see the actual string Download2 is sending?


Thank you for your time
 
Upvote 0

simon w

Member
Licensed User
Longtime User
thanks for your quick response.
you were correct in pointing that out. it seems like it is DNS issue.
so i used the ip of server instead of server name. that ẃorked on device browser.
i tried in app works as well.

is there a limit to the number of times i can call .Download2 ?

once again i appreciate your time and effort in helping me!!!
thank you!
 
Upvote 0

simon w

Member
Licensed User
Longtime User
Sorry for not replying sooner .i was away for the holiday.
i want to thank you for your excellent help.
 
Upvote 0
Top