我是webservices的新手,正在尝试使用RestTemplate编写RESTFul webservice的客户端。 我正在使用org.springframework.http.converter.xml.MarshallingHttpMessageConverter作为消息转换器和org.springframework.oxm.xstream.XStreamMarshaller作为marshaller。
是否有其他方法可以进一步调试或找出此问题的根本原因?
我的消费者类看起来像这样 -
@SuppressWarnings("unchecked")
public List<Deal> getClientInformation() throws RestClientException {
return restTemplate.getForObject(webServiceURL, List.class);
}
异常:
Exception in thread "main" org.springframework.web.client.ResourceAccessException: I/O error: Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:359)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:307)
at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:177)
at main.java.com.sample.consumer.DealConsumer.getClientInformation(Consumer.java:35)
at main.java.com.client.WebserviceConsumerTestClient.main(WebserviceConsumerTestClient.java:16)
Caused by: java.net.ConnectException: Connection refused: connect at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:359)
由于java.net.ConnectException:连接拒绝:连接失败,导致错误发生。在org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:359)处发生。