Welcome to the Question and Answer site for Software Testing Professionals

You can get your queries resolved from Software Testing Professionals.

Ask a Question

Get answers and give answers to questions from other members.

View All Questions

Get votes and earn points to build your reputation in community.

View Hot Questions

How to Access two Web Services with a 1 Session? Robotframework.

Closed 0 Answers 37 Views
0 0

Im new in robotframework
I have 2 web services the first is the login service. The second Web Service that is another service.

When I try to access the second web service I think that the session is lost

The connection only passes through the principal that is the first one where the method for login.

My code:

Create Session and login

 ${resp}=      Get Request      cyber      /     allow_redirects=true
 ${proxies}= Create Dictionary http=${PROXY} -<<<< parameters is in resource file.
Create Session cyber ${URL} debug=1 proxies=${proxies}

log    ${resp}

${session_var}=     Head Request     aaaa   /     allow_redirects=true      

  ${headers}=    Create Dictionary    Content-Type    application/json
 ${session_cokie} =    Create Dictionary    set-cookie    ${resp.headers['set-cookie']}     
 ${sess_header}=    Create Dictionary    set-cookie    ${resp.headers['set-cookie']}
 ${session} =    Create Session    session1    ${PROXY}    headers=${sess_header}    cookies=${session_cokie}

 @{arrheaders}=    Split String      ${resp.headers['set-cookie']}     =  
 #@{arrheaders}=    Split To Lines     ${resp.headers['set-cookie']}    -1
 ${jSession}=       Create Dictionary    @{arrheaders}[0]         @{arrheaders}[1]   

 #${reply}=    Get Request    session1    /mz/p/v1/troubleshoot/ping    headers=${sess_header}

 ${idSecurity}=  Create Soap Client  ${CURDIR}\\SecurityServiceService.wsdl   &lt;---first web service
 Set Proxies     http     ${PROXY} 
 Set Headers  ${session_cokie}

 ${idUtil}=  Create Soap Client    ${CURDIR}\\UtilServiceService.wsdl   &lt;----second web service
 Set Proxies     http     ${PROXY}
 Set Headers   ${session_cokie}

 Switch Soap Client        ${idSecurity} 
 ${result}=       Call Soap Method        authenticateUserInternalSecurity      ${USERNAME}    ${PASSWORD}     1   method first web service

 Switch Soap Client        ${idUtil}     
 ${result}=     Call Soap Method     getIfxodate     &lt;---method second web service i cannot to access here,  it does not happen and I do not know why

Switch Soap Client        ${idSecurity}  
${result}=       Call Soap Method        logOutUser   &lt;---logout method of first ws this is ok. 

delete all sessions

EDIT: the robot give me this error: "Operation: getIfxodate called without a valid session."


commented by (447 points)
Your question is not much clear. Can you please brief what you are trying to do? Also, your code is not much readable.
closed with the note: question is not much clear

We have resolved 1.2k+ Software Testing queries!

Software Testing Board Weekly update

We will send you handpicked questions that you would love to answer.

View previous campaigns.

Top Contributors