Forum Discussion

saigopal143's avatar
saigopal143
New Contributor
7 years ago

Authentication Headers(Set-Cookie/X_AUTH_TOKEN) in Rest API response POSTMAN vs Soap UI

Hi,

ON Postman i try hitting a rest service and I get back in the response header a SET_COOKIE to pass to the next requests and I am able to do all the consecutive steps.

When i try to access the same Rest API method on SOAP UI i do not see these headers in the resposne.

I tried adding the domain to the keyStore and all those steps. but may be failing some where.

I tried this in a groovy script:

 

import com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport 
def myCookieStore = HttpClientSupport.getHttpClient().getCookieStore() 

import org.apache.http.impl.cookie.BasicClientCookie 
def myNewCookie = new BasicClientCookie("xxxx", "xxxx") 
myNewCookie.version = 1 
myNewCookie.domain = "absd.com" 
//myNewCookie.path = "/" 
myCookieStore.addCookie(myNewCookie)

 

The only thing i can think of is how the cookie management in Postman is different from Soap ui.?

The only additional thing i did in Postman was the above I added a cookie with the domain information above.

 

please help,

 

6 Replies

  • JHunt's avatar
    JHunt
    Community Hero

    You said that the response from the webservice has different headers when you call it in SoapUI versus when you call it in Postman? I think you need to work out why that is first, then we can look at how you can deal with the cookies later.

     

    Firstly, just checking the basics. Make sure you are looking for the headers in the right place: take a look at the Raw view, which is a tab just to the left of the response body. There are no headers there right?

     

    So you'll need to work out why the webservice responded differently. Look at the Raw view for your request. Then see if you can find a similar view in Postman to compare the two requests.

    • saigopal143's avatar
      saigopal143
      New Contributor

      JHunt While making the same request on both postman and SOAP UI i get different response headers.

      SO i was just trying to see if there is something postman does internally or differently to process these requests.

  • nmrao's avatar
    nmrao
    Champion Level 3
    saigopal143, You mean to add the cookies automatically to the next request using groovy script?
    • saigopal143's avatar
      saigopal143
      New Contributor

      nmrao No, i am able to do that thanks to your github script for it.

      But what is happening is postman sends it as one cookie adding all the response cookies but soap ui send them seperately.

      Also there is a difference between responses. 

      I was trying to figure out if POSTMAN does something with related to cookies on its own which need to be mentioned in soap ui explicitly.

       

      Thanks,Sai

  • NewBear1's avatar
    NewBear1
    New Contributor

    I have a test case where I run a REST request and get back the following in the header:

    Header: Set-Cookie  Value: jsessionid=20180111

     

    In a subsequent Groovy Script step, I have the following code:

    import com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport
    def myCookieStore = HttpClientSupport.getHttpClient().getCookieStore()
    def myCookies = myCookieStore.getCookies()
    log.info myCookies.size()
    return;

     

    It returns a size of 0.  

     

    Why isn't the jsessionid cookie showing up in the Cookie store?