aspose file tools*
The moose likes Web Services and the fly likes how to access the data from 3rd party to server and then how i can send that server data to client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "how to access the data from 3rd party to server and then how i can send that server data to client" Watch "how to access the data from 3rd party to server and then how i can send that server data to client" New topic
Author

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

Joined: Dec 04, 2013
Posts: 58
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

Joined: Sep 13, 2007
Posts: 2419
    
    7

Are you doing this java or android since you mentioned emulator and stuff.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

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

Joined: Dec 04, 2013
Posts: 58
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
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

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

Joined: Dec 04, 2013
Posts: 58
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

Joined: Jul 26, 2007
Posts: 10384
    
    8

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 (.) ?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
revathi kurum
Ranch Hand

Joined: Dec 04, 2013
Posts: 58
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

Joined: Dec 04, 2013
Posts: 58
please help this one
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

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?


Swastik
revathi kurum
Ranch Hand

Joined: Dec 04, 2013
Posts: 58
exatly that only

thanks
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

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

Joined: Dec 04, 2013
Posts: 58
In server side code, servlet i am using and client side is phonegap


Thanks
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

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

Joined: Dec 04, 2013
Posts: 58
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

Joined: Jan 08, 2009
Posts: 1477
    
    6

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

Joined: Dec 04, 2013
Posts: 58
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

Joined: Jan 08, 2009
Posts: 1477
    
    6

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

Joined: Dec 04, 2013
Posts: 58
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

Joined: Jan 08, 2009
Posts: 1477
    
    6

Is the 3rd party app a web application? If so, in what format is it expecting the data?
revathi kurum
Ranch Hand

Joined: Dec 04, 2013
Posts: 58
I didn't get please can you tel me briefly
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

By 3rd party app what exactly do you mean? Is it app hosted on some website?
revathi kurum
Ranch Hand

Joined: Dec 04, 2013
Posts: 58
Website(like url)

thanks
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

Do you know about HttpUrlconnection class?


http://docs.oracle.com/javase/7/docs/api/java/net/HttpURLConnection.html
revathi kurum
Ranch Hand

Joined: Dec 04, 2013
Posts: 58
yes i know about that one

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

thanks
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

So, I believe you got the idea what you have to do.
revathi kurum
Ranch Hand

Joined: Dec 04, 2013
Posts: 58
please give me like some sample code

thanks
revathi kurum
Ranch Hand

Joined: Dec 04, 2013
Posts: 58
i am suffering this problem 2 weeks onwards please help

thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41884
    
  63
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.


Ping & DNS - my free Android networking tools app
revathi kurum
Ranch Hand

Joined: Dec 04, 2013
Posts: 58
thanks can you suggest about phonegap
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

Ulf has already pointed out about HttpURLConnection. However you may wish to have a look on the following code snippet.

revathi kurum
Ranch Hand

Joined: Dec 04, 2013
Posts: 58
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

Joined: Jan 08, 2009
Posts: 1477
    
    6

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

Joined: Dec 04, 2013
Posts: 58
I tried android native apis but i can get result thats why i am choosing phonegap

thanks
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

That should not be a genuine cause. What problem are you facing with native calls?
 
jQuery in Action, 2nd edition
 
subject: how to access the data from 3rd party to server and then how i can send that server data to client