handling session in response
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2007
02:17 AM
07-26-2007
02:17 AM
handling session in response
Hi all,
I have a SOAP request for Login and i am getting proper response for the user credentials. Now in the SOAP response the session id()node is passed to it.
I need to get the value of the session id from the response.so that i can use those values for next coming request.
thanks
ind
I have a SOAP request for Login and i am getting proper response for the user credentials. Now in the SOAP response the session id(
I need to get the value of the session id from the response.so that i can use those values for next coming request.
thanks
ind
6 REPLIES 6
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2007
02:21 AM
07-26-2007
02:21 AM
hi all,
here is my SOAP response after i hit my login
success
123asdf
how to get the value of session id node ...
thanks
ind
here is my SOAP response after i hit my login
how to get the value of session id node ...
thanks
ind
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2007
02:28 AM
07-26-2007
02:28 AM
Hi!
You can do this in a Transfer Step.
Create a transfer that transfers from your login step (step login, property response ) to your next step (step nextstep, property request) and use XPath expressions to to move it:
Example Source XPath:
declare namespace ns1='http://example.example.com;
//ns1:loginResponse/ns1:loginReturn
Example Target XPath:
declare namespace ns1='http://example.example.com';
//ns1:nextcall/ns1:sessionId
You can do this in a Transfer Step.
Create a transfer that transfers from your login step (step login, property response ) to your next step (step nextstep, property request) and use XPath expressions to to move it:
Example Source XPath:
declare namespace ns1='http://example.example.com;
//ns1:loginResponse/ns1:loginReturn
Example Target XPath:
declare namespace ns1='http://example.example.com';
//ns1:nextcall/ns1:sessionId
Product Guy for Ready! API, SoapUI and all things API
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2007
02:39 AM
07-26-2007
02:39 AM
One more thing,
if you are using the soapUI Pro trial, this is even easier. To the right of the Property Drop Down, there is a button that lets you choose which element you want (in your case sessionID) and it will generate the XPath for you.
This is Pro only though...
if you are using the soapUI Pro trial, this is even easier. To the right of the Property Drop Down, there is a button that lets you choose which element you want (in your case sessionID) and it will generate the XPath for you.
This is Pro only though...
Product Guy for Ready! API, SoapUI and all things API
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2007
04:14 AM
07-26-2007
04:14 AM
thanks,
in case if i want to get a node value in request/response....how do i do that
request
----------
33
response
------------
<NewDataSet><br /> <Table><br /> <Town>Banavie</Town><br /> <County>Highland</County><br /> <PostCode>PH33</PostCode><br /> </Table><br /><br />how to get country or postcode in response or web:PostCode in request<br />in groovy<br /><br />thanks<br />ind
in case if i want to get a node value in request/response....how do i do that
request
----------
response
------------
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2007
06:08 AM
07-26-2007
06:08 AM
Ok, this is my personal way of doing it.
Since I'm not that fond of the XML parsing in Groovy (read: because I'm lazy), I would make a Properties Step containing properties for these:
Request PostCode
Response PostCode
I would then move them into the properties step using a Property Transfer like above (only now into the Properties Step) and the accessing the Properties Step from Groovy.
In Pro it is simpler to use Grovy and I would use the GroovyUtils like this:
Since I'm not that fond of the XML parsing in Groovy (read: because I'm lazy), I would make a Properties Step containing properties for these:
Request PostCode
Response PostCode
I would then move them into the properties step using a Property Transfer like above (only now into the Properties Step) and the accessing the Properties Step from Groovy.
def step = testRunner.testCase.getTestStepByName( "Properties" )
step.getPropertyValue( "Request PostCode " )
step.getPropertyValue( "Response PostCode " )
In Pro it is simpler to use Grovy and I would use the GroovyUtils like this:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def respHolder = groovyUtils.getXmlHolder( "GetUKLocationByPostCode#Response" )
def reqHolder = groovyUtils.getXmlHolder( "GetUKLocationByPostCode#Request" )
reqpHolder.getNodeValue( "//web:GetUKLocationByPostCode/web:PostCode"))
resppHolder.getNodeValue( "//web:GetUKLocationByPostCodeResult/Table/PostCode"))
Product Guy for Ready! API, SoapUI and all things API
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2007
10:40 PM
07-26-2007
10:40 PM
thanks for the prompt response.
i have tried with your code. but null value only it passes.
i have used this groovy code:
-------------------------------------
def step = testRunner.testCase.getTestStepByName( "GetUKLocationByPostCode - Request 1" )
def a = step.getPropertyValue( "//web:GetUKLocationByPostCode/web:PostCode" )
log.info(a)
the response i got is :
Fri Jul 27 11:07:11 IST 2007:INFO:null
the value is null.
thanks!!!
ind
i have tried with your code. but null value only it passes.
i have used this groovy code:
-------------------------------------
def step = testRunner.testCase.getTestStepByName( "GetUKLocationByPostCode - Request 1" )
def a = step.getPropertyValue( "//web:GetUKLocationByPostCode/web:PostCode" )
log.info(a)
the response i got is :
Fri Jul 27 11:07:11 IST 2007:INFO:null
the value is null.
thanks!!!
ind
