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

Open 0 Answers 17 Views

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."

Regards!

1Comments
commented Sep 12 by SunilBhaskar (427 points)
Your question is not much clear. Can you please brief what you are trying to do? Also, your code is not much readable.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
...