如何在Gatling脚本中传递soap XML

问题描述 投票:0回答:1

我正在尝试在Gatling中创建一个Web服务脚本,但我不知道如何在脚本中传递XML soap。从Gatling文档中了解到我们需要通过.body(StringBody()发送xml,但确定格式。

这是我需要传递的XML

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Header/>
    <soapenv:Body>
        <p359:DeleteSellSeqReq xmlns:p977="http:xxxxx.com" xmlns:p619="http://xxxxx.com" xmlns:p359="http://xxxxx.com/2006/11/15/MaintainSellSequence_1">
            <p977:RequestContextBean xmlns:p357="http://xxxxxx.com">
                <p357:RequestTransactionID>xxxxxxxxx</p357:RequestTransactionID>
                <p357:FlowSeqNum>1</p357:FlowSeqNum>
                <p357:ContextFrames>
                    <p357:Name>xxx</p357:Name>
                    <p357:Type>xxx</p357:Type>
                    <p357:ServiceInterface>com.sxxxxxxxxxxx</p357:ServiceInterface>
                    <p357:Operation>buildRequestContext</p357:Operation>
                    <p357:IPAddress>xxxxxxx</p357:IPAddress>
                <p357:LocalContextParameters>CTX_UTC=1493024853726</p357:LocalContextParameters>
                    <p357:LocalContextParameters>VERSION=Unknown Version</p357:LocalContextParameters>
                </p357:ContextFrames>
                <p357:ContextFrames>
                    <p357:Name>NodeName</p357:Name>
                    <p357:Type>NodeType</p357:Type>
                    <p357:ServiceInterface>xxxxxxxxxxxxx.businessServices.SellSequenceService.SellSequencePort</p357:ServiceInterface>
                    <p357:Operation>deleteSellSequence</p357:Operation>
                    <p357:IPAddress>localhost</p357:IPAddress>
                    <p357:LocalContextParameters>CTX_UTC=1493024853728</p357:LocalContextParameters>
                    <p357:LocalContextParameters>VERSION=1</p357:LocalContextParameters>
                </p357:ContextFrames>
            </p977:RequestContextBean>
            <p619:Channel>xxx</p619:Channel>
            <p619:Division>xxx</p619:Division>
            <p619:RateCode>xxx</p619:RateCode>
            <p619:ChainCode>xxx</p619:ChainCode>
            <p619:AfflCd>xxx</p619:AfflCd>
        </p359:DeleteSellSeqReq>
    </soapenv:Body>
</soapenv:Envelope>
xml web-services soap performance-testing gatling
1个回答
0
投票

我不是说这是最好的方法,而是作为一个简单的演示:

val someBody = "<soapenv:Env..."
val someRequest = http("some name")
                      .post("some route")
                      .body(StringBody(someBody))
val sc = scenario("some scenario")
             .exec(someRequest)

如果这不能回答您的问题,那么请更具体地说明您遇到什么问题。

© www.soinside.com 2019 - 2024. All rights reserved.