[英]How to call a webservice or url from spring 3.x
我真的不知道在春季如何進行此操作。
我有一個URL https://test.payu.in/merchant/postservice.php?form=2
,我必須使用一些參數調用它並使用結果。
如何使用Spring來做?
您可以使用RestTemplate ,它支持mashalling,解組編,可變分辨率等。
例如,您必須執行以下操作:
Map<String, String> vars = new HashMap<String, String>();
vars.put("hotel", "42");
vars.put("booking", "21");
String result =
restTemplate.getForObject("http://example.com/hotels/{hotel}/bookings/{booking}", String.class, vars);
更多信息:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.