• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

can we use HttpClient.execute(httpGet) to insert data

 
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to know can we use HttpClient.execute(httpGet) to insert data.
because below code doesn't work for me.Also it doesn't give any exception too.



when i debug the code it stop the below line .It doesn't return anything.

HttpResponse response = client.execute(httpGet);
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And by "insert data" you mean...
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am calling web service method which insert data to database table.
 
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read up on the HTTP methods GET,PUT,POST (just those for now) to find out the differences between them and which one to use for which tasks.
Also, you should urlencode your request url in case there are special parameters.
You should also test your service via simple tools like a web browser to determine that the server is reachable and the services available.
Then you should verify that the environment running your Java client can connect to the server with the services.
 
Marshal
Posts: 28295
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sam liyanage wrote:when i debug the code it stop the below line .It doesn't return anything.



So what does that mean? Does the code hang? Is an ignored exception thrown?
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Armitage

I tried with below in url.Then its working fine.Data inserting to the database.



Code doesn't go.Its hand and no output or any exception.


Then i change the code to below




when i debug it also stuck in below line and not insert data to the database.

HttpResponse response = httpclient.execute(httppost);
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have a try but what happens in the catch of that try? Also read all parts of all the replies you are getting. Don't jyst handpick what you think is important. All of it is very important.
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting below in the Logcat



I am using WSO2 DSS server to create Web services.It uses Axis2 in the back end to generate Web Services.Anyway i don't know why it gives me this error?
 
Oh. Hi guys! Look at this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic