Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Like ZapierPolling,How to fetch newly updated data from REST API Endpoints and response is XML -JAVA

 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have couple of rest api endpoints,which response is XML,like zapier i need to poll (calling the api endpoints @ every 15min) each 15 min data will change from server endpoints..,i need to fetch new data from that server...
so sort and simple i need to poll every 15min to rest api endpoint from that i need newly updated data.?

please tell me the hint how to achieve this using java.. am very blank give the some clues or ideas that how to achieve this.
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What, exactly is the problem - calling the WS every 15 minutes? If so, the java.util.Timer and TimerTask classes can help with that. If the problem is something else, tell us in detail what that is.
 
Durga Roobini
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:What, exactly is the problem - calling the WS every 15 minutes? If so, the java.util.Timer and TimerTask classes can help with that. If the problem is something else, tell us in detail what that is.




Thanks for the reply.but not the issue in my case timer and thread already included in my topic. my problem is .. for eg i call one of the rest endpoint and it gives xml responses like this

<parent>
<root>
<a>apple</a>
<b>100</b>
</root>
</parent>


after 15 min using thread i call same end point again so now i receive xml responses like..

<parent>
<root>
<a>apple</a>
<b>100</b>
</root>

<root>
<a>orange</a>
<b>150</b>
</root>

</parent>

so in runtime my thread run in evry 15 minutes but i need to fetch only new data which it was highlighted above. so i need the orange nodelist from the xml response

how can i achieve this?




 
Ulf Dittmer
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you need to keep track of which items you received already, and ignore those during processing of subsequent rounds. Maybe store them in some kind of collection; Set or Map could be appropriate, depending on what you need to store.
 
You get good luck from rubbing the belly of a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic