JMeter技术问题:移除HTTP默认请求头及NetSuite SOAP请求206报错排查
Hey there! Let’s tackle your two JMeter questions one by one—based on my experience with similar scenarios, I’ve got some actionable steps for you.
JMeter automatically sends a set of default HTTP headers (like User-Agent, Accept, Accept-Encoding) with every HTTP Request, plus any headers defined in global HTTP Header Managers. Here’s how to remove them:
- Per-request override (most flexible)
- Add an HTTP Header Manager as a direct child of your target HTTP Request.
- For each default header you want to eliminate, add a new entry where the header name matches exactly (e.g.,
User-Agent), and set the value to an empty string. JMeter skips sending headers with blank values, so this will suppress the default one.
- Global modification (for all requests)
- Open the
jmeter.propertiesfile in your JMeterbinfolder. - Look for the
http.default_headerssection—you’ll see lines like:http.default_headers=User-Agent: Apache-HttpClient/4.5.13 (Java/11.0.15) http.default_headers=Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 - Comment out or delete the lines for headers you don’t want to send globally. Restart JMeter for changes to take effect.
- Open the
- Important note: Some headers (like
Host) are required by the HTTP/1.1 spec—JMeter will still send these even if you try to remove them, so don’t waste time on those.
A 206 status here is likely a red herring—NetSuite is probably failing to parse your request and returning an error page instead of a proper SOAP fault. Let’s debug this step by step:
First, match your request to SoapUI/Postman exactly
The most common issue is a mismatch between the working request in other tools and what JMeter sends. Use JMeter’s View Results Tree listener to capture your request, then compare these details:
- HTTP Method: Ensure it’s
POST(SOAP almost exclusively uses POST). - Content-Type Header: Must be
text/xml; charset=utf-8(for SOAP 1.1) orapplication/soap+xml(for SOAP 1.2). Missing or incorrect values here will break NetSuite’s parsing. - SOAPAction Header: For SOAP 1.1, this header is mandatory. Copy the exact value from SoapUI (you’ll find it in the request properties) into JMeter’s HTTP Header Manager.
- Request Body: Compare the raw SOAP envelope line by line. Look for typos, missing namespace declarations, or incorrect parameter values. Use the "Compare" feature in View Results Tree to spot differences quickly.
Fix common JMeter-specific issues
- Disable chunked encoding: Some servers (including NetSuite) don’t handle chunked request bodies well for SOAP. Go to your HTTP Request’s Advanced tab and uncheck "Use chunked encoding" (or set the "Send chunked" option to false).
- Match the User-Agent: NetSuite sometimes blocks default JMeter user agents. Set the
User-Agentheader in JMeter to the same value used in SoapUI/Postman (e.g.,SoapUI/5.7.0orPostmanRuntime/7.32.3). - Check authentication: NetSuite’s SOAP API requires strict auth (OAuth 1.0, token-based, etc.). Verify that your JMeter test includes the exact same
Authorizationheaders, cookies, or parameters as the working requests in other tools. Use an HTTP Cookie Manager to capture and replay cookies if needed.
Use JMeter’s recorder to replicate the working request
If you’re still stuck, use the HTTP(S) Test Script Recorder:
- Set up the recorder in JMeter (configure a port, like 8888).
- Configure SoapUI/Postman to use JMeter as a proxy (localhost:8888).
- Send the working request from SoapUI/Postman—JMeter will generate a test plan with the exact headers, body, and auth details that worked.
- Compare this generated request with your existing one to fix any discrepancies.
NetSuite-specific checks
- Ensure your SOAP envelope uses the correct namespace declarations matching the WSDL version you’re using.
- Verify the endpoint URL is identical to SoapUI/Postman—even a trailing slash can cause issues.
内容的提问来源于stack exchange,提问作者Jamila Souza

