java.lang.Object | +--com.tinnef.soap.SOAPHelper
Helper class to simplify access to SOAP services. To use this class you will need to use some of the Apache SOAP classes. They are accessible from Text Wielder replace statements, you just need to import them. For documentation on these classes go here.
Here is sample code demonstrating how to use this class:
//Create some constants String stockSymbol = "AAPL"; String url = "http://services.xmethods.net:80/soap"; String uri = "urn:xmethods-delayed-quotes"; String methodName = "getQuote"; //Create the SOAPHelper object SOAPHelper stockService = new SOAPHelper(url, uri, methodName); //Add the parameters stockService.addParameter(new Parameter("symbol", String.class, stockSymbol, null)); //Run the service Response resp = stockService.executeService(); // Check the response. if (resp.generatedFault ()) {
Constructor Summary | |
SOAPHelper(java.lang.String url,
java.lang.String uri,
java.lang.String methodName,
int timeout)
Construct a new SOAPHelper object. |
Method Summary | |
void |
addParameter(org.apache.soap.rpc.Parameter p)
Add a Parameter |
void |
clearParameters()
Remove all parameters |
org.apache.soap.rpc.Response |
executeService()
Execute the SOAP service. |
java.lang.String |
getMethodName()
Return the method name |
java.util.Vector |
getParameters()
Return the Vector of parameters |
int |
getTimeout()
Return the timeout |
java.lang.String |
getUri()
Return the URI as a string |
java.lang.String |
getUrl()
Return the URL as a string |
void |
setMethodName(java.lang.String methodNameIn)
Set the method name. |
void |
setTimeout(int newTimeout)
Set the timeout |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SOAPHelper(java.lang.String url, java.lang.String uri, java.lang.String methodName, int timeout) throws java.net.MalformedURLException
url
- The URL of the SOAP service.uri
- The URI of the SOAP service.methodName
- The method name to use for the SOAP service.timeout
- Timeout in ms.Method Detail |
public void setTimeout(int newTimeout)
public int getTimeout()
public java.lang.String getUrl()
public java.lang.String getUri()
public void setMethodName(java.lang.String methodNameIn)
methodNameIn
- The new method name.public java.lang.String getMethodName()
public java.util.Vector getParameters()
public void clearParameters()
public void addParameter(org.apache.soap.rpc.Parameter p)
p
- The Parameter to add.public org.apache.soap.rpc.Response executeService() throws org.apache.soap.SOAPException