Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
sam liya
Ranch Hand
Posts: 1246
  • Mark post as helpful
  • send pies
  • 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);
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And by "insert data" you mean...
 
sam liya
Ranch Hand
Posts: 1246
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am calling web service method which insert data to database table.
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • 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.
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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?
 
sam liya
Ranch Hand
Posts: 1246
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
sam liya
Ranch Hand
Posts: 1246
  • Mark post as helpful
  • send pies
  • 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?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!