Hi,Please see the logs
---------------------------
ID: 2
Response-Code: 200
Encoding: ISO-8859-1
Content-Type: application/atomsvc+xml
Headers: {cache-control=[no-store, no-cache, must-revalidate,
max-age=0, post-check=0, pre-check=0], connection=[keep-alive],
Content-Length=[6444], content-type=[application/atomsvc+xml],
dataserviceversion=[2.0], expires=[Tue, 03 Jul 2001 06:00:00 GMT],
last-modified=[Mon, 19 Jan 2015 14:02:34 GMT], pragma=[no-cache],
sap-metadata-last-modified=[Thu, 15 Jan 2015 11:48:40 GMT],
server,set-cookie=[BIGipServertestmaint-sapapimgmt.river.jpaas.sapbydesign.com=2619950090.29727.0000;
path=/]}
Payload: <?xml version="1.0" encoding="UTF-8"?><app:service
xmlns:app="http://www.w3.org/2007/app"
xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gp="jjjj"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:sapjjj" xml:lang="en"
xml:base="jjjjjjjj/GWDEMO10/"><app:workspace><atom:title
type="text">Data</atom:title><app:collection
sap:addressable="false" sap:content-version="1"
href="ContactPersonCollection"><atom:title </app:service>
Whereas in case of httpclient
Set cookie read the proper value
set-cookie:
MYSAPSSO2=AjQxMDMBABhBAEQASwBPAEwASQAgACAAIAAgACAAIAACAAYxADAAMAADABBHADMAVAAgACAAIAAgACAABAAYMgAwADEANQAwADEAMQA5ADEANAAxADQABQAEAAAACAYAAlgACQACRQD%2fATUwggExBgkqhkiG9w0BBwKgggEiMIIBHgIBATELMAkGBSsOAwIaBQAwCwYJKoZIhvcNAQcBMYH%21MIH7AgEBMFAwRTELMAkGA1UEBhMCREUxDzANBgNVBAoTBlNBUC1BRzEMMAoGA1UECxMDRzNUMRcwFQYDVQQDDA4qLndkZi5zYXAuY29ycAIHIBQCAxAZATAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTUwMTE5MTQxNDUwWjAjBgkqhkiG9w0BCQQxFgQUE44GmBBJ0oZB5gBD2cKkDhFTt60wCQYHKoZIzjgEAwQvMC0CFQCeiy5yaTGt0fdwp%21o71DXrsmOznwIUOVeDlSFbLo2XjBUV2Z7iIG%2f22O4%3d;
path=/; domain=.adf.lap.corp
set-cookie: xxxxxx=T7xIWcf1-DhBuVgktK8asYZ2-J2f5RHksb4AUFa0PPA%3d;
path=/
set-cookie:
sap-xxxxx=k8e0QqHJt2chKzKJiOTX1Q%3d%3d201501191414504AcJrLmXgNVZKp-JKdf-uadDSwCazuN7SKXLAk3oUXg%3d;
path=/; HttpOnly
Thanks
-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]]
Sent: Monday, January 19, 2015 7:21 PM
To: Khare, Aparna
Subject: Re: Issues to retreive cross domain cookies
Hi, thanks for the extra details,
Right, I wonder if it is some kind of a Set-Cookie parsing issue...
Can you please do
rsClient = WebClient.create(baseURI);
WebClient.getConfig(rsClient).getInInterceptors().add(new
LoggingInInterceptor());
and let me know the exact format of Set-Cookie values (you can replace
some sensitive properties with something like a=b if you prefer, but I
need to look at the actual Set-Cookie format).
Thanks, Sergey
On 19/01/15 13:41, Khare, Aparna wrote:
Sorry for the information provided
I prepare the webclient with url and pass all required parameters
like Authentication,SSL ,Proxy and then call the process response
where I pass rsClient.get()
Please see the code snippet below
WebClient rsClient=null;
try {
baseURI = new URI(client.getURL());
rsClient = WebClient.create(baseURI);
} catch (URISyntaxException e) {
e.printStackTrace();
then I call processResponse(rsClient.get()) after building the client
protected void processResponse(Response response){
HttpClient client = new HttpClient();
setResponse((InputStream) response.getEntity());
System.out.println(response.getCookies()+"res.getCookies");
Map<String, NewCookie> map = response.getCookies();
//Iterator<Map.Entry<Integer, Integer>> entries =
map.entrySet().iterator();
for (Entry<String, NewCookie> entry : map.entrySet()) {
System.out.println("Key = " + entry.getKey() + ", Value =
" + entry.getValue());
NewCookie cookie = entry.getValue();
System.out.println(cookie.getName());
System.out.println(cookie.getDomain());
System.out.println(cookie.getValue());
}
// ...
setResponseHeaders(response.getHeaders());
}
When I print headers(response.getHeaders()) in the set-cookie
header im not getting the proper cookie value instead I get
{path=path=/;Version=1} whereas why I use the httpclient api's I
get proper value in the cookie.
Note:-The url is a proxies api so cross domain cookies I might
have to use.
Thanks,
-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]]
Sent: Monday, January 19, 2015 5:15 PM
To: [email protected]
Subject: Re: Issues to retreive cross domain cookies
Hi,
I can't help unless you provide enough information...
Sergey
On 19/01/15 11:40, Khare, Aparna wrote:
import javax.ws.rs.core.Response; response is an instance of
this the problem is even in the headers im not getting the cross
domain cookies whereas it comes in Rest client
Thanks
-----Original Message-----
From: Sergey Beryozkin [mailto:[email protected]]
Sent: Monday, January 19, 2015 4:07 PM
To: [email protected]
Subject: Re: Issues to retreive cross domain cookies
Hi
On 19/01/15 10:12, Khare, Aparna wrote:
Hello Users,
I have a requirement where I want to retrieve the
cross domain cookies.
When I do response.getCookies() .I'm getting
{path=path=/;Version=1} and not the proper domain name.
I have a proxied API which I'm testing .I'm getting the proper
response with Get but I also need the cookies because this is
used for some
Authentication when I do a POST to the same proxied API.
Is 'response' an instance of JAX-RS Response class ?
If so, can you use Response.getHeaders() and check what are the
actual
values of Set-Cookie headers ?
Cheers, Sergey
Can some help how cross domain cookies are retrieved with apache
cxf.
Thanks,