PST*_*PST 11 rest spring client web-services
我是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);
Run Code Online (Sandbox Code Playgroud)
}
例外:
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)
Run Code Online (Sandbox Code Playgroud)
引起:java.net.ConnectException:连接被拒绝:连接org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:359)
dha*_*dra 20
您尝试调用的webServiceURL无法访问.确保webServiceURL路径正确并正在侦听.
PS.还要检查服务器端是否存在防火墙问题.
Wireshark可以帮助您进一步调试.
| 归档时间: |
|
| 查看次数: |
74156 次 |
| 最近记录: |