Class WebServiceSampler
java.lang.Object
org.apache.jmeter.testelement.AbstractTestElement
org.apache.jmeter.samplers.AbstractSampler
org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase
org.apache.jmeter.protocol.http.sampler.WebServiceSampler
- All Implemented Interfaces:
Serializable, Cloneable, ConfigMergabilityIndicator, Searchable, HTTPConstantsInterface, Sampler, TestElement, TestIterationListener, TestStateListener, ThreadListener
Sampler to handle Web Service requests. It uses Apache SOAP drivers to
perform the XML generation, connection, SOAP encoding and other SOAP
functions.
Created on: Jun 26, 2003
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class HTTPSamplerBase
HTTPSamplerBase.SourceType -
Field Summary
FieldsFields inherited from class HTTPSamplerBase
ARGUMENTS, AUTH_MANAGER, AUTO_REDIRECTS, BROWSER_COMPATIBLE_MULTIPART, BROWSER_COMPATIBLE_MULTIPART_MODE_DEFAULT, CACHE_MANAGER, CONCURRENT_DWN, CONCURRENT_POOL, CONCURRENT_POOL_SIZE, CONNECT_TIMEOUT, CONTENT_ENCODING, CONTENT_TYPE, COOKIE_MANAGER, DEFAULT_METHOD, DNS_CACHE_MANAGER, DO_MULTIPART_POST, DOMAIN, EMBEDDED_URL_RE, FOLLOW_REDIRECTS, HEADER_MANAGER, IMAGE_PARSER, IMPLEMENTATION, IP_SOURCE, IP_SOURCE_TYPE, MAX_FRAME_DEPTH, MAX_REDIRECTS, METHOD, MONITOR, NON_HTTP_RESPONSE_CODE, NON_HTTP_RESPONSE_MESSAGE, PATH, PORT, POST_BODY_RAW, POST_BODY_RAW_DEFAULT, PROTOCOL, PROXYHOST, PROXYPASS, PROXYPORT, PROXYUSER, RESPONSE_TIMEOUT, UNSPECIFIED_PORT, UNSPECIFIED_PORT_AS_STRING, URL, URL_UNSPECIFIED_PORT, URL_UNSPECIFIED_PORT_AS_STRING, USE_KEEPALIVEFields inherited from interface HTTPConstantsInterface
APPLICATION_X_WWW_FORM_URLENCODED, CACHE_CONTROL, CONNECT, CONNECTION_CLOSE, COPY, DATE, DEFAULT_HTTP_PORT, DEFAULT_HTTP_PORT_STRING, DEFAULT_HTTPS_PORT, DEFAULT_HTTPS_PORT_STRING, DELETE, ENCODING_GZIP, ETAG, EXPIRES, GET, HEAD, HEADER_AUTHORIZATION, HEADER_CONNECTION, HEADER_CONTENT_DISPOSITION, HEADER_CONTENT_ENCODING, HEADER_CONTENT_LENGTH, HEADER_CONTENT_TYPE, HEADER_COOKIE, HEADER_HOST, HEADER_LOCAL_ADDRESS, HEADER_LOCATION, HEADER_SET_COOKIE, HTTP_1_1, IF_MODIFIED_SINCE, IF_NONE_MATCH, KEEP_ALIVE, LAST_MODIFIED, LOCK, MKCALENDAR, MKCOL, MOVE, MULTIPART_FORM_DATA, OPTIONS, PATCH, POST, PROPFIND, PROPPATCH, PROTOCOL_HTTP, PROTOCOL_HTTPS, PUT, REPORT, TRACE, TRANSFER_ENCODING, UNLOCKFields inherited from interface TestElement
COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEncodedArgument(String name, String value, String metaData) We override this to prevent the wrong encoding and provide no implementation.booleanGet the maintain session option.booleanGet the memory cache.Return the proxy hostnameintReturn the proxy portprotected StringMethod is used internally to check if a random file should be used for the message.booleanReturn whether or not to read the response.Return the soap action string.intbooleanReturn whether or not to use proxymethod returns the WSDL URLGet the XML data as a string.Get the file location of the xml file.Get the path where XML messages are stored.sample()Sample the URL using Apache SOAP driver.protected HTTPSampleResultSamples the URL passed in and stores the result inHTTPSampleResult, following redirects and downloading page resources as appropriate.voidsetMaintainSession(boolean maintainSession) Set the maintain session option.voidsetMemoryCache(boolean cache) Set the memory cache.voidsetProxyHost(String host) Set the proxy hostnamevoidsetProxyPort(String port) Set the proxy portvoidsetReadResponse(boolean read) Set whether the sampler should read the response or not.voidsetSoapAction(String data) Set the soap action which should be in the form of an URN.voidsetTimeout(String text) voidsetUseProxy(boolean proxy) Set whether or not to use a proxyvoidsetWsdlURL(String url) voidsetXmlData(String data) Set the XML data.voidsetXmlFile(String filename) it's kinda obvious, but we state it anyways.voidsetXmlPathLoc(String path) Set the path where XML messages are stored for random selection.voidCalled once for all threads after the end of a test.voidCalled once for all threads after the end of a test.Methods inherited from class HTTPSamplerBase
addArgument, addArgument, addEncodedArgument, addEncodedArgument, addNonEncodedArgument, addTestElement, applies, clearTestElementChildren, clone, downloadPageResources, encodeBackSlashes, encodeSpaces, errorResult, followRedirects, getArguments, getAuthManager, getAutoRedirects, getCacheManager, getConcurrentPool, getConnectTimeout, getContentEncoding, getCookieManager, getDefaultPort, getDNSResolver, getDoBrowserCompatibleMultipart, getDomain, getDoMultipartPost, getEmbeddedUrlRE, getFollowRedirects, getHeaderManager, getHTTPFileCount, getHTTPFiles, getImplementation, getIpSource, getIpSourceType, getMethod, getMonitor, getPath, getPort, getPortIfSpecified, getPostBodyRaw, getProtocol, getProxyPass, getProxyPortInt, getProxyUser, getQueryString, getQueryString, getResponseTimeout, getSendFileAsPostBody, getSendParameterValuesAsPostBody, getSourceTypeList, getUrl, getUseKeepAlive, getUseMultipartForPost, getValidMethodsAsArray, hasArguments, isConcurrentDwn, isImageParser, isMonitor, isProtocolDefaultPort, isSecure, isSecure, isSuccessCode, parseArguments, parseArguments, readResponse, resultProcessing, sample, setArguments, setAuthManager, setAutoRedirects, setCacheManager, setConcurrentDwn, setConcurrentPool, setConnectTimeout, setContentEncoding, setCookieManager, setDNSResolver, setDoBrowserCompatibleMultipart, setDomain, setDoMultipartPost, setEmbeddedUrlRE, setFollowRedirects, setHeaderManager, setHTTPFiles, setImageParser, setImplementation, setIpSource, setIpSourceType, setMD5, setMethod, setMonitor, setMonitor, setPath, setPath, setPort, setPostBodyRaw, setProtocol, setResponseTimeout, setUseKeepAlive, testIterationStart, testStarted, testStarted, threadFinished, threadStarted, toString, useMD5Methods inherited from class AbstractTestElement
addPropertiesValues, addProperty, addProperty, canRemove, clear, clearTemporary, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traversePropertyMethods inherited from interface TestElement
canRemove, clear, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getThreadContext, getThreadName, isEnabled, isRunningVersion, isTemporary, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse
-
Field Details
-
MAINTAIN_SESSION_DEFAULT
public static final boolean MAINTAIN_SESSION_DEFAULT- See Also:
-
-
Constructor Details
-
WebServiceSampler
public WebServiceSampler()
-
-
Method Details
-
setXmlPathLoc
Set the path where XML messages are stored for random selection.- Parameters:
path- where XML messages are stored
-
getXmlPathLoc
Get the path where XML messages are stored. This is the directory where JMeter will randomly select a file.- Returns:
- path where XML messages are stored
-
setXmlFile
it's kinda obvious, but we state it anyways. Set the xml file with a string path.- Parameters:
filename- path to xml file
-
getXmlFile
-
getRandomFileName
Method is used internally to check if a random file should be used for the message. Messages must be valid. This is one way to load test with different messages. The limitation of this approach is parsing XML takes CPU resources, so it could affect JMeter GUI responsiveness.- Returns:
- String filename
-
setXmlData
-
getXmlData
-
setSoapAction
Set the soap action which should be in the form of an URN.- Parameters:
data- soap action
-
getSoapAction
-
setMaintainSession
public void setMaintainSession(boolean maintainSession) Set the maintain session option.- Parameters:
maintainSession- flag whether to maintain a session
-
getMaintainSession
public boolean getMaintainSession()Get the maintain session option.- Returns:
- flag whether to maintain a session
-
setMemoryCache
public void setMemoryCache(boolean cache) Set the memory cache.- Parameters:
cache- flag whether to use the memory cache
-
getMemoryCache
public boolean getMemoryCache()Get the memory cache.- Returns:
- flag whether to use the memory cache
-
setReadResponse
public void setReadResponse(boolean read) Set whether the sampler should read the response or not.- Parameters:
read- flag whether the response should be read
-
getReadResponse
public boolean getReadResponse()Return whether or not to read the response.- Returns:
- flag whether the response should be read
-
setUseProxy
public void setUseProxy(boolean proxy) Set whether or not to use a proxy- Parameters:
proxy- flag whether to use a proxy
-
getUseProxy
public boolean getUseProxy()Return whether or not to use proxy- Returns:
trueif a proxy should be used
-
setProxyHost
Set the proxy hostname- Parameters:
host- the hostname of the proxy
-
getProxyHost
Return the proxy hostname- Overrides:
getProxyHostin classHTTPSamplerBase- Returns:
- the proxy hostname
-
setProxyPort
-
getProxyPort
public int getProxyPort()Return the proxy port- Returns:
- the proxy port
-
setWsdlURL
- Parameters:
url- the URL of the WSDL
-
getWsdlURL
-
sample
Description copied from class:HTTPSamplerBaseSamples the URL passed in and stores the result inHTTPSampleResult, following redirects and downloading page resources as appropriate.When getting a redirect target, redirects are not followed and resources are not downloaded. The caller will take care of this.
- Specified by:
samplein classHTTPSamplerBase- Parameters:
u- URL to samples- HTTP method: GET, POST,...b- whether we're getting a redirect targeti- Depth of this target in the frame structure. Used only to prevent infinite recursion.- Returns:
- results of the sampling, can be null if u is in CacheManager
-
sample
Sample the URL using Apache SOAP driver. Implementation note for myself and those that are curious. Current logic marks the end after the response has been read. If read response is set to false, the buffered reader will read, but do nothing with it. Essentially, the stream from the server goes into the ether.- Overrides:
samplein classHTTPSamplerBase- Returns:
- results of the sampling
-
addEncodedArgument
We override this to prevent the wrong encoding and provide no implementation. We want to reuse the other parts of HTTPSampler, but not the connection. The connection is handled by the Apache SOAP driver.- Overrides:
addEncodedArgumentin classHTTPSamplerBase
-
convertSoapHeaders
-
getTimeout
-
getTimeoutAsInt
public int getTimeoutAsInt() -
setTimeout
-
testEnded
public void testEnded()Description copied from class:HTTPSamplerBaseCalled once for all threads after the end of a test. This will use the same element instances as at the start of the test.
N.B. testStarted() and testEnded() are called from different threads.
- Specified by:
testEndedin interfaceTestStateListener- Overrides:
testEndedin classHTTPSamplerBase- See Also:
-
testEnded
Description copied from class:HTTPSamplerBaseCalled once for all threads after the end of a test. This will use the same element instances as at the start of the test.
N.B. testStarted() and testEnded() are called from different threads.
- Specified by:
testEndedin interfaceTestStateListener- Overrides:
testEndedin classHTTPSamplerBase- Parameters:
host- name of host- See Also:
-