Do you have questions ? We got the answers!

Ask a question:

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

Closed 0 Answers 35 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 (433 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

Top Contributors

  • 4970 pointsstbadmin

    34 questions 454 answers218 comments

  • 433 pointsSunilBhaskar

    41 questions 15 answers32 comments

  • 425 pointsMehedi

    36 questions 3 answers14 comments

  • 363 pointssumitkumarwatts

    0 questions 13 answers0 comments

  • 354 pointsSoft Tester

    43 questions 0 answers4 comments

  • 327 pointsKeeshaGolden

    0 questions 17 answers2 comments

  • 322 pointsVipul Sharma

    44 questions 0 answers24 comments

  • 310 pointsvysh.sharma

    25 questions 0 answers0 comments

  • 267 pointsOnkar_Nimje

    33 questions 15 answers15 comments

  • 258 pointsVanitha

    26 questions 0 answers6 comments

...