Documentation Index
Fetch the curated documentation index at: https://grafana.com/llms.txt
Fetch the complete documentation index at: https://grafana.com/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: https://grafana.com/docs/k6/latest/examples/soap.md (append .md) or send Accept: text/markdown to https://grafana.com/docs/k6/latest/examples/soap/. For the curated documentation index, use https://grafana.com/llms.txt. For the complete documentation index, use https://grafana.com/llms-full.txt.
Menu
Open source
SOAP
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
JavaScript
import http from 'k6/http';
import { check, sleep } from 'k6';
const soapReqBody = `
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hs="http://www.holidaywebservice.com/HolidayService_v2/">
<soapenv:Body>
<hs:GetHolidaysAvailable>
<hs:countryCode>UnitedStates</hs:countryCode>
</hs:GetHolidaysAvailable>
</soapenv:Body>
</soapenv:Envelope>`;
export default function () {
// When making a SOAP POST request we must not forget to set the content type to text/xml
const res = http.post(
'http://www.holidaywebservice.com/HolidayService_v2/HolidayService2.asmx',
soapReqBody,
{
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,
});
sleep(1);
}Was this page helpful?
Related resources from Grafana Labs
Additional helpful documentation, links, and articles:
Video

Performance testing and observability in Grafana Cloud
Optimize user experiences with Grafana Cloud. Learn real-time insights, performance testing with k6, and continuous validation with Synthetic Monitoring.
Events

User-centered observability: load testing, real user monitoring, and synthetics
Learn how to use load testing, synthetic monitoring, and real user monitoring (RUM) to understand end users' experience of your apps. Watch on demand.
Choose a product
Viewing: v2.0.x (latest)
Find another version
Scroll for more