Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to access the data from 3rd party to server and then how i can send that server data to client

 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi help this one, how to access the data from 3rd party to server side and then how i can send that server data to client side(phonegap working under android) emulator).
 
K. Tsang
Bartender
Posts: 3398
13
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you doing this java or android since you mentioned emulator and stuff.
 
Paul Clapham
Sheriff
Pie
Posts: 20966
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, your server (which we know nothing about) has to access data from another party (which we know nothing about)? You're going to have to provide a little bit more information than that if you want any useful kind of answer.

As for the other part of your question, the process looks like this:

1. Server receives a request from the client.

2. Server goes to this 3rd party site to get the data.

3. Server returns that data, appropriately formatted, to the client.

If you're having trouble with step 2 of the process and you want to continue testing your server, you could temporarily replace it with this:

2. Server uses hard-coded test data which is built into the server.
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul , i mean Andriod through phonegap is the my client, thats why i mentioned Android emulator


1. Server receives a request from the client.

2. Server goes to this 3rd party site to get the data.

3. Server returns that data, appropriately formatted, to the client.

exatly this 3 points i want implement whatever the data i want get from server, that data will be going to client, that server goes to 3rd party site to get the data,

please like this any sample code is there means can help this one!

Thanks Paul
 
Paul Clapham
Sheriff
Pie
Posts: 20966
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, but "get data from server" doesn't have sample code. As I said, you're going to have to provide more information. Like information about how that server allows other applications to get data from it. There's more than one possible way it might do that, you know. Probably more than ten ways. So... information about that server?
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have done server side code but that one correct or i dont know but now my problem suppose complete our server part, coming client side i dont want any coding directly results will come in server side whatever data it is, it is possible like that


Thanks Paul
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
revathi kurum wrote:I have done server side code but that one correct or i dont know but now my problem suppose complete our server part, coming client side i dont want any coding directly results will come in server side whatever data it is, it is possible like that

I read this multiple times and I still cannot understand what you are saying. Could you rephrase please, this time with proper punctuation like commas (,) and full stops (.) ?
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please can you see above comments I have done server side code but that one correct or i don't know, but now my problem is suppose lets take i completed server part, coming client side i don't want any coding directly results will come in server side, it is possible like that

Thanks Maneesh Godbole
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please help this one
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
coming client side i don't want any coding directly results will come in server side. What exactly do you mean by this line? It still looks very confusing, but so far as I understood, your requirement is the client app sends a request to a server side program coded by you. The server side program further communicates with another server, and retrieves some result and then it sends back the result to the client app. Is this what you are looking for?
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
exatly that only

thanks
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably the very next thing what we might need to know is what technology are you using for your server side code? Is it a servlet, or a socket based code or something else, because based on that you have to do your client side code.
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In server side code, servlet i am using and client side is phonegap


Thanks
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, what exact help are you looking for? Do you want some code reference like how the phonegap app connects to servlet?
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for understanding yes i want code reference like phonegap app connects to servlet, one more in servet is get the data from 3rd party site

Thanks Swastik
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Following two links might help you to get an idea about how the phonegap app interacts with servlet

http://catchmayuri.blogspot.in/2013/07/phonegap-login-example-with-jquery-ajax.html

http://stackoverflow.com/questions/19563026/how-to-integrate-phonegapclient-with-servletserver

Now coming to your next question, we need to know how and what are you retrieving from the 3rd party app. Is the 3rd party app a servlet? It would be good if you could please be little more specific about your requirement.
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually first i have 3rd party Api(like eventful) i will xml request through http get it goes to server and server have their own database based on servet it will send the data to client app.

whatever the data of client calls my server data only not 3rd party data

this is my requirement

thanks
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, what difficulty are you facing here? I believe the architecture is not too complex.

1. Phonegap app sends request to your server.
2. Your server sends request to 3rd party app.
3. 3rd party app does the required job and sends the response to your server.
4. Your server sends the response back to the client.
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that is not too complex actually i dont know how will get that one please can you send like that sample reference code

Thanks Swastik
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the 3rd party app a web application? If so, in what format is it expecting the data?
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't get please can you tel me briefly
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By 3rd party app what exactly do you mean? Is it app hosted on some website?
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Website(like url)

thanks
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know about HttpUrlconnection class?


http://docs.oracle.com/javase/7/docs/api/java/net/HttpURLConnection.html
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i know about that one

Url utr= some url
URLConnection uconn = url.openConnection();
HttpURLConnection conn = (HttpURLConnection) uconn;

thanks
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, I believe you got the idea what you have to do.
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please give me like some sample code

thanks
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am suffering this problem 2 weeks onwards please help

thanks
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you just google for "sample code HttpURLConnection" or some such phrase? There must be dozens of introductory articles and blog posts out there.
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks can you suggest about phonegap
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf has already pointed out about HttpURLConnection. However you may wish to have a look on the following code snippet.

 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
about this one k i will takecare of it, how to connect to client phonegap before you send link that is total different, that one not helpful

thanks
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't get the exact thing what you are looking for. But I believe it does give you a basic idea about how phone gap connects to servlet. Just wondering why are you sticking to phonegap. Whats wrong with android native apis? Any specific cause?
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried android native apis but i can get result thats why i am choosing phonegap

thanks
 
Swastik Dey
Rancher
Posts: 1603
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That should not be a genuine cause. What problem are you facing with native calls?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic