JMeter groovy pre-processor results in "invalid attachment" when trying to configure “Custom SOAP Sampler” -


i'm trying create groovy-based pre-processor (jsr223preprocessor) **custom soap sampler* plugin, intended cover following tasks:

  • read list of file attachments csv input file;
  • empty list of attachments registered custom soap sampler;
  • register attachments read csv file custom soap sampler.

after quite extensive research on net--i'm new whole groovy, java, jmeter topic--, managed assemble groovy script shown below.

// read data csv input file arraylist reclst = new arraylist(); string fldsep = vars.get("fldsep"); string fldhd = vars.get("fldhd");  integer = 0; // todo: test/debugging new file(vars.get("indat")).eachline('utf-8') {     if ((it != null) && (fldhd != null) && (!it.trim().equals(fldhd.trim()))) {         reclst.add(it.trim());     } // if } // file.eachline  // extract relevant parts , feed custom soap sampler (registered attachments) // csv format:  tmstmp;prodid;tenid;fnam;mdat if (reclst.size() > 0) {     // empty current attachment list     // removed code block it's throwing exception      // create new attachment list     arraylist newatts = new arraylist();      (rec in reclst) {         string[] flds = rec.split(fldsep);          def attdef = ctx.getcurrentsampler().getattachmentdefinition();         attdef.attachment = new file(flds[3]);          attdef.contentid = "flds[0]";          attdef.contenttype = "application/pdf"; // 1 of selections dropdown (no pdf listed there)         attdef.type = 1;                        // 1 = resource, 2 = variable          newatts.add(attdef);     } //      if (newatts.size() > 0) {         ctx.getcurrentsampler().setattachments(newatts);     } // if } // if 

in 2 previous posts (initial, round #2) faced issue blazemeter's step-by-step-debugger plugin, issue when trying empty list of registered attachments. yet challenge popped existence.

exectuing test plan results in jmeter displaying error message again.

unable update attachment references, see log files details. 

the jmeter.log file no contains

<nul><nul><nul><nul><nul><nul><nul><nul>... ...<nul><nul><nul><nul>... ... 2017/04/07 09:21:12 info  - jmeter.engine.standardjmeterengine: running test!  2017/04/07 09:21:12 info  - jmeter.samplers.sampleevent: list of sample_variables: []  2017/04/07 09:21:13 info  - jmeter.gui.util.jmetermenubar: setrunning(true,*local*)  2017/04/07 09:21:13 info  - jmeter.engine.standardjmeterengine: starting threadgroup: 1 : number of users (single key)  2017/04/07 09:21:13 info  - jmeter.engine.standardjmeterengine: starting 1 threads group number of users (single key).  2017/04/07 09:21:13 info  - jmeter.engine.standardjmeterengine: thread continue on error  2017/04/07 09:21:13 info  - jmeter.threads.threadgroup: starting thread group number 1 threads 1 ramp-up 1 perthread 1000.0 delayedstart=false  2017/04/07 09:21:13 info  - jmeter.threads.threadgroup: started thread group number 1  2017/04/07 09:21:13 info  - jmeter.engine.standardjmeterengine: thread groups have been started  2017/04/07 09:21:13 info  - jmeter.threads.jmeterthread: thread started: number of users (single key) 1-1  2017/04/07 09:21:13 info  - jmeter.services.fileserver: stored: /media/sf_projects/tstprj/archive/tstdoc.csv  2017/04/07 09:21:14 warn  - com.jmeter.protocol.soap.sampler.customsoapsampler: ignoring invalid attachment: '/media/sf_projects/tstprj/archive/tstdoc/tstdoc-00000.pdf'  2017/04/07 09:21:14 warn  - com.jmeter.protocol.soap.sampler.customsoapsampler: ignoring invalid attachment: '/media/sf_projects/tstprj/archive/tstdoc/tstdoc-00001.pdf'  2017/04/07 09:21:14 warn  - com.jmeter.protocol.soap.sampler.customsoapsampler: ignoring invalid attachment: '/media/sf_projects/tstprj/archive/tstdoc/tstdoc-00002.pdf'  2017/04/07 09:21:14 warn  - com.jmeter.protocol.soap.sampler.customsoapsampler: ignoring invalid attachment: '/media/sf_projects/tstprj/archive/tstdoc/tstdoc-00003.pdf' ... 2017/04/07 09:21:14 error - com.jmeter.protocol.soap.sampler.customsoapsampler: caught exception while updating attachments javax.xml.soap.soapexception: inputstream not represent valid soap 1.2 message     @ com.sun.xml.internal.messaging.saaj.soap.ver1_2.soappart1_2impl.createenvelopefromsource(soappart1_2impl.java:72)     @ com.sun.xml.internal.messaging.saaj.soap.soappartimpl.getenvelope(soappartimpl.java:128)     @ com.jmeter.protocol.soap.sampler.customsoapsampler.updateattachmentreferences(customsoapsampler.java:448)     @ com.jmeter.protocol.soap.sampler.customsoapsampler.sample(customsoapsampler.java:256)     @ org.apache.jmeter.threads.jmeterthread.executesamplepackage(jmeterthread.java:475)     @ org.apache.jmeter.threads.jmeterthread.processsampler(jmeterthread.java:418)     @ org.apache.jmeter.threads.jmeterthread.run(jmeterthread.java:249)     @ java.lang.thread.run(thread.java:745)  2017/04/07 09:23:00 info  - jmeter.threads.jmeterthread: stopping thread: org.apache.jorphan.util.jmeterstopthreadexception: unable update attachment references  2017/04/07 09:23:00 info  - jmeter.threads.jmeterthread: stop thread detected thread: number of users (single key) 1-1  2017/04/07 09:23:00 info  - jmeter.threads.jmeterthread: thread finished: number of users (single key) 1-1  2017/04/07 09:23:00 info  - jmeter.engine.standardjmeterengine: notifying test listeners of end of test  2017/04/07 09:23:00 info  - jmeter.services.fileserver: close: /media/sf_projects/tstprj/archive/tstdoc.csv  2017/04/07 09:23:00 info  - jmeter.gui.util.jmetermenubar: setrunning(false,*local*)  

as drop down list contenttype not contain application/pdf entry, replaced application/gzip, still no avail. regardless of content type set, results in same error/log file entries.

one step further still @ loss, how tackle issue.

my setup comprises:

  • ubuntu linux 17.04;
  • apache jmeter 3.1 r1770033;
  • blazemeter step-by-step debugger 0.3;
  • custom soap sampler 1.3;
  • groovy 2.4.7 (scripting engine 2.0).

sample input csv file

tmstmp;prodid;tenid;fnam;mdat '20170406112044044970077';'prod01';'tenant03';'/media/sf_projects/tstprj/archive/tstdoc/tstdoc-00000.pdf';'<?xml version=1.0 encoding=utf-8?><tstpfx:metainformation xmlns:tstpfx=http://my.host.local/tstprj/metainformation_v2.xsd id=000000069496>meta data #01</tstpfx:metainformation> ' '20170406112047030620037';'prod02';'tenant01';'/media/sf_projects/tstprj/archive/tstdoc/tstdoc-00001.pdf';'<?xml version=1.0 encoding=utf-8?><tstpfx:metainformation xmlns:tstpfx=http://my.host.local/tstprj/metainformation_v2.xsd id=000000069496>meta data #02</tstpfx:metainformation> ' 

this file getting read twice: (1) jsr223 pre-processor build attachment list; (2) custom soap sampler, subsequently iterates on each entry of file, , passes relevant bits & bobs soap envelop

<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tstprj="http://my.host.local/">    <soapenv:header/>    <soapenv:body>       <tstprj:archive>          <product>${prodid}</product>          <tenant>${tenid}</tenant>          <filename>${fnam}</filename>          <metadata>${mdat}</metadata>          <content>cid:${tmstmp}</content>       </tstprj:archive>    </soapenv:body> </soapenv:envelope> 


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -