douchen7555 2011-12-12 11:53
浏览 99
已采纳

调用第三方Web服务的有效方式

I currently using Google Places API for retrieving information for in a mobile application(iOS and Android).

Now my problem is how to design my application so that my application code remains immune to any changes in URL structure from google or any 3rd party service.

Currently Google requires us to use a URL structure like this:

https://maps.googleapis.com/maps/api/place/search/output?parameters

Now suppose if I have embedded this URL into my code and Google changes this URL or I decide to use some other service, then it would need to modify my code again once it is in production.

Is it possible to do this in some other way, so that my application code can remain immune to any such changes.

I am also streaming and loading some stuff into my application via my own server via PHP. So would it be a good idea to send the request for information first to my server, then fetch those details from google's server and return them back to my code in the form required by it.

Diagrammatically Explaining

Earlier I was doing this

My Application -> Request to Google's Server -> Response from Google's Server-> To My app

Now, I am thinking of this structure

My Application-> Request to my server with required parameters -> Request to Google's server or whatever 3rd party places API I want to use -> Response to my server -> to my app in required form.

I know that this approach will add delays to the response but it would let the control in my hands. And also, I could use the same server side script on multiple platforms.

Is there a better way ?

  • 写回答

2条回答 默认 最新

  • douchen2595 2011-12-12 13:15
    关注

    What about implementing your solution but with a one-time call when the application loads? In other words you would have some kind of registration/login communication when the application starts and download the string/protocol for those requests. This way you can still have fairly good performance once you establish what format you are using for the requests.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址
  • ¥15 elmos524.33 eeprom的读写问题
  • ¥15 使用Java milo连接Kepserver服务端报错?
  • ¥15 用ADS设计一款的射频功率放大器
  • ¥15 怎么求交点连线的理论解?
  • ¥20 软件开发方法学习来了
  • ¥15 微信小程序商城如何实现多商户收款 平台分润抽成
  • ¥15 HC32L176调试了一个通过TIMER5+DMA驱动WS2812B
  • ¥15 cocos的js代码调用wx.createUseInfoButton问题!