com.worklight.wlclient.api

Interface WLResponseListener

    • Method Detail

      • onSuccess

        void onSuccess(WLResponse response)
        This method is called following successful calls to the WLClient.connect(WLResponseListener) or WLClient.invokeProcedure(WLProcedureInvocationData, WLResponseListener).

        This method is also the success delegate for ChallengeHandler.submitLoginForm(String, Hashtable, Hashtable, String) or ChallengeHandler.submitAdapterAuthentication(WLProcedureInvocationData, WLRequestOptions). For ChallengeHandler, this method is called when a successful HTTP response is received (200 OK). This method does not indicate whether the challenge was successful or not. A 200 HTTP response can flow back indicating problems with authentication on the server or requesting additional information. Some examples of a 200 HTTP response are as follows:

        • First init request returns a normal 200 HTTP response that requests a pkms login form
        • Authentication failed on the server
        • A 200 HTTP response, indicating that the account is locked on the server due to too many failed login attempts

        Note: IBM MobileFirst Platform does not attempt to determine what the 200 response means. This is a good place to check whether the response is a custom response and handle it accordingly. If the response is not a custom response, you can call submitSuccess to indicate that all is good from your challenge handler's perspective, and that IBM MobileFirst Platform can handle the response instead.

        Parameters:
        response - The response that the server returns, along with any invocation context object and status.
      • onFailure

        void onFailure(WLFailResponse response)
        This method is called if any failure occurred during the execution of the WLClient.connect(WLResponseListener) or WLClient.invokeProcedure(WLProcedureInvocationData, WLResponseListener).

        This method is the failure delegate for com.worklight.wlclient.api.challengehandler.ChallengeHandler#submitLoginForm(String, Map, Map, int, String) or ChallengeHandler.submitAdapterAuthentication(WLProcedureInvocationData, WLRequestOptions). For ChallengeHandler, this method is called when a response does not have a 200 HTTP status code. This method does not indicate whether the challenge was successful or not. In some cases onFailure is an indication of a normal challenge handling sequence. An example of when the onFailure method is called is when a 401 Unauthorized response is received. A successful handshake can entail several 401 response iterations and therefore several onFailure calls. This behavior is all part of the normal handshake between two parties that are trying to establish identity. IBM MobileFirst Platform handles the handshakes for core challenges iteratively until all of the credentials are established and the necessary challenges are processed. This is a good place to check whether the response is a custom response and handle it accordingly. If the response is not a custom response, you can call submitSuccess to indicate that all is good from your challenge handler's perspective, and that IBM MobileFirst Platform can handle the response instead.

        Parameters:
        response - A response that contains the error code and error message. Optionally, it can also contain the results from the server and any invocation context object and status.


© Copyright IBM Corp. 2006, 2015. All Rights Reserved.