HttpConversation Workflow

Add and use HttpConversation in your Android project to support SAML-enabled registration.


To successfully complete this procedure, you need to get the Android Native Client SDK libraries. The libraries are available as part of the SAP Mobile Platform Client SDK Installer. HttpConversation is shipped in AAR files

Before you can use HttpConversation, you must add associated artifacts. You also need to add dependent JARs, AARs, and configure your build settings. For the rest of the procedure, we assume that you are starting a new project for Android. If you are working with an existing project, the steps may vary.


  1. Create a new project or open an existing one in Android Studio.
  2. Ensure that AndroidManifest.xml contains INTERNET permission:
    <uses-permission android:name="android.permission.INTERNET"/>
  3. Copy these files into the libs folder of your project:
    • HttpConversation.aar
    • HttpConvAuthFlows.aar
    • ClientLog.jar
    • sap-E2ETrace.aar
    • simple-xml.aar
    • SupportabilityFacade.aar
  4. Create a new Activity class or open an existing one.
  5. Implement the classes by adding code.
    1. Add fields and constants such as:
      //the conversation manager that will be used throughout the application
      HttpConversationManager conversationManager;
      //button to start the sample conversation
      Button startConvButton;
      //text view to present response in 
      TextView responseView;
      String response;
      public static final String TAG = "Sample";
      public static final String URL = "";
    2. Prepare a conversation manager instance:
      * helper method to prepare conversationManager instance
      private void prepareConversationManager(){
         //create an instance of Default configurator
         IManagerConfigurator commonConfigurator = new CommonAuthFlowsConfigurator(this);
         //instantiate conversation manager
         conversationManager = new HttpConversationManager(this);
         //configure the manager with the selected configurator
    3. Prepare a conversation instance:
      * helper method to prepare a simple conversation
      * @return IHttpConversation instance of conversation or null
      private IHttpConversation prepareConversation(String url){
         IHttpConversation conv = null;
         try {
      	conv = conversationManager.create(new URL(url));
      	//optionally manipulate the request before it will be sent out.
      	conv.setRequestListener(new IRequestListener() {
      		public Object onRequestHeaderSending(ISendEvent arg0) {
      			// TODO Auto-generated method stub
      			return null;
      		public Object onRequestBodySending(ITransmitEvent arg0) throws IOException {
      			// TODO Auto-generated method stub
      			return null;
      	//implement logic that needs to be executed when the response received
      	conv.setResponseListener(new IResponseListener() {
      		public void onResponseReceived(IReceiveEvent event) throws IOException {
      		   //helper method to convert an input stream to string
                   response = getStringFromInputStream(event.getStream());
      		   Log.i(TAG, "got response: " + response);
  Runnable() {
      			 public void run() {
      		} catch (MalformedURLException e) {
      		return conv;
    4. Add an onCreate method such as:
      protected void onCreate(Bundle savedInstanceState) {
          //instatiate and initialize our conversationManager
          //find the sample button from the current content view
          startConvButton = (Button) findViewById(;
          //find the sample button from the current content view
          responseView = (TextView) findViewById(;
          //set onClickListener
          startConvButton.setOnClickListener(new OnClickListener() {
      	  public void onClick(View v) {
      	     //prepare conversation
      		IHttpConversation conv = prepareConversation(URL);
      		//if the conversation was prepared successfuly start it.