function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SunilKumar.ax1648SunilKumar.ax1648 

Cookie header is not set in Apex class

Hi All,

I have a apex class, in this class i have rest based web services i am login on diffrent web server, i am able to login there and getting success response. but in cookie i am not geting header values. i request you to please if any one have any idea so plase help the same

Thanks in advance 

      Http http2 = new Http();
      HttpResponse res2 = http2.send(req2);
      System.debug(methodName+ ' :: 2 res2 :: '+res2 );
      System.debug(methodName+ ' :: 2 res2 body :: '+res2.getBody()+ ':: status :: '+res2.getStatusCode()+' :: :: '+res.getHeader('Set-Cookie')); // this will print null
      

Thanks & Regards
Sunil Kumar
Gaurav NirwalGaurav Nirwal
Try this code

public class AmazonProductStubNew
{
 public static void getResults()
 { 
        System.Debug(' getResults start ');
        AmazonWS.AWSECommerceServicePortUS stub = new AmazonWS.AWSECommerceServicePortUS();

        stub.inputHttpHeaders_x = new Map<String,String>();
        stub.inputHttpHeaders_x.put('AWSAccessKeyId','MyAmazonAWSAccessKeyId');
        stub.inputHttpHeaders_x.put('Timestamp','2012-11-28T12:11:30Z');
        stub.inputHttpHeaders_x.put('Signature','Encrypted Secret Code');
        String MarketplaceDomain = '';
        String AWSAccessKeyId = 'MyAmazonAWSAccessKeyId';
        String AssociateTag = '';
        String XMLEscaping = '';
        String Validate = '';
        AmazonWS.ItemSearchRequest Shared = new AmazonWS.ItemSearchRequest();
        Shared.SearchIndex = 'DVD';
        AmazonWS.ItemSearchRequest[] Request = new AmazonWS.ItemSearchRequest[1];
        Request[0] = new AmazonWS.ItemSearchRequest();
        Request[0].Title = 'Inception';
        AmazonWS.ItemSearchResponse_element response = stub.ItemSearch(MarketplaceDomain,AWSAccessKeyId,AssociateTag,XMLEscaping,Validate,Shared,Request);
        AmazonWS.Items_element[] localItems = response.Items;
        System.Debug(localItems[0].TotalResults);
 }
 }


SunilKumar.ax1648SunilKumar.ax1648
Thanks for your replay but this is not work for my code.