RestServiceAdapter instead.@Deprecated
public interface RestServiceAdapter
| Modifier and Type | Field and Description | 
|---|---|
| static String | REQUEST_TYPE_DELETEDeprecated.  | 
| static String | REQUEST_TYPE_GETDeprecated.  | 
| static String | REQUEST_TYPE_POSTDeprecated.  | 
| static String | REQUEST_TYPE_PUTDeprecated.  | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addRequestProperty(String key,
                  String value)Deprecated.  Add request property to the request header | 
| void | clearRequestProperties()Deprecated.  Clear all previously set request properties | 
| void | close(javax.microedition.io.HttpConnection connection)Deprecated.  Close the provided connection. | 
| String | getConnectionEndPoint(String connName)Deprecated.  Return the end point of the connection, for the specified connection name,
 found in connections.xml. | 
| String | getConnectionName()Deprecated.  Set the connection name (referenced in connections.xml) that REST requests
 should be directed to. | 
| javax.microedition.io.HttpConnection | getHttpConnection(String requestMethod,
                 String request,
                 Object httpHeadersValue)Deprecated.  Initializes and returns an HttpConnection, using the provided request
 method, request, and HTTP headers value. | 
| java.io.InputStream | getInputStream(javax.microedition.io.HttpConnection connection)Deprecated.  Open and return an input stream for the provided connection. | 
| java.io.OutputStream | getOutputStream(javax.microedition.io.HttpConnection connection)Deprecated.  Open and return an output stream for the provided connection. | 
| java.util.HashMap | getRequestProperties()Deprecated.  | 
| String | getRequestType()Deprecated.  | 
| String | getRequestURI()Deprecated.  | 
| String | getResponseContentType()Deprecated.  Retrieve the content type of the response | 
| String | getResponseHeader(String key)Deprecated.  Retrieve response header | 
| java.util.HashMap | getResponseHeaders()Deprecated.  | 
| String | getResponseMessage()Deprecated.  | 
| int | getResponseStatus()Deprecated.  | 
| int | getRetryLimit()Deprecated.  | 
| void | removeRequestProperty(String key)Deprecated.  Remove a request property from the request header | 
| String | send(String payload)Deprecated.  Send the REST request with the given payload | 
| byte[] | sendReceive(String payload)Deprecated.  Send the REST request with the given payload | 
| java.io.InputStream | sendRequest(String payload)Deprecated.  Send a REST request with the given payload. | 
| void | setConnectionName(String name)Deprecated.  Set the connection name (referenced in connections.xml) that REST requests
 should be directed to. | 
| void | setRequestType(String getPostPutDelete)Deprecated.  Set the request type for the REST call | 
| void | setRequestURI(String uri)Deprecated.  Set the additional request URI | 
| void | setRetryLimit(int retries)Deprecated.  Set the maximum retries any request should attempt before determining the
 request will not succeed. | 
static final String REQUEST_TYPE_GET
static final String REQUEST_TYPE_POST
static final String REQUEST_TYPE_PUT
static final String REQUEST_TYPE_DELETE
void addRequestProperty(String key,
                        String value)
key - value - void clearRequestProperties()
void removeRequestProperty(String key)
key - java.util.HashMap getRequestProperties()
String getResponseHeader(String key)
key - java.util.HashMap getResponseHeaders()
void setRequestType(String getPostPutDelete)
getPostPutDelete - should be either GET, POST, PUT, or DELETEString getRequestType()
int getRetryLimit()
void setRetryLimit(int retries)
retries - String getConnectionName()
void setConnectionName(String name)
name - String send(String payload)
     throws Exception
payload - ExceptionRestWebServiceOperation.invoke(java.lang.String,
      java.util.Map)byte[] sendReceive(String payload)
            throws Exception
payload - ExceptionRestWebServiceOperation.invoke(java.lang.String,
      java.util.Map)java.io.InputStream sendRequest(String payload)
                         throws java.io.IOException
ChunkedInputStreamclass to read the
 stream.
 
 See .6.1
payload - the payload to send to the server.java.io.IOExceptionjavax.microedition.io.HttpConnection getHttpConnection(String requestMethod,
                                                       String request,
                                                       Object httpHeadersValue)
                                                throws Exception
 
  // Create an instance of a RestServiceAdapter
  RestServiceAdapter restServiceAdapter = Model.createRestServiceAdapter();
  // Clear any previously set request properties, if any
  restServiceAdapter.clearRequestProperties();
  // Specify the type of request
  String requestMethod = RestServiceAdapter.REQUEST_TYPE_GET;
  // Get the connection end point from connections.xml
  String requestEndPoint = restServiceAdapter.getConnectionEndPoint("GeoIP");
  // Get the URI which is defined after the end point
  String requestURI = "/xml/" + someIpAddress;
  // The request is the end point + the URI being set
  String request = requestEndPoint + requestURI;
  // Specify some custom request headers
  HashMap httpHeadersValue = new HashMap();
  httpHeadersValue.put("Accept-Language", "en-US");
  httpHeadersValue.put("My-Custom-Header-Item", "CustomItem1");
  // Get the connection
  HttpConnection connection = restServiceAdapter.getHttpConnection(requestMethod, request, httpHeadersValue);
 
 requestMethod - should be either GET, POST, PUT, or DELETErequest - the fully qualified request (end point + request URI)httpHeadersValue - An Object that implements the Map interface. Its key/value pairs
          are assigned as request properties to the returned connection.ExceptionHttpConnectionjava.io.OutputStream getOutputStream(javax.microedition.io.HttpConnection connection)
                              throws Exception
connection - ExceptionHttpConnectionjava.io.InputStream getInputStream(javax.microedition.io.HttpConnection connection)
                            throws Exception
connection - ExceptionHttpConnectionvoid close(javax.microedition.io.HttpConnection connection)
connection - ExceptionHttpConnectionString getConnectionEndPoint(String connName)
                      throws Exception
connName - the connection name of the connection to find in connections.xmlExceptionint getResponseStatus()
String getResponseMessage()
String getResponseContentType()
void setRequestURI(String uri)
uri - String getRequestURI()