Would it be possible to modify SoapSampler.java to set the Sampler Data of the SampleResult to XmlData provided by the GUI? This would involve changing the last few lines of th e public SampleResult sample(Entry e) method to : public SampleResult sample(Entry e) { URL url = null; try { url = new URL(getURLData()); setDomain(url.getHost()); setPort(url.getPort()); setProtocol(url.getProtocol()); setMethod(POST); if (url.getQuery() != null && url.getQuery().compareTo("") != 0) { setPath(url.getPath() + "?" + url.getQuery()); } else { setPath(url.getPath()); } // make sure the Post header is set URLConnection conn = url.openConnection(); setPostHeaders(conn); } catch (MalformedURLException e1) { log.error("Bad url: " + getURLData(), e1); } catch (IOException e1) { log.error("Bad url: " + getURLData(), e1); } HTTPSampleResult result = (HTTPSampleResult)super.sample(e); result.setDataType(SampleResult.TEXT); if(url != null) { result.setSamplerData("\n" + getXmlData()); } return result; }
Thanks for the suggestion - it has been included in the 2.1 branch code, and will be included in JMeter 2.1.2. If you want to give it a try, the nightly 2-1.20060410 has the fix included.
Hi, Thanks for applying the patch, but it seems like it the patch I submitted does not work against the current nightly builds. I had tested it against 2.1.1 release. The following fix I think in the public SampleResult sample(Entry e) should be changed to: // Bug 39252 set SoapSampler sample result from XML data /* SampleResult sampleResult = super.sample(e); sampleResult.setDataType(SampleResult.TEXT); sampleResult.setSamplerData(getXmlData()); return sampleResult; */ HTTPSampleResult result = (HTTPSampleResult)super.sample(e); result.setDataType(SampleResult.TEXT); result.setSamplerData("\n" + getXmlData()); result.setQueryString("\n" + getXmlData()); return result;
(In reply to comment #2) > Hi, Thanks for applying the patch, but it seems like it the patch I submitted > does not work against the current nightly builds. I had tested it against 2.1.1 > release. The following fix I think in the public SampleResult sample(Entry e) > should be changed to: > // Bug 39252 set SoapSampler sample result from XML data > /* > SampleResult sampleResult = super.sample(e); > sampleResult.setDataType(SampleResult.TEXT); > sampleResult.setSamplerData(getXmlData()); > return sampleResult; > */ > HTTPSampleResult result = (HTTPSampleResult)super.sample(e); > result.setDataType(SampleResult.TEXT); > result.setSamplerData("\n" + getXmlData()); The above has been done (but I removed the \n prefix) > result.setQueryString("\n" + getXmlData()); This was not done, as it was not asked for - see your original posting. Why do you need both set to the same value? > return result;
(In reply to comment #3) > (In reply to comment #2) > > HTTPSampleResult result = (HTTPSampleResult)super.sampe(e); > > result.setDataType(SampleResult.TEXT); > > result.setSamplerData("\n" + getXmlData()); > > The above has been done (but I removed the \n prefix) > > > result.setQueryString("\n" + getXmlData()); > > This was not done, as it was not asked for - see your original posting. > > Why do you need both set to the same value? > I'm not sure, but it only worked in the nightlies when I coded it as above. Thanks
OK, I've found the problem. The HTTPSample assumes that POST data is stored in the QueryString (dunno why); and when it overrides getSampleData it ignores samplerData entirely, so the information is not shown in the Tree View pane. This probably needs tidying up a bit; in the meanwhile, I've saved the data to the query string as well. Perhaps you could now try the new nightly? Also, please check that the correct information is being written to the JTL files
(In reply to comment #5) > OK, I've found the problem. > > The HTTPSample assumes that POST data is stored in the QueryString (dunno > why); and when it overrides getSampleData it ignores samplerData entirely, so > the information is not shown in the Tree View pane. > > This probably needs tidying up a bit; in the meanwhile, I've saved the data to > the query string as well. > > Perhaps you could now try the new nightly? > Also, please check that the correct information is being written to the JTL > files I tried out the new nightly it looks correct. Thanks a lot!
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/1708