Package totalcross.xml.soap
Class SOAP
- java.lang.Object
-
- totalcross.xml.soap.SOAP
-
public class SOAP extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.StringalternativeReturnTagAn alternative tag used to identify when a tag is a answer tag.static booleandebugTurn this TRUE to print the xml in the console.static booleandisableEncodingThe SOAP request will ask the server for GZip or ZLib encoded response by default.
To disable encoding, set this field to true.protected HttpStreamhsThe HttpStream used to retrieve the last response.java.lang.Stringmtdjava.lang.Stringnamespacejava.lang.StringnamespaceIdintopenTimeoutThe open timeout for the connection.protected intparamIndexstatic java.lang.StringprefixThe prefix string used when sending requests.intreadTimeoutThe read timeout.protected java.lang.StringBuffersbufstatic java.lang.StringsuffixThe suffix string used when sending requests.java.lang.StringuribooleanwasCompressionUsedDeprecated.intwriteTimeoutThe write timeout.
-
Constructor Summary
Constructors Constructor Description SOAP(java.lang.String mtd, java.lang.String uri)Constructs a SOAP request with the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected HttpStream.OptionscreateOptions()Creates the options that will be sent to the HttpStream.voidexecute()This method must be called to execute the soap requestjava.lang.ObjectgetAnswer()Returns the answer of the soap request.voidsetObjectArrayParam(java.lang.String paramName, java.lang.String[] fieldNames, Vector fieldValues)voidsetObjectParam(java.lang.String paramName, java.lang.String[] fieldNames, java.lang.String[] fieldValues)Sets an object param identifying it asparamName.voidsetParam(boolean param)Sets a boolean parameter in the order of the method call, identifying it asarg+indexvoidsetParam(boolean[] param)Sets a boolean array parameter in the order of the method call, identifying it asarg+indexvoidsetParam(boolean[] param, java.lang.String paramName)Sets a boolean array parameter in the order of the method call, identifying it asparamName.voidsetParam(boolean param, java.lang.String paramName)Sets a boolean parameter in the order of the method call, identifying it asparamName.voidsetParam(byte[] param, java.lang.String paramName)Sets a byte array parameter in the order of the method call, identifying it asparamName.voidsetParam(double param)Sets a double parameter in the order of the method call, identifying it asarg+indexvoidsetParam(double[] param)Sets a double array parameter in the order of the method call, identifying it asarg+indexvoidsetParam(double[] param, java.lang.String paramName)Sets a double array parameter in the order of the method call, identifying it asparamName.voidsetParam(double param, java.lang.String paramName)Sets a double parameter in the order of the method call, identifying it asparamName.voidsetParam(int param)Sets a int parameter in the order of the method call, identifying it asarg+indexvoidsetParam(int[] param)Sets a int array parameter in the order of the method call, identifying it asarg+indexvoidsetParam(int[] param, java.lang.String paramName)Sets a int array parameter in the order of the method call, identifying it asparamName.voidsetParam(int param, java.lang.String paramName)Sets a int parameter in the order of the method call, identifying it asparamName.voidsetParam(java.lang.String param)Sets a string parameter in the order of the method call, identifying it asarg+indexvoidsetParam(java.lang.String[] param)Sets a String array parameter in the order of the method call, identifying it asarg+index.voidsetParam(java.lang.String[] param, java.lang.String paramName)Sets a String array parameter in the order of the method call, identifying it asparamName.voidsetParam(java.lang.String[] param, java.lang.String paramName, java.lang.String paramType)Sets an array parameter in the order of the method call.voidsetParam(java.lang.String param, java.lang.String paramName)Sets a string parameter in the order of the method call, identifying it asparamName.voidsetParam(java.lang.String param, java.lang.String paramName, java.lang.String paramType)Sets a parameter with the name and type specified.voiduseProxy(java.lang.String address, int port, java.lang.String username, java.lang.String password)Set the proxy settings to be used by this SOAP connection.
-
-
-
Field Detail
-
debug
public static boolean debug
Turn this TRUE to print the xml in the console. You may also setHttpStream.debugHeader = true. Caution: don't use this on device because it increases a lot the memory usage.
-
disableEncoding
public static boolean disableEncoding
The SOAP request will ask the server for GZip or ZLib encoded response by default.
To disable encoding, set this field to true.
-
hs
protected HttpStream hs
The HttpStream used to retrieve the last response.
-
wasCompressionUsed
@Deprecated public boolean wasCompressionUsed
Deprecated.A flag that indicates if the SOAP connection was using either GZip or ZLib. This is a ready-only flag, set during the execute method, and changing its value has no effect.
-
namespace
public java.lang.String namespace
-
namespaceId
public java.lang.String namespaceId
-
uri
public java.lang.String uri
-
mtd
public java.lang.String mtd
-
openTimeout
public int openTimeout
The open timeout for the connection. Defaults to 25 seconds.
-
readTimeout
public int readTimeout
The read timeout. Defaults to 60 seconds.
-
writeTimeout
public int writeTimeout
The write timeout. Defaults to 60 seconds.
-
alternativeReturnTag
public java.lang.String alternativeReturnTag
An alternative tag used to identify when a tag is a answer tag.
-
paramIndex
protected int paramIndex
-
prefix
public static java.lang.String prefix
The prefix string used when sending requests. Note that it uses UTF-8, so unicode characters are not supported.
-
suffix
public static java.lang.String suffix
The suffix string used when sending requests.
-
sbuf
protected java.lang.StringBuffer sbuf
-
-
Constructor Detail
-
SOAP
public SOAP(java.lang.String mtd, java.lang.String uri)Constructs a SOAP request with the given parameters. The default namespace will be used, along with an open timeout of 25 seconds, and a read and write timeout of 60 seconds.- Parameters:
mtd- The method you're calling.uri- The complete URI.
-
-
Method Detail
-
setParam
public void setParam(java.lang.String param, java.lang.String paramName, java.lang.String paramType)Sets a parameter with the name and type specified. Important: unicode characters are not accepted because the default header uses UTF-8.
-
setParam
public void setParam(java.lang.String param)
Sets a string parameter in the order of the method call, identifying it asarg+index- Parameters:
param-
-
setParam
public void setParam(java.lang.String param, java.lang.String paramName)Sets a string parameter in the order of the method call, identifying it asparamName.- Parameters:
param-paramName-
-
setParam
public void setParam(int param)
Sets a int parameter in the order of the method call, identifying it asarg+index- Parameters:
param-
-
setParam
public void setParam(int param, java.lang.String paramName)Sets a int parameter in the order of the method call, identifying it asparamName.- Parameters:
param-paramName-
-
setParam
public void setParam(double param)
Sets a double parameter in the order of the method call, identifying it asarg+index- Parameters:
param-
-
setParam
public void setParam(double param, java.lang.String paramName)Sets a double parameter in the order of the method call, identifying it asparamName.- Parameters:
param-paramName-
-
setParam
public void setParam(boolean param)
Sets a boolean parameter in the order of the method call, identifying it asarg+index- Parameters:
param-
-
setParam
public void setParam(boolean param, java.lang.String paramName)Sets a boolean parameter in the order of the method call, identifying it asparamName.- Parameters:
param-paramName-
-
setParam
public void setParam(java.lang.String[] param, java.lang.String paramName, java.lang.String paramType)Sets an array parameter in the order of the method call. The array type will beparamTypeand the name isparamName. Important: unicode characters are not accepted because the default header uses UTF-8.- Parameters:
param-paramName-paramType-
-
setParam
public void setParam(java.lang.String[] param)
Sets a String array parameter in the order of the method call, identifying it asarg+index. Important: unicode characters are not accepted because the default header uses UTF-8.- Parameters:
param-
-
setParam
public void setParam(java.lang.String[] param, java.lang.String paramName)Sets a String array parameter in the order of the method call, identifying it asparamName. Important: unicode characters are not accepted because the default header uses UTF-8.- Parameters:
param-paramName-
-
setParam
public void setParam(int[] param)
Sets a int array parameter in the order of the method call, identifying it asarg+index- Parameters:
param-
-
setParam
public void setParam(int[] param, java.lang.String paramName)Sets a int array parameter in the order of the method call, identifying it asparamName.- Parameters:
param-paramName-
-
setParam
public void setParam(byte[] param, java.lang.String paramName)Sets a byte array parameter in the order of the method call, identifying it asparamName.- Parameters:
param-paramName-
-
setParam
public void setParam(double[] param)
Sets a double array parameter in the order of the method call, identifying it asarg+index- Parameters:
param-
-
setParam
public void setParam(double[] param, java.lang.String paramName)Sets a double array parameter in the order of the method call, identifying it asparamName.- Parameters:
param-paramName-
-
setParam
public void setParam(boolean[] param)
Sets a boolean array parameter in the order of the method call, identifying it asarg+index- Parameters:
param-
-
setParam
public void setParam(boolean[] param, java.lang.String paramName)Sets a boolean array parameter in the order of the method call, identifying it asparamName.- Parameters:
param-paramName-
-
setObjectParam
public void setObjectParam(java.lang.String paramName, java.lang.String[] fieldNames, java.lang.String[] fieldValues)Sets an object param identifying it asparamName. The object fields names and values must be informed as the String arraysand . Important: unicode characters are not accepted because the default header uses UTF-8. - Parameters:
paramName-fieldNames-fieldValues-
-
setObjectArrayParam
public void setObjectArrayParam(java.lang.String paramName, java.lang.String[] fieldNames, Vector fieldValues)
-
getAnswer
public java.lang.Object getAnswer()
Returns the answer of the soap request. Important: the values may be escaped; use totalcross.ui.html.EscapeHtml.unescape to convert it back.- Returns:
- Object
-
createOptions
protected HttpStream.Options createOptions()
Creates the options that will be sent to the HttpStream. You can override this method to create the options and add your own options to it before returning.- Since:
- SuperWaba 5.83.
-
useProxy
public void useProxy(java.lang.String address, int port, java.lang.String username, java.lang.String password)Set the proxy settings to be used by this SOAP connection. You may optionally set the username and password for basic proxy authorization.
Proxy authorization is disabled if either username or password is null.- Parameters:
address- the proxy addressport- the proxy portusername- the username for basic proxy authorization. Passing a null value disables proxy authorization.password- the password for basic proxy authorization. Passing a null value disables proxy authorization.- Since:
- TotalCross 1.27
-
execute
public void execute() throws SOAPExceptionThis method must be called to execute the soap request- Throws:
SOAPException
-
-