No results for ""

Powered byAlgolia

Although k6 doesn't have any built-in APIs for working with SOAP or XML data in general, you can still easily load test a SOAP-based API by crafting SOAP messages and using the HTTP request APIs.

Making SOAP requests

import http from "k6/http";
import { check, sleep } from "k6";

const soapReqBody = `
<soapenv:Envelope xmlns:soapenv="" xmlns:hs="">

export default function() {
    // When making a SOAP POST request we must not forget to set the content type to text/xml
    let res =
        {headers: { 'Content-Type': 'text/xml' }});

    // Make sure the response is correct
    check(res, {
        'status is 200': (r) => r.status === 200,
        'black friday is present': (r) => r.body.indexOf('BLACK-FRIDAY') !== -1