Skip to Content
Technical Articles

Step by Step with the SAP Cloud Platform SDK for Android — Part 11 — Using Fiddler to Trace Client Network Requests

Previous (SAML and OAuth)   Home   Next (Server Logging and Tracing)

Fiddler can be used to track requests made by the app to the server, allowing the user to have an easier time debugging application requests and seeing both the app’s requests and the server’s responses.

The below examples will modify the sample and device to route any network requests through Fiddler.
Configure Fiddler
Configure Device
Configure App

Configure Fiddler

  1. In Fiddler, select Tools > Options.
  2. Under HTTPS, enable Decrypt HTTPS traffic.
    Click on No as for the prompt to configure Windows to trust the root certificate.
  3. Under the Connections tab, ensure that the “Allow remote computers to connect” checkbox is checked.
  4. Uncheck “Act as system proxy on startup” so that Fiddler only captures traffic that is specifically proxied through it.
  5. Restart Fiddler.

Configure Device

In this step, we will setup the device to route its Wi-Fi connection through Fiddler.

  1. In an Android 7.1 or higher emulator, go to Settings > Network & Internet > Wi-Fi.
  2. Modify your current Wi-Fi network (varies by device, click on the gear or possibly long press) and open “Advanced options”.
  3. Set “Proxy” to “Manual” and set the “Proxy hostname” and “Proxy port” so that all the device’s network requests will be sent through fiddler.

    “Proxy hostname” should be set to the IP address of the computer that is running Fiddler. It can be found by running the command ipconfig from a command prompt. “Proxy port” can be found under Tools > Options > Connections > Fiddler listens on port (default is 8888).
  4. Save and go to http://ipv4.fiddler:8888/
  5. Click on “FiddlerRoot certificate” to download the certificate.
  6. Name the certificate (ie. Fiddler) and tap OK.

    If the above screen does not appear, you may need to turn off Google Play Protect. Ensure it is turned back on after installing the certificate.

See Documentation for more details.

Configure App

In this step, we will allow Step by Step app to allow certificates added by users.

    1. Create a new xml file named “network_security_config” under the res/xml folder
    2. Replace the contents of the newly created network_security_config.xml file with the following:
      <?xml version="1.0" encoding="utf-8"?>
      <network-security-config>
          <base-config>
              <trust-anchors>
                  <certificates src="system" />
                  <certificates src="user" />
              </trust-anchors>
          </base-config>
      </network-security-config>
    3. In the AndroidManifest.xml file, in the application section add the below line.
      android:networkSecurityConfig="@xml/network_security_config"

Now you should be able to see the requests made by the app to the server, such as the OData call seen below.

Note, if the message Responsebody is encoded appears, click on it to decode.

Previous (SAML and OAuth)   Home   Next (Server Logging and Tracing)

Be the first to leave a comment
You must be Logged on to comment or reply to a post.