Class WSDLHelper
java.lang.Object
org.apache.jmeter.protocol.http.util.WSDLHelper
For now I use DOM for WSDLHelper, but it would be more efficient to use JAXB
to generate an object model for WSDL and use it to perform serialization and
deserialization. It also makes it easier to traverse the WSDL to get
necessary information.
Created on: Jun 3, 2003
-
Constructor Summary
ConstructorsConstructorDescriptionWSDLHelper
(String url) Default constructor takes a string URLWSDLHelper
(String url, AuthManager auth) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Method is used internally to parse the InputStream and build the document using javax.xml.parser API.protected void
close()
We try to close the connection to make sure it doesn't hang around.protected void
connect()
Method is used internally to connect to the URL.Returns the binding point for the webservice.Return the host in the WSDL binding addressReturn the path in the WSDL for the binding addressint
Return the port for the binding addressObject[]
Look at the bindings with soap operations and get the soap operations.Return the protocol from the URL. this is needed, so that HTTPS works as expected.getSoapAction
(String key) Return the soap action matching the operation name.getSoapActionName
(String soapAction) return the "wsdl method name" from a soap actionObject[]
Method will look at the binding nodes and see if the first child is a soap:binding.getURL()
Returns the URLString[]
Get a list of the web methods as a string array.Get the wsdl document.static void
Simple test for the class uses bidbuy.wsdl from Apache's soap driver examples.void
parse()
Call this method to retrieve the WSDL.
-
Constructor Details
-
WSDLHelper
Default constructor takes a string URL- Parameters:
url
- url to the wsdl- Throws:
MalformedURLException
- ifurl
is malformed
-
WSDLHelper
- Parameters:
url
- url to the wsdlauth
-AuthManager
to use- Throws:
MalformedURLException
- ifurl
is malformed
-
-
Method Details
-
getURL
Returns the URL- Returns:
- the URL
-
getProtocol
Return the protocol from the URL. this is needed, so that HTTPS works as expected.- Returns:
- protocol extracted from url
-
getBindingHost
Return the host in the WSDL binding address- Returns:
- host extracted from url
-
getBindingPath
Return the path in the WSDL for the binding address- Returns:
- path extracted from url
-
getBindingPort
public int getBindingPort()Return the port for the binding address- Returns:
- port extracted from url
-
getBinding
Returns the binding point for the webservice. Right now it naively assumes there's only one binding point with numerous soap operations.- Returns:
- String
-
connect
Method is used internally to connect to the URL. It's protected; therefore external classes should use parse to get the resource at the given location.- Throws:
IOException
- when I/O error occurs
-
close
protected void close()We try to close the connection to make sure it doesn't hang around. -
buildDocument
Method is used internally to parse the InputStream and build the document using javax.xml.parser API.- Throws:
ParserConfigurationException
- When buildingDocumentBuilder
failsIOException
- when reading the document failsSAXException
- when parsing the document fails
-
parse
Call this method to retrieve the WSDL. This method must be called, otherwise a connection to the URL won't be made and the stream won't be parsed.- Throws:
WSDLException
- when parsing fails
-
getWebMethods
Get a list of the web methods as a string array.- Returns:
- list of web methods
-
getSoapAction
Return the soap action matching the operation name.- Parameters:
key
- name of the operation- Returns:
- associated action
-
getWSDLDocument
Get the wsdl document.- Returns:
- wsdl document
-
getSOAPBindings
Method will look at the binding nodes and see if the first child is a soap:binding. If it is, it adds it to an array.- Returns:
- Node[]
-
getOperations
Look at the bindings with soap operations and get the soap operations. Since WSDL may describe multiple bindings and each binding may have multiple soap operations, we iterate through the binding nodes with a first child that is a soap binding. If a WSDL doesn't use the same formatting convention, it is possible we may not get a list of all the soap operations. If that is the case, getSOAPBindings() will need to be changed. I should double check the WSDL spec to see what the official requirement is. Another option is to get all operation nodes and check to see if the first child is a soap:operation. The benefit of not getting all operation nodes is WSDL could contain duplicate operations that are not SOAP methods. If there are a large number of methods and half of them are HTTP operations, getting all operations could slow things down.- Returns:
- Node[]
-
getSoapActionName
return the "wsdl method name" from a soap action- Parameters:
soapAction
- the soap action- Returns:
- the associated "wsdl method name" or null if not found
-
main
Simple test for the class uses bidbuy.wsdl from Apache's soap driver examples.- Parameters:
args
- standard arguments for a main class (not used here)
-