2017-07-25 45 views
1

當試圖執行以下robotscript附加的元素,它增加了額外的元件到登錄元件..Robotframwork SudsLibrary產生時,它調用「呼叫SOAP方法」

Library   Selenium2Library 
Library   Collections 
Library   String 
Library   uuid 
Library   Dialogs 
Library   SudsLibrary 


    Create Soap Client  http://xxxxxxxxx:18080/xxxxx_b/xxx?wsdl 
    ${dbl array}= Create Wsdl Object  logIn 
    Set Wsdl Object Attribute ${dbl array} username xxx 
    Set Wsdl Object Attribute ${dbl array} password xxxx 
    ${result}= Call Soap Method logIn  ${dbl array} 
    log to consol  ${result} 

原始請求格式

<soapenv:Envelope xmlns:soapenv="http://xxxxxxxxxxxxx/x/x/" xmlns:ws="http://xxxxxxxxxxxxxxx/"> 
    <soapenv:Header/> 
    <soapenv:Body> 
     <ws:logIn> 
     <!--Optional:--> 
     <username>xxx</username> 
     <!--Optional:--> 
     <password>xxx</password> 
     </ws:logIn> 
    </soapenv:Body> 
</soapenv:Envelope> 

生成的代碼:

<SOAP-ENV:Envelope xmlns:ns0="http://xxxxxxxxxxxxxx/" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="h 
ttp://schemas.xmlsoap.org/soap/envelope/"> 
    <SOAP-ENV:Header/> 
    <ns1:Body> 
     <ns0:logIn> 
     <username> 
      <username>xxx</username> 
      <password>xxx</password> 
     </username> 
     </ns0:logIn> 
    </ns1:Body> 
</SOAP-ENV:Envelope> 

如何刪除額外的用戶名標記?

<username> 
       <username>xxx</username> 
       <password>xxx</password> 
      </username> 
+0

添加語言標籤幫助按語言過濾問題。 – Sergii

回答

1

很可能問題在於login方法不會將其參數包含在對象中,而是直接包含在對象中。 Suds爲所有方法創建類型,但這些不需要調用這些方法。 如果您查看Create Soap Client的輸出,您可能會看到類似logIn(用戶名,密碼)。這意味着你直接傳遞參數而不是傳遞給某個對象。

Library   Selenium2Library 
Library   Collections 
Library   String 
Library   uuid 
Library   Dialogs 
Library   SudsLibrary 


    Create Soap Client  http://xxxxxxxxx:18080/xxxxx_b/xxx?wsdl 
    ${result}= Call Soap Method logIn  some_username some_password 
    log to console  ${result} 
+0

謝謝.. :)正確答案.. –