Class SOAP


  • public class SOAP
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.lang.String alternativeReturnTag
      An alternative tag used to identify when a tag is a answer tag.
      static boolean debug
      Turn this TRUE to print the xml in the console.
      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.
      protected HttpStream hs
      The HttpStream used to retrieve the last response.
      java.lang.String mtd  
      java.lang.String namespace  
      java.lang.String namespaceId  
      int openTimeout
      The open timeout for the connection.
      protected int paramIndex  
      static java.lang.String prefix
      The prefix string used when sending requests.
      int readTimeout
      The read timeout.
      protected java.lang.StringBuffer sbuf  
      static java.lang.String suffix
      The suffix string used when sending requests.
      java.lang.String uri  
      boolean wasCompressionUsed
      Deprecated.
      int writeTimeout
      The 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.Options createOptions()
      Creates the options that will be sent to the HttpStream.
      void execute()
      This method must be called to execute the soap request
      java.lang.Object getAnswer()
      Returns the answer of the soap request.
      void setObjectArrayParam​(java.lang.String paramName, java.lang.String[] fieldNames, Vector fieldValues)  
      void setObjectParam​(java.lang.String paramName, java.lang.String[] fieldNames, java.lang.String[] fieldValues)
      Sets an object param identifying it as paramName.
      void setParam​(boolean param)
      Sets a boolean parameter in the order of the method call, identifying it as arg+index
      void setParam​(boolean[] param)
      Sets a boolean array parameter in the order of the method call, identifying it as arg+index
      void setParam​(boolean[] param, java.lang.String paramName)
      Sets a boolean array parameter in the order of the method call, identifying it as paramName.
      void setParam​(boolean param, java.lang.String paramName)
      Sets a boolean parameter in the order of the method call, identifying it as paramName.
      void setParam​(byte[] param, java.lang.String paramName)
      Sets a byte array parameter in the order of the method call, identifying it as paramName.
      void setParam​(double param)
      Sets a double parameter in the order of the method call, identifying it as arg+index
      void setParam​(double[] param)
      Sets a double array parameter in the order of the method call, identifying it as arg+index
      void setParam​(double[] param, java.lang.String paramName)
      Sets a double array parameter in the order of the method call, identifying it as paramName.
      void setParam​(double param, java.lang.String paramName)
      Sets a double parameter in the order of the method call, identifying it as paramName.
      void setParam​(int param)
      Sets a int parameter in the order of the method call, identifying it as arg+index
      void setParam​(int[] param)
      Sets a int array parameter in the order of the method call, identifying it as arg+index
      void setParam​(int[] param, java.lang.String paramName)
      Sets a int array parameter in the order of the method call, identifying it as paramName.
      void setParam​(int param, java.lang.String paramName)
      Sets a int parameter in the order of the method call, identifying it as paramName.
      void setParam​(java.lang.String param)
      Sets a string parameter in the order of the method call, identifying it as arg+index
      void setParam​(java.lang.String[] param)
      Sets a String array parameter in the order of the method call, identifying it as arg+index.
      void setParam​(java.lang.String[] param, java.lang.String paramName)
      Sets a String array parameter in the order of the method call, identifying it as paramName.
      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.
      void setParam​(java.lang.String param, java.lang.String paramName)
      Sets a string parameter in the order of the method call, identifying it as paramName.
      void setParam​(java.lang.String param, java.lang.String paramName, java.lang.String paramType)
      Sets a parameter with the name and type specified.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • debug

        public static boolean debug
        Turn this TRUE to print the xml in the console. You may also set HttpStream.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 as arg+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 as paramName.
        Parameters:
        param -
        paramName -
      • setParam

        public void setParam​(int param)
        Sets a int parameter in the order of the method call, identifying it as arg+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 as paramName.
        Parameters:
        param -
        paramName -
      • setParam

        public void setParam​(double param)
        Sets a double parameter in the order of the method call, identifying it as arg+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 as paramName.
        Parameters:
        param -
        paramName -
      • setParam

        public void setParam​(boolean param)
        Sets a boolean parameter in the order of the method call, identifying it as arg+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 as paramName.
        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 be paramType and the name is paramName. 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 as arg+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 as paramName. 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 as arg+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 as paramName.
        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 as paramName.
        Parameters:
        param -
        paramName -
      • setParam

        public void setParam​(double[] param)
        Sets a double array parameter in the order of the method call, identifying it as arg+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 as paramName.
        Parameters:
        param -
        paramName -
      • setParam

        public void setParam​(boolean[] param)
        Sets a boolean array parameter in the order of the method call, identifying it as arg+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 as paramName.
        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 as paramName. The object fields names and values must be informed as the String arrays and . 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 address
        port - the proxy port
        username - 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 SOAPException
        This method must be called to execute the soap request
        Throws:
        SOAPException