Skip to content
Lukasz W edited this page Apr 15, 2016 · 5 revisions

UI view of the Custom Sampler:

The sampler appears in sampler list as 'Custom SOAP Sampler'. It can work with one or more attachments (multiple attachments) and also without attachments, this way behaving as normal Soap sampler.

As seen in the screenshot it has the following features:

  • drop-down for SOAP protocol version with values 1_1 and 1_2
  • URL - endpoint for the request
  • checkbox 'Treat selected attachment as response'. If this is enabled then for services that in response return attachments the assertions can be made. So if the option is enabled there is a choice to locate the proper attachment in response by content type or content ID
  • fields for adding attachment: browser to locate the file, checkbox 'Use relative paths', Content ID, type (values: resource, value). If resource is added then the content of the file is loaded as stream to the attachment object. If value is selected then the value from text is taken 'as is'.
  • content-type. Values: auto, text/plain, text/xml, text/html, application/xml, application/gzip. If other types are required then the project needs to be updated and rebuilt.
  • buttons to Add and Remove attachments

Other than that the sampler behaves just as other ordinary sampler.

Programmatic use of the plugin in JSR223 PreProcessor, for example to add, delete attachments from the code because there is exposed a getter: 'getAttachmentDefinition()':

//add attachments ArrayList attList = new ArrayList(); def att1 = ctx.getCurrentSampler().getAttachmentDefinition();

att1.attachment = new File(pathToFile); att1.contentID ="someContentID"; att1.contentType="application/xml"; //one of selections from the dropdown att1.type=1; //1 means resource, 2 means variable

attList.add(att1);

//confirm (set) adding all attachments ctx.getCurrentSampler().setAttachments(attList);

Clone this wiki locally