Rest 伪造政策<;l7:policyResult状态=";“需要认证”;xmlns:l7=";http://www.layer7tech.com/ws/policy/fault"/&燃气轮机;
当从我的程序调用REST服务时,我得到500个内部服务器错误,但是从SOAPUI调用相同的服务是有效的 我的观察:Rest 伪造政策<;l7:policyResult状态=";“需要认证”;xmlns:l7=";http://www.layer7tech.com/ws/policy/fault"/&燃气轮机;,rest,ssl,https,soapui,apache-httpclient-4.x,Rest,Ssl,Https,Soapui,Apache Httpclient 4.x,当从我的程序调用REST服务时,我得到500个内部服务器错误,但是从SOAPUI调用相同的服务是有效的 我的观察: 使用SOAP UI,我只发送一次请求,但日志显示有两个请求——第一个请求失败,401未经授权;第二个请求添加授权头 使用TestMainOne程序,我试图通过发送两个请求来模拟SOAPUI所做的事情,两次我都得到了500个内部服务器错误,而不是401个 使用TestMainTwo程序,我得到了“身份验证成功”,但也得到了500个内部服务器错误 我的问题 我如何模拟soapui正在做
>“POST/X/Y/052ABC/ServicesDEV HTTP/1.1[\r][\n]”
>>接受编码:gzip,解压缩[\r][\n]
>>“内容类型:application/json;charset=UTF-8[\r][\n]”
>>“内容长度:92[\r][\n]”
>>“主机:Device.test.intranet[\r][\n]”
>>“连接:保持活动状态[\r][\n]”
>>“用户代理:Apache HttpClient/4.1.1(java 1.5)[\r][\n]”
>>“[\r][\n]”
>>“{”有效负载“{”请求“{”进程“{”进程“{”进程ID“}”,项目“{”0“{”进程ID“{”ABC1“}”
“内容长度:92[\r][\n]”
>>“主机:Device.test.intranet[\r][\n]”
>>“连接:保持活动状态[\r][\n]”
>>“用户代理:Apache HttpClient/4.1.1(java 1.5)[\r][\n]”
>>“授权:基本RVNMQ1hHNzpvVnlGUjNFNXMxQU41NnBJTXFOSCE=[\r][\n]”
>>“[\r][\n]”
>>“{”有效负载“{”请求“{”进程“{”进程“{”进程ID“}”,项目“{”0“{”进程ID“{”ABC1“}”
>用户代理:Apache HttpClient/4.5.3(Java/1.8.0_102)
标题:136-http-outgoing-0>>接受编码:gzip,deflate
连线:73-http-outgoing-0>>“POST/X/Y/052ABC/ServicesDEV http/1.1[\r][\n]”
连线:73-http-outing-0>>“内容长度:92[\r][\n]”
连线:73-http-outing-0>>“内容类型:application/json;charset=UTF-8[\r][\n]”
连线:73-http-outgoing-0>>“主机:devint.test.intranet[\r][\n]”
连线:73-http-outing-0>>“连接:保持活动[\r][\n]”
连线:73-http-outing-0>>“用户代理:Apache HttpClient/4.5.3(Java/1.8.0_102)[\r][\n]”
连线:73-http-outing-0>>“接受编码:gzip,放气[\r][\n]”
连线:73-http-outing-0>“[\r][\n]”
连线:87-http-outgoing-0>“{”有效载荷“{”请求“{”进程“{”进程“{”进程“}”,项目“{”0“{”订单ID“{”ABC1“}”
连线:73-http-outing-0>主机:devint.test.intranet
标题:136-http-outgoing-1>>连接:保持活动状态
标题:136-http-outgoing-1>>用户代理:Apache HttpClient/4.5.3(Java/1.8.0_102)
标题:136-http-outgoing-1>>接受编码:gzip,deflate
连线:73-http-outgoing-1>>“POST/X/Y/052ABC/ServicesDEV http/1.1[\r][\n]”
连线:73-http-outgoing-1>>“授权:基本RVNMQ1HHHNZPVVNLGUJNFNXMXQU41NNBJTXFOSCE=[\r][\n]”
连线:73-http-outing-1>>“内容长度:92[\r][\n]”
连线:73-http-outing-1>>“内容类型:application/json;charset=UTF-8[\r][\n]”
连线:73-http-outgoing-1>>“主机:devint.test.intranet[\r][\n]”
连线:73-http-outing-1>>“连接:保持活动[\r][\n]”
连线:73-http-outing-1>>“用户代理:Apache HttpClient/4.5.3(Java/1.8.0_102)[\r][\n]”
连线:73-http-outing-1>>“接受编码:gzip,放气[\r][\n]”
连线:73-http-outing-1>>“[\r][\n]”
连线:87-http-outgoing-1>“{”有效载荷“{”请求“{”进程“{”进程“{”进程“}”,项目“{”0“{”顺序ID“{”ABC1“}”
连线:73-http-outing-1>主机:devint.test.intranet
标题:136-http-outgoing-0>>连接:保持活动状态
标题:136-http-outgoing-0>>用户代理:Apache HttpClient/4.5.3(Java/1.8.0_102)
标题:136-http-outgoing-0>>接受编码:gzip,deflate
标题:136-http-outgoing-0>>授权:基本RVNMQ1hHNzpvVnlGUjNFNXMxQU41NnBJTXFOSCE=
连线:73-http-outgoing-0>>“POST/X/Y/052ABC/ServicesDEV http/1.1[\r][\n]”
连线:73-http-outing-0>>“内容长度:92[\r][\n]”
连线:73-http-outing-0>>“内容类型:application/json;charset=UTF-8[\r][\n]”
连线:73-http-outgoing-0>>“主机:devint.test.intranet[\r][\n]”
连线:73-http-outing-0>>“连接:保持活动[\r][\n]”
连线:73-http-outing-0>>“用户代理:Apache HttpClient/4.5.3(Java/1.8.0_102)[\r][\n]”
连线:73-http-outing-0>>“接受编码:gzip,放气[\r][\n]”
连线:73-http-outgoing-0>>“授权:基本RVNMQ1HHHNZPVVNLGUJNFNXMXQU41NNBJTXFOSCE=[\r][\n]”
连线:73-http-outing-0>“[\r][\n]”
连线:87-http-outgoing-0>“{”有效载荷“{”请求“{”进程“{”进程“{”进程“}”,项目“{”0“{”订单ID“{”ABC1“}”
连线:73-http-OUTING-0您的请求中是否缺少L7策略URL
标题?我不会在任何地方设置它。我认为它带有响应标题。SOAPUI和应用程序日志都显示了这一点。我在尝试连接到partners REST API时遇到了相同的错误。你解决过这个问题吗@vivek4348
>> "POST /X/Y/052ABC/ServicesDEV HTTP/1.1[\r][\n]"
>> "Accept-Encoding: gzip,deflate[\r][\n]"
>> "Content-Type: application/json;charset=UTF-8[\r][\n]"
>> "Content-Length: 92[\r][\n]"
>> "Host: devint.test.intranet[\r][\n]"
>> "Connection: Keep-Alive[\r][\n]"
>> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]"
>> "[\r][\n]"
>> "{"payLoad":{"REQUEST":{"PROCESS_NM":"ORDER_ID"},"ITEMS":{"0":{"ORDER_ID":"ABC1"}}}}"
<< "HTTP/1.1 401 Unauthorized[\r][\n]"
<< "Server: Apache-Coyote/1.1[\r][\n]"
<< "WWW-Authenticate: Basic realm="L7SSGBasicRealm"[\r][\n]"
<< "L7-Policy-URL: https://devint.test.intranet:443/ssg/policy/disco?serviceoid=83f02502063fbaf43344f0c0888e3821[\r][\n]"
<< "Content-Length: 23[\r][\n]"
<< "Date: Wed, 15 Mar 2017 02:17:09 GMT[\r][\n]"
<< "[\r][\n]"
<< "Authentication Required"
>> "POST /X/Y/052ABC/ServicesDEV HTTP/1.1[\r][\n]"
>> "Accept-Encoding: gzip,deflate[\r][\n]"
>> "Content-Type: application/json;charset=UTF-8[\r][\n]"
>> "Content-Length: 92[\r][\n]"
>> "Host: devint.test.intranet[\r][\n]"
>> "Connection: Keep-Alive[\r][\n]"
>> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]"
>> "Authorization: Basic RVNMQ1hHNzpvVnlGUjNFNXMxQU41NnBJTXFOSCE=[\r][\n]"
>> "[\r][\n]"
>> "{"payLoad":{"REQUEST":{"PROCESS_NM":"ORDER_ID"},"ITEMS":{"0":{"ORDER_ID":"ABC1"}}}}"
<< "HTTP/1.1 200 OK[\r][\n]"
<< "Server: Apache-Coyote/1.1[\r][\n]"
<< "Jmscorrelationidasbytes: Camel-ID-NE1ITCDRHAS09-ne1-savvis-net-39938-1486746426315-0-94041[\r][\n]"
<< "Jmstimestamp: 1489544237805[\r][\n]"
<< "Jmsdestination: temp-queue://ID:NE1ITCDRHAS09.ne1.savvis.net-40529-1486746732513-1:914:1[\r][\n]"
<< "Jmsexpiration: 0[\r][\n]"
<< "Jmsdeliverymode: 1[\r][\n]"
<< "Jmsmessageid: ID:NE1ITCDRHAS09.ne1.savvis.net-36391-1489532794035-1:1:1:1:1[\r][\n]"
<< "Jmscorrelationid: Camel-ID-NE1ITCDRHAS09-ne1-savvis-net-39938-1486746426315-0-94041[\r][\n]"
<< "Jmspriority: 4[\r][\n]"
<< "Jmsredelivered: false[\r][\n]"
<< "Content-Encoding: gzip[\r][\n]"
<< "Content-Type: text/plain;charset=UTF-8[\r][\n]"
<< "Content-Length: 495[\r][\n]"
<< "Date: Wed, 15 Mar 2017 02:17:17 GMT[\r][\n]"
<< "[\r][\n]"
<< "<Encrypted Ouyput>"
public class TestMainOne {
private static final String RESPONSE_TYPE_JSON = "application/json;charset=UTF-8";
private static String getTextSearchResults(String restWebServiceURL) {
try {
String jksFile = "C:\\Users\\temp\\Desktop\\Cert\\ABC1-cxg-test2.jks";
String jksFilePassword = "!jkspassword700";
String username = "<username>";
String password = "<password>";
File file = new File(jksFile);
SSLContext sslcontext = SSLContexts.custom()
.loadTrustMaterial(file, jksFilePassword.toCharArray(),
new TrustStrategy() {
public boolean isTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
return true;
}
})
.build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, new String[] { "TLSv1", "TLSv1.1", "TLSv1.2" }, null, NoopHostnameVerifier.INSTANCE);
CloseableHttpClient httpClient = HttpClientBuilder.create().setSSLSocketFactory(sslsf).build();
HttpPost httpPost = new HttpPost(restWebServiceURL);
String requestString = "{\"payLoad\":{\"REQUEST\":{\"PROCESS_NM\":\"GetOrdersHierarchy\"},\"ITEMS\":{\"0\":{\"ORDER_ID\":\"ABC1\"}}}}";
StringEntity entity = new StringEntity(requestString);
entity.setContentType(RESPONSE_TYPE_JSON);
httpPost.setEntity(entity);
HttpResponse response = httpClient.execute(httpPost);
response.setHeader("WWW-Authenticate", "Basic realm=\"L7SSGBasicRealm\"");
System.out.println("Test 4 First Response: " + String.valueOf(response));
byte[] credentialsByte = Base64.encodeBase64((username + ":" + password).getBytes(StandardCharsets.UTF_8));
httpPost.setHeader("Authorization", "Basic " + new String(credentialsByte, StandardCharsets.UTF_8));
response = httpClient.execute(httpPost);
System.out.println("Test 4 Second Response: " + String.valueOf(response));
if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
System.out.println("Error While Calling Web restWebServiceURL: " + restWebServiceURL + " HTTP error code : " + response.getStatusLine().getStatusCode());
throw new RuntimeException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode());
}else{
json = EntityUtils.toString(response.getEntity());
logger.("json: " + json);
}
} catch (Exception e) {
System.out.println("Exception While Calling Web restWebServiceURL: " + restWebServiceURL + ", Exception: " + ExceptionUtils.getStackTrace(e));
}
}
return json;
}
}
RequestAddCookies:123 - CookieSpec selected: default
RequestAuthCache:77 - Auth cache not set in the context
PoolingHttpClientConnectionManager:255 - Connection request: [route: {s}->https://devint.test.intranet:443][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
PoolingHttpClientConnectionManager:288 - Connection leased: [id: 0][route: {s}->https://devint.test.intranet:443][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
MainClientExec:235 - Opening connection {s}->https://devint.test.intranet:443
DefaultHttpClientConnectionOperator:139 - Connecting to devint.test.intranet/155.70.58.219:443
SSLConnectionSocketFactory:337 - Connecting socket to devint.test.intranet/155.70.58.219:443 with timeout 0
SSLConnectionSocketFactory:390 - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2]
SSLConnectionSocketFactory:391 - Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, ... TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
SSLConnectionSocketFactory:395 - Starting handshake
SSLConnectionSocketFactory:425 - Secure session established
SSLConnectionSocketFactory:426 - negotiated protocol: TLSv1.2
SSLConnectionSocketFactory:427 - negotiated cipher suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
SSLConnectionSocketFactory:435 - peer principal: CN=cxg7o.test.centurylink.com, OU=IT, O=CenturyLink, L=Monroe, ST=Louisiana, C=US
SSLConnectionSocketFactory:444 - peer alternative names: [cxg7o.test.centurylink.com, cxg7o.test.qintra.com]
SSLConnectionSocketFactory:448 - issuer principal: CN=Symantec Class 3 Secure Server CA - G4, OU=Symantec Trust Network, O=Symantec Corporation, C=US
DefaultHttpClientConnectionOperator:146 - Connection established 10.1.209.211:65485<->155.70.58.219:443
MainClientExec:256 - Executing request POST /X/Y/052ABC/ServicesDEV HTTP/1.1
MainClientExec:261 - Target auth state: UNCHALLENGED
MainClientExec:267 - Proxy auth state: UNCHALLENGED
headers:133 - http-outgoing-0 >> POST /X/Y/052ABC/ServicesDEV HTTP/1.1
headers:136 - http-outgoing-0 >> Content-Length: 92
headers:136 - http-outgoing-0 >> Content-Type: application/json;charset=UTF-8
headers:136 - http-outgoing-0 >> Host: devint.test.intranet
headers:136 - http-outgoing-0 >> Connection: Keep-Alive
headers:136 - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_102)
headers:136 - http-outgoing-0 >> Accept-Encoding: gzip,deflate
wire:73 - http-outgoing-0 >> "POST /X/Y/052ABC/ServicesDEV HTTP/1.1[\r][\n]"
wire:73 - http-outgoing-0 >> "Content-Length: 92[\r][\n]"
wire:73 - http-outgoing-0 >> "Content-Type: application/json;charset=UTF-8[\r][\n]"
wire:73 - http-outgoing-0 >> "Host: devint.test.intranet[\r][\n]"
wire:73 - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
wire:73 - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_102)[\r][\n]"
wire:73 - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
wire:73 - http-outgoing-0 >> "[\r][\n]"
wire:87 - http-outgoing-0 >> "{"payLoad":{"REQUEST":{"PROCESS_NM":"GetOrdersHierarchy"},"ITEMS":{"0":{"ORDER_ID":"ABC1"}}}}"
wire:73 - http-outgoing-0 << "HTTP/1.1 500 Internal Server Error[\r][\n]"
wire:73 - http-outgoing-0 << "Server: Apache-Coyote/1.1[\r][\n]"
wire:73 - http-outgoing-0 << "L7-Policy-URL: https://devint.test.intranet:443/ssg/policy/disco?serviceoid=83f02502063fbaf43344f0c0888e3821[\r][\n]"
wire:73 - http-outgoing-0 << "Content-Type: text/xml;charset=utf-8[\r][\n]"
wire:73 - http-outgoing-0 << "Content-Length: 582[\r][\n]"
wire:73 - http-outgoing-0 << "Date: Wed, 15 Mar 2017 02:21:38 GMT[\r][\n]"
wire:73 - http-outgoing-0 << "Connection: close[\r][\n]"
wire:73 - http-outgoing-0 << "[\r][\n]"
wire:73 - http-outgoing-0 << "<?xml version="1.0" encoding="UTF-8"?>[\n]"
wire:73 - http-outgoing-0 << "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">[\n]"
wire:73 - http-outgoing-0 << " <soapenv:Body>[\n]"
wire:73 - http-outgoing-0 << " <soapenv:Fault>[\n]"
wire:73 - http-outgoing-0 << " <faultcode>soapenv:Server</faultcode>[\n]"
wire:73 - http-outgoing-0 << " <faultstring>Policy Falsified</faultstring>[\n]"
wire:73 - http-outgoing-0 << " <faultactor>https://devint.test.intranet/X/Y/052ABC/ServicesDEV</faultactor>[\n]"
wire:73 - http-outgoing-0 << " <detail>[\n]"
wire:73 - http-outgoing-0 << " <l7:policyResult status="Authentication Required" xmlns:l7="http://www.layer7tech.com/ws/policy/fault"/>[\n]"
wire:73 - http-outgoing-0 << " </detail>[\n]"
wire:73 - http-outgoing-0 << " </soapenv:Fault>[\n]"
wire:73 - http-outgoing-0 << " </soapenv:Body>[\n]"
wire:73 - http-outgoing-0 << "</soapenv:Envelope>[\n]"
headers:122 - http-outgoing-0 << HTTP/1.1 500 Internal Server Error
headers:125 - http-outgoing-0 << Server: Apache-Coyote/1.1
headers:125 - http-outgoing-0 << L7-Policy-URL: https://devint.test.intranet:443/ssg/policy/disco?serviceoid=83f02502063fbaf43344f0c0888e3821
headers:125 - http-outgoing-0 << Content-Type: text/xml;charset=utf-8
headers:125 - http-outgoing-0 << Content-Length: 582
headers:125 - http-outgoing-0 << Date: Wed, 15 Mar 2017 02:21:38 GMT
headers:125 - http-outgoing-0 << Connection: close
Test 4 First Response: HttpResponseProxy{HTTP/1.1 500 Internal Server Error [Server: Apache-Coyote/1.1, L7-Policy-URL: https://devint.test.intranet:443/ssg/policy/disco?serviceoid=83f02502063fbaf43344f0c0888e3821, Content-Type: text/xml;charset=utf-8, Content-Length: 582, Date: Wed, 15 Mar 2017 02:21:38 GMT, Connection: close, WWW-Authenticate: Basic realm="L7SSGBasicRealm"] ResponseEntityProxy{[Content-Type: text/xml;charset=utf-8,Content-Length: 582,Chunked: false]}}
RequestAddCookies:123 - CookieSpec selected: default
RequestAuthCache:77 - Auth cache not set in the context
PoolingHttpClientConnectionManager:255 - Connection request: [route: {s}->https://devint.test.intranet:443][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
PoolingHttpClientConnectionManager:288 - Connection leased: [id: 1][route: {s}->https://devint.test.intranet:443][total kept alive: 0; route allocated: 2 of 2; total allocated: 2 of 20]
MainClientExec:235 - Opening connection {s}->https://devint.test.intranet:443
DefaultHttpClientConnectionOperator:139 - Connecting to devint.test.intranet/155.70.58.219:443
SSLConnectionSocketFactory:337 - Connecting socket to devint.test.intranet/155.70.58.219:443 with timeout 0
SSLConnectionSocketFactory:390 - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2]
SSLConnectionSocketFactory:391 - Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, ... TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
SSLConnectionSocketFactory:395 - Starting handshake
SSLConnectionSocketFactory:425 - Secure session established
SSLConnectionSocketFactory:426 - negotiated protocol: TLSv1.2
SSLConnectionSocketFactory:427 - negotiated cipher suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
SSLConnectionSocketFactory:435 - peer principal: CN=cxg7o.test.centurylink.com, OU=IT, O=CenturyLink, L=Monroe, ST=Louisiana, C=US
SSLConnectionSocketFactory:444 - peer alternative names: [cxg7o.test.centurylink.com, cxg7o.test.qintra.com]
SSLConnectionSocketFactory:448 - issuer principal: CN=Symantec Class 3 Secure Server CA - G4, OU=Symantec Trust Network, O=Symantec Corporation, C=US
DefaultHttpClientConnectionOperator:146 - Connection established 10.1.209.211:65486<->155.70.58.219:443
MainClientExec:256 - Executing request POST /X/Y/052ABC/ServicesDEV HTTP/1.1
MainClientExec:267 - Proxy auth state: UNCHALLENGED
headers:133 - http-outgoing-1 >> POST /X/Y/052ABC/ServicesDEV HTTP/1.1
headers:136 - http-outgoing-1 >> Authorization: Basic RVNMQ1hHNzpvVnlGUjNFNXMxQU41NnBJTXFOSCE=
headers:136 - http-outgoing-1 >> Content-Length: 92
headers:136 - http-outgoing-1 >> Content-Type: application/json;charset=UTF-8
headers:136 - http-outgoing-1 >> Host: devint.test.intranet
headers:136 - http-outgoing-1 >> Connection: Keep-Alive
headers:136 - http-outgoing-1 >> User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_102)
headers:136 - http-outgoing-1 >> Accept-Encoding: gzip,deflate
wire:73 - http-outgoing-1 >> "POST /X/Y/052ABC/ServicesDEV HTTP/1.1[\r][\n]"
wire:73 - http-outgoing-1 >> "Authorization: Basic RVNMQ1hHNzpvVnlGUjNFNXMxQU41NnBJTXFOSCE=[\r][\n]"
wire:73 - http-outgoing-1 >> "Content-Length: 92[\r][\n]"
wire:73 - http-outgoing-1 >> "Content-Type: application/json;charset=UTF-8[\r][\n]"
wire:73 - http-outgoing-1 >> "Host: devint.test.intranet[\r][\n]"
wire:73 - http-outgoing-1 >> "Connection: Keep-Alive[\r][\n]"
wire:73 - http-outgoing-1 >> "User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_102)[\r][\n]"
wire:73 - http-outgoing-1 >> "Accept-Encoding: gzip,deflate[\r][\n]"
wire:73 - http-outgoing-1 >> "[\r][\n]"
wire:87 - http-outgoing-1 >> "{"payLoad":{"REQUEST":{"PROCESS_NM":"GetOrdersHierarchy"},"ITEMS":{"0":{"ORDER_ID":"ABC1"}}}}"
wire:73 - http-outgoing-1 << "HTTP/1.1 500 Internal Server Error[\r][\n]"
wire:73 - http-outgoing-1 << "Server: Apache-Coyote/1.1[\r][\n]"
wire:73 - http-outgoing-1 << "L7-Policy-URL: https://devint.test.intranet:443/ssg/policy/disco?serviceoid=83f02502063fbaf43344f0c0888e3821[\r][\n]"
wire:73 - http-outgoing-1 << "Content-Type: text/xml;charset=utf-8[\r][\n]"
wire:73 - http-outgoing-1 << "Content-Length: 582[\r][\n]"
wire:73 - http-outgoing-1 << "Date: Wed, 15 Mar 2017 02:21:38 GMT[\r][\n]"
wire:73 - http-outgoing-1 << "Connection: close[\r][\n]"
wire:73 - http-outgoing-1 << "[\r][\n]"
wire:73 - http-outgoing-1 << "<?xml version="1.0" encoding="UTF-8"?>[\n]"
wire:73 - http-outgoing-1 << "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">[\n]"
wire:73 - http-outgoing-1 << " <soapenv:Body>[\n]"
wire:73 - http-outgoing-1 << " <soapenv:Fault>[\n]"
wire:73 - http-outgoing-1 << " <faultcode>soapenv:Server</faultcode>[\n]"
wire:73 - http-outgoing-1 << " <faultstring>Policy Falsified</faultstring>[\n]"
wire:73 - http-outgoing-1 << " <faultactor>https://devint.test.intranet/X/Y/052ABC/ServicesDEV</faultactor>[\n]"
wire:73 - http-outgoing-1 << " <detail>[\n]"
wire:73 - http-outgoing-1 << " <l7:policyResult status="Authentication Required" xmlns:l7="http://www.layer7tech.com/ws/policy/fault"/>[\n]"
wire:73 - http-outgoing-1 << " </detail>[\n]"
wire:73 - http-outgoing-1 << " </soapenv:Fault>[\n]"
wire:73 - http-outgoing-1 << " </soapenv:Body>[\n]"
wire:73 - http-outgoing-1 << "</soapenv:Envelope>[\n]"
headers:122 - http-outgoing-1 << HTTP/1.1 500 Internal Server Error
headers:125 - http-outgoing-1 << Server: Apache-Coyote/1.1
headers:125 - http-outgoing-1 << L7-Policy-URL: https://devint.test.intranet:443/ssg/policy/disco?serviceoid=83f02502063fbaf43344f0c0888e3821
headers:125 - http-outgoing-1 << Content-Type: text/xml;charset=utf-8
headers:125 - http-outgoing-1 << Content-Length: 582
headers:125 - http-outgoing-1 << Date: Wed, 15 Mar 2017 02:21:38 GMT
headers:125 - http-outgoing-1 << Connection: close
Test 4 Second Response: HttpResponseProxy{HTTP/1.1 500 Internal Server Error [Server: Apache-Coyote/1.1, L7-Policy-URL: https://devint.test.intranet:443/ssg/policy/disco?serviceoid=83f02502063fbaf43344f0c0888e3821, Content-Type: text/xml;charset=utf-8, Content-Length: 582, Date: Wed, 15 Mar 2017 02:21:38 GMT, Connection: close] ResponseEntityProxy{[Content-Type: text/xml;charset=utf-8,Content-Length: 582,Chunked: false]}}
Error While Calling Web restWebServiceURL: https://devint.test.intranet/X/Y/052ABC/ServicesDEV HTTP error code : 500
Exception While Calling Web restWebServiceURL: https://devint.test.intranet/X/Y/052ABC/ServicesDEV, Exception: java.lang.RuntimeException: Failed : HTTP error code : 500
at TestMain2.getTextSearchResults(TestMain2.java:132)
at TestMain2.main(TestMain2.java:69)
public class TestMainTwo {
private static final String RESPONSE_TYPE_JSON = "application/json;charset=UTF-8";
private static String getTextSearchResults(String restWebServiceURL) {
String json ="";
try {
String jksFile = "C:\\Users\\temp\\Desktop\\Cert\\ABC1-cxg-test2.jks";
String jksFilePassword = "!jkspassword700";
String username = "<username>";
String password = "<password>";
File file = new File(jksFile);
SSLContext sslcontext = SSLContexts.custom()
.loadTrustMaterial(file, jksFilePassword.toCharArray(),
new TrustStrategy() {
public boolean isTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
return true;
}
})
.build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslcontext, new String[] { "TLSv1", "TLSv1.1", "TLSv1.2" }, null, NoopHostnameVerifier.INSTANCE);
HttpHost target = new HttpHost("devint.test.intranet", 443, "https");
CredentialsProvider provider = new BasicCredentialsProvider();
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(username, password);
provider.setCredentials(new AuthScope(target.getHostName(), target.getPort()),
credentials);
AuthCache authCache = new BasicAuthCache();
BasicScheme basicAuth = new BasicScheme();
authCache.put(target, basicAuth);
HttpClientContext localContext = HttpClientContext.create();
localContext.setAuthCache(authCache);
CloseableHttpClient httpClient = HttpClientBuilder.create().setSSLSocketFactory(sslsf)
.setDefaultCredentialsProvider(provider)
.build();
HttpPost httpPost = new HttpPost(restWebServiceURL);
String requestString = "{\"payLoad\":{\"REQUEST\":{\"PROCESS_NM\":\"GetOrdersHierarchy\"},\"ITEMS\":{\"0\":{\"ORDER_ID\":\"ABC1\"}}}}";
StringEntity entity = new StringEntity(requestString);
entity.setContentType(RESPONSE_TYPE_JSON);
httpPost.setEntity(entity);
HttpResponse response = httpClient.execute(target,httpPost,localContext);
System.out.println("Test 4 First Response: " + String.valueOf(response));
} catch (Exception e) {
System.out.println("Exception While Calling Web restWebServiceURL: " + restWebServiceURL + ", Exception: " + ExceptionUtils.getStackTrace(e));
}
return json;
}
}
RequestAddCookies:123 - CookieSpec selected: default
RequestAuthCache:131 - Re-using cached 'basic' auth scheme for https://devint.test.intranet:443
PoolingHttpClientConnectionManager:255 - Connection request: [route: {s}->https://devint.test.intranet:443][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
PoolingHttpClientConnectionManager:288 - Connection leased: [id: 0][route: {s}->https://devint.test.intranet:443][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
MainClientExec:235 - Opening connection {s}->https://devint.test.intranet:443
DefaultHttpClientConnectionOperator:139 - Connecting to devint.test.intranet/155.70.58.219:443
SSLConnectionSocketFactory:337 - Connecting socket to devint.test.intranet/155.70.58.219:443 with timeout 0
SSLConnectionSocketFactory:390 - Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2]
SSLConnectionSocketFactory:391 - Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, ... TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
SSLConnectionSocketFactory:395 - Starting handshake
SSLConnectionSocketFactory:425 - Secure session established
SSLConnectionSocketFactory:426 - negotiated protocol: TLSv1.2
SSLConnectionSocketFactory:427 - negotiated cipher suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
SSLConnectionSocketFactory:435 - peer principal: CN=cxg7o.test.centurylink.com, OU=IT, O=CenturyLink, L=Monroe, ST=Louisiana, C=US
SSLConnectionSocketFactory:444 - peer alternative names: [cxg7o.test.centurylink.com, cxg7o.test.qintra.com]
SSLConnectionSocketFactory:448 - issuer principal: CN=Symantec Class 3 Secure Server CA - G4, OU=Symantec Trust Network, O=Symantec Corporation, C=US
DefaultHttpClientConnectionOperator:146 - Connection established 10.1.209.211:49163<->155.70.58.219:443
MainClientExec:256 - Executing request POST /X/Y/052ABC/ServicesDEV HTTP/1.1
MainClientExec:261 - Target auth state: CHALLENGED
MainClientExec:267 - Proxy auth state: UNCHALLENGED
headers:133 - http-outgoing-0 >> POST /X/Y/052ABC/ServicesDEV HTTP/1.1
headers:136 - http-outgoing-0 >> Content-Length: 92
headers:136 - http-outgoing-0 >> Content-Type: application/json;charset=UTF-8
headers:136 - http-outgoing-0 >> Host: devint.test.intranet
headers:136 - http-outgoing-0 >> Connection: Keep-Alive
headers:136 - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_102)
headers:136 - http-outgoing-0 >> Accept-Encoding: gzip,deflate
headers:136 - http-outgoing-0 >> Authorization: Basic RVNMQ1hHNzpvVnlGUjNFNXMxQU41NnBJTXFOSCE=
wire:73 - http-outgoing-0 >> "POST /X/Y/052ABC/ServicesDEV HTTP/1.1[\r][\n]"
wire:73 - http-outgoing-0 >> "Content-Length: 92[\r][\n]"
wire:73 - http-outgoing-0 >> "Content-Type: application/json;charset=UTF-8[\r][\n]"
wire:73 - http-outgoing-0 >> "Host: devint.test.intranet[\r][\n]"
wire:73 - http-outgoing-0 >> "Connection: Keep-Alive[\r][\n]"
wire:73 - http-outgoing-0 >> "User-Agent: Apache-HttpClient/4.5.3 (Java/1.8.0_102)[\r][\n]"
wire:73 - http-outgoing-0 >> "Accept-Encoding: gzip,deflate[\r][\n]"
wire:73 - http-outgoing-0 >> "Authorization: Basic RVNMQ1hHNzpvVnlGUjNFNXMxQU41NnBJTXFOSCE=[\r][\n]"
wire:73 - http-outgoing-0 >> "[\r][\n]"
wire:87 - http-outgoing-0 >> "{"payLoad":{"REQUEST":{"PROCESS_NM":"GetOrdersHierarchy"},"ITEMS":{"0":{"ORDER_ID":"ABC1"}}}}"
wire:73 - http-outgoing-0 << "HTTP/1.1 500 Internal Server Error[\r][\n]"
wire:73 - http-outgoing-0 << "Server: Apache-Coyote/1.1[\r][\n]"
wire:73 - http-outgoing-0 << "L7-Policy-URL: https://devint.test.intranet:443/ssg/policy/disco?serviceoid=83f02502063fbaf43344f0c0888e3821[\r][\n]"
wire:73 - http-outgoing-0 << "Content-Type: text/xml;charset=utf-8[\r][\n]"
wire:73 - http-outgoing-0 << "Content-Length: 582[\r][\n]"
wire:73 - http-outgoing-0 << "Date: Wed, 15 Mar 2017 02:30:20 GMT[\r][\n]"
wire:73 - http-outgoing-0 << "Connection: close[\r][\n]"
wire:73 - http-outgoing-0 << "[\r][\n]"
wire:73 - http-outgoing-0 << "<?xml version="1.0" encoding="UTF-8"?>[\n]"
wire:73 - http-outgoing-0 << "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">[\n]"
wire:73 - http-outgoing-0 << " <soapenv:Body>[\n]"
wire:73 - http-outgoing-0 << " <soapenv:Fault>[\n]"
wire:73 - http-outgoing-0 << " <faultcode>soapenv:Server</faultcode>[\n]"
wire:73 - http-outgoing-0 << " <faultstring>Policy Falsified</faultstring>[\n]"
wire:73 - http-outgoing-0 << " <faultactor>https://devint.test.intranet/X/Y/052ABC/ServicesDEV</faultactor>[\n]"
wire:73 - http-outgoing-0 << " <detail>[\n]"
wire:73 - http-outgoing-0 << " <l7:policyResult status="Authentication Required" xmlns:l7="http://www.layer7tech.com/ws/policy/fault"/>[\n]"
wire:73 - http-outgoing-0 << " </detail>[\n]"
wire:73 - http-outgoing-0 << " </soapenv:Fault>[\n]"
wire:73 - http-outgoing-0 << " </soapenv:Body>[\n]"
wire:73 - http-outgoing-0 << "</soapenv:Envelope>[\n]"
headers:122 - http-outgoing-0 << HTTP/1.1 500 Internal Server Error
headers:125 - http-outgoing-0 << Server: Apache-Coyote/1.1
headers:125 - http-outgoing-0 << L7-Policy-URL: https://devint.test.intranet:443/ssg/policy/disco?serviceoid=83f02502063fbaf43344f0c0888e3821
headers:125 - http-outgoing-0 << Content-Type: text/xml;charset=utf-8
headers:125 - http-outgoing-0 << Content-Length: 582
headers:125 - http-outgoing-0 << Date: Wed, 15 Mar 2017 02:30:20 GMT
headers:125 - http-outgoing-0 << Connection: close
HttpAuthenticator:86 - Authentication succeeded
Test 4 First Response: HttpResponseProxy{HTTP/1.1 500 Internal Server Error [Server: Apache-Coyote/1.1, L7-Policy-URL: https://devint.test.intranet:443/ssg/policy/disco?serviceoid=83f02502063fbaf43344f0c0888e3821, Content-Type: text/xml;charset=utf-8, Content-Length: 582, Date: Wed, 15 Mar 2017 02:30:20 GMT, Connection: close] ResponseEntityProxy{[Content-Type: text/xml;charset=utf-8,Content-Length: 582,Chunked: false]}}