Rest POST请求在box上成功,但在jenkins中失败
我有一个集成测试,它连接到salesforce,并返回一个身份验证令牌Rest POST请求在box上成功,但在jenkins中失败,rest,post,jenkins,Rest,Post,Jenkins,我有一个集成测试,它连接到salesforce,并返回一个身份验证令牌 public AuthenticationResponse getAuthenticationResponse() { MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>(); map.add("client_id", consumerKey); map.add("cli
public AuthenticationResponse getAuthenticationResponse()
{
MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
map.add("client_id", consumerKey);
map.add("client_secret", consumerSecret);
map.add("grant_type", GRANT_TYPE);
map.add("username", username);
map.add("password", password);
return new RestTemplate().postForObject(LOGIN_URI, map, AuthenticationResponse.class);
}
^这就是测试本身
这在我的、和其他台式机上运行良好。然而,它在jenkins中永远不起作用,总是返回一个400状态代码,后面没有真正的错误消息。在Jenkins中,我需要做些什么来允许向外部站点发送post请求吗?http 400的意思是
错误的请求-无效的URL
或
HTTP错误400。请求主机名无效
请确保可以从jenkins计算机访问目标主机。
尝试登录jenkins机器并运行curl/telnet命令以检查连接。是的,无论出于何种原因,jenkins box无法连接到主机。您可能需要与您的网络团队进行检查以修复它。
public void testConnect(){
AuthenticationResponse response = dataDotComClient.getAuthenticationResponse();
assertNotNull(response);
assertNotNull(response.getAccess_token());
}