org.apache.jmeter.protocol.http.util

Class WSDLHelper


public class WSDLHelper
extends Object

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

Field Summary

protected HashMap
ACTIONS
protected AuthManager
AUTH
String
BINDNAME
protected URLConnection
CONN
protected String
SOAPBINDING
protected Object[]
SOAPOPS
protected Document
WSDLDOC
protected URL
WSDLURL
-------------------------------------------- The members used by the class to do its work --------------------------------------------
protected URL
bindingURL

Constructor Summary

WSDLHelper(String url)
Default constructor takes a string URL
WSDLHelper(String url, AuthManager auth)

Method Summary

protected void
buildDocument()
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.
String
getBinding()
Returns the binding point for the webservice.
String
getBindingHost()
Return the host in the WSDL binding address
String
getBindingPath()
Return the path in the WSDL for the binding address
int
getBindingPort()
Return the port for the binding address
Object[]
getOperations()
Look at the bindings with soap operations and get the soap operations.
String
getProtocol()
Return the protocol from the URL. this is needed, so that HTTPS works as expected.
Object[]
getSOAPBindings()
Method will look at the binding nodes and see if the first child is a soap:binding.
String
getSoapAction(String key)
Return the soap action matching the operation name.
URL
getURL()
Returns the URL
Document
getWSDLDocument()
Get the wsdl document.
String[]
getWebMethods()
Get a list of the web methods as a string array.
static void
main(String[] args)
Simple test for the class uses bidbuy.wsdl from Apache's soap driver examples.
void
parse()
Call this method to retrieve the WSDL.

Field Details

ACTIONS

protected HashMap ACTIONS

AUTH

protected AuthManager AUTH

BINDNAME

public String BINDNAME

CONN

protected URLConnection CONN

SOAPBINDING

protected String SOAPBINDING

SOAPOPS

protected Object[] SOAPOPS

WSDLDOC

protected Document WSDLDOC

WSDLURL

protected URL WSDLURL
-------------------------------------------- The members used by the class to do its work --------------------------------------------

bindingURL

protected URL bindingURL

Constructor Details

WSDLHelper

public WSDLHelper(String url)
            throws MalformedURLException
Default constructor takes a string URL

WSDLHelper

public WSDLHelper(String url,
                  AuthManager auth)
            throws MalformedURLException

Method Details

buildDocument

protected void buildDocument()
            throws ParserConfigurationException,
                   IOException,
                   SAXException
Method is used internally to parse the InputStream and build the document using javax.xml.parser API.

close

protected void close()
We try to close the connection to make sure it doesn't hang around.

connect

protected void connect()
            throws IOException
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.

getBinding

public String 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

getBindingHost

public String getBindingHost()
Return the host in the WSDL binding address

getBindingPath

public String getBindingPath()
Return the path in the WSDL for the binding address

getBindingPort

public int getBindingPort()
Return the port for the binding address

getOperations

public Object[] 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[]

getProtocol

public String getProtocol()
Return the protocol from the URL. this is needed, so that HTTPS works as expected.

getSOAPBindings

public Object[] 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[]

getSoapAction

public String getSoapAction(String key)
Return the soap action matching the operation name.

getURL

public URL getURL()
Returns the URL
Returns:
the URL

getWSDLDocument

public Document getWSDLDocument()
Get the wsdl document.

getWebMethods

public String[] getWebMethods()
Get a list of the web methods as a string array.

main

public static void main(String[] args)
Simple test for the class uses bidbuy.wsdl from Apache's soap driver examples.
Parameters:
args -

parse

public void parse()
            throws WSDLException
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.

Copyright © 1998-2010 Apache Software Foundation. All Rights Reserved.