在Qmetry框架中执行POST请求时遇异常问题咨询
I’ve run into this exact issue before with Qmetry’s request parsing—let’s get your XML POST request working since it already works in Postman. The error you’re seeing (java.lang.IllegalArgumentException: Passed in key must select exactly one node: post.sample.call) happens because Qmetry’s configuration parser interprets the dot-separated key post.sample.call as a nested node path instead of a single top-level key. Here’s how to fix it step by step:
1. Rename the Request Key to Avoid Dot Separators
Qmetry’s parser treats dots in key names as node hierarchy markers, so post.sample.call looks like it’s trying to access a call node inside sample inside post, instead of one single request object. Change the key to something without dots, like postSampleCall or soapRequest:
postSampleCall={'headers':{'SoapAction':'<url here>','Content-Type':'text/xml;charset=UTF-8','Accept':'*/*','Authorization':'<authorization key here>'},'endPoint':'<endpoint here>','baseUrl':'<url here>','method':'POST','query-parameters':{},'form-parameters':{},'body':'<sending xml content here>'}
2. Properly Escape the XML Body
Qmetry is strict about special characters in string values, especially XML’s angle brackets and quotes. If your XML body has unescaped characters, it can break the configuration parsing. Try one of these approaches:
- Escape double quotes in the XML using backslashes:
body:'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><Request param=\'value\'></Request></soap:Body></soap:Envelope>' - Wrap XML in CDATA (if Qmetry supports it) to avoid escaping individual characters:
body:'<![CDATA[<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><Request param="value"></Request></soap:Body></soap:Envelope>]]>'
3. Verify the Request Structure Matches Qmetry’s Expectations
Some Qmetry versions expect POST requests to be wrapped in a standard top-level key like request or httpRequest. Try nesting your entire request object under this key:
request={'headers':{'SoapAction':'<url here>','Content-Type':'text/xml;charset=UTF-8','Accept':'*/*','Authorization':'<authorization key here>'},'endPoint':'<endpoint here>','baseUrl':'<url here>','method':'POST','query-parameters':{},'form-parameters':{},'body':'<sending xml content here>'}
4. Check baseUrl and endPoint Combination
Qmetry automatically concatenates baseUrl and endPoint, so make sure their combined value matches the exact URL you used in Postman. For example:
- If your Postman URL is
https://api.example.com/soap/service, setbaseUrltohttps://api.example.comandendPointto/soap/service, or setbaseUrlto the full URL and leaveendPointempty.
Start with renaming the key first—this is almost always the root cause of that "must select exactly one node" error. Once that’s fixed, double-check the XML escaping and URL combination to ensure everything lines up with your working Postman request.
内容的提问来源于stack exchange,提问作者sanjay pujari

