Arun
Arun

Reputation: 3680

How to send sessionID from soapui as a request

I am testing a webservice method which accepts session-id as a parameter.

While testing the same method via SoapUI with a dummy sessionID-Parameter, the server is rejecting the request as it is expecting proper session-id.

How can I solve this? Is there any way where SoapUI can bind the session-id before sending the request?

Please advice me. Thanks

Below is the sample-request which is triggered from SOAP-UI:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.local.com">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:getMultiple>
         <!--Optional:-->
         <ser:sessionId>1000AJHEFG0987</ser:sessionId>
         <!--Optional:-->
         <ser:lessonId>95101</ser:lessonId>
         <!--Optional:-->
         <ser:quantity>1</ser:quantity>
         <!--Optional:-->
         <ser:impressionRow>1</ser:impressionRow>
      </ser:getParametersMultiple>
   </soapenv:Body>
</soapenv:Envelope>

Upvotes: 2

Views: 12801

Answers (2)

Yuri Sychenko
Yuri Sychenko

Reputation: 11

Let's say, if you get sessionid in first request's response, and the next request should go here http://{{original endpoint}}/{{SESSION_ID}}), this definitely works:

  1. go to request (not the test request inside test case) where session id should be put into
  2. add a parameter on 'request' tab
  3. name=sessionid, style=template, level=resource. now it is empty in all related test requests
  4. go to test request, 'request' tab
  5. put the path to sessionid value from previous request into 'value' field of sessionid parameter. for example, it is like ${users#Response#$.session_id} where 'users' is the name of endpoint resource, 'session_id' is the name of parameter inside response

Upvotes: 1

Arun
Arun

Reputation: 3680

Found the solution,

  • Design your login method which will accept certain inputs and will return the sessionID as a string

  • Hit that login method from SOAP-UI and you will get the sessionID in your response

  • Use "Property Transfer" option in soap-ui and transfer the received sessionID to all other requests

Helpful Link : soapui.org/Functional-Testing/transferring-property-values.h‌​tml

Simple !! :)

Upvotes: 0

Related Questions