使用Robot Framework进行肥皂呼叫

时间:2018-08-14 08:03:36

标签: python-requests robotframework suds

我正在尝试通过Robot框架实施肥皂呼叫测试。尝试了我可以在Google上找到的各种解决方案,但没有用。

当我通过SOAP UI进行测试时,这同样有效。我不确定要丢失什么吗?

new test
             [Tags]               abcd
             Add Doctor Import    http://schemas.xmlsoap.org/soap/encoding/
             &{headers}=          Create Dictionary                            Content-Type                                                                                     text/xml                                                            SOAPAction             ""                    Host    bfx-b2b....
             ${auth}=             Create List                                  Test                                                                                    Password3#
             Create Session       getPlans                                     https://bfx-b2b.../wsdl/ProductService.wsdl    auth=${auth}                                                        verify=True
             ${file_data}=        Get Binary File                              ${CURDIR}/request.xml
             Log                  ${file_data}
             ${byte_string}=      Encode String To Bytes                       ${REQUEST}                                                                                       UTF-8
             ${resp}=             Post Request                                 getPlans                                                                                         https://bfx-b2b..../B2BWEB/services/IProductPort    data=${byte_string}    headers=${headers}
             Log                  ${resp.text}
             Log                  ${resp.status_code}

我得到的错误低于500。

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
 ESS_eBiz_Operations@uhc.com and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>

几乎没有Soap UI详细信息-

我在SOAP UI上遇到的端点-https://bfx-b2b.../B2BWEB/services/IProductPort 原始数据-

POST https://bfx-b2b.../B2BWEB/services/IProductPort HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
Content-Length: 1822
Host: bfx-b2b...
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Cookie: SMCHALLENGE=YES
Cookie2: $Version=1
Authorization: Basic V2VsbHRoaWVfVGVzdDpQYXNzd29yZDMj

1 个答案:

答案 0 :(得分:0)

看看此示例是否对您有帮助:

*** Settings ***
Documentation     Test with SOAP (WSDL) with two parameters that returns the country passing the IP
Library           SudsLibrary

*** Variables ***
${ip}             150.162.2.1

*** Test Cases ***
ConsultaIP
    Create Soap Client    http://ws.cdyne.com/ip2geo/ip2geo.asmx?wsdl
    ${result}    Call Soap Method    ResolveIP    ${ip}    null
    ${country}    Get Wsdl Object Attribute    ${result}    Country
    ${Latitude}    Get Wsdl Object Attribute    ${result}    Latitude
    ${Longitude}    Get Wsdl Object Attribute    ${result}    Longitude
    log    The IP ${ip} belongs to the country ${country}, Latitude: ${Latitude} Longitude: ${Longitude}