Tracing SharePoint adapter requests

How to track SharePoint requests

SharePoint adapter does not allow for configuring a proxy. So I will configure SharePoint proxy in BizTalk configuration file. And use Fiddler as the proxy to trace SharePoint web requests and responses.

Purpose of doing the steps below

The purpose is to force SharePoint Adapter to send data through Fiddler proxy. Only one SharePoint host instance will send the data through the proxy.

Caution

The default proxy defined in the BizTalk configuration file will work for all web requests. Make sure you restore the original BizTalk config file as soon as you restart SharePoint host instance.

To list the steps needed to trace SharePoint requests:

  1. Create ne 32 bit host, i.e. SharePointTestHost
  2. Create a host instance for the SharePointTestHost on a machine where you have Fiddler application installed
  3. Save original BTSNTSvc.exe.config file as original_BTSNTSvc.exe.config
  4. Modify BTSNTSvc.exe.config file by adding defaultProxy section at proper position
  5. Start SharePointTestHost host instance
  6. Save modified BTSNTSvc.exe.config as withproxy_BTSNTSvc.exe.config
  7. Rename original_BTSNTSvc.exe.config file back to BTSNTSvc.exe.config
  8. Now you are sure that only the host instance that you created will use the Fiddler proxy settings
  9. Configure a receive location, i.e. RecLoc1 to use the SharePointTestHost
  10. Start Fiddler
  11. Configure in Fiddler an option to decrypt https traffic (if BizTalk commuinicates with SharePoint using https protocol)
  12. Enable the receive location “RecLoc1”
  13. Wait for results

Note: if you trace 64 bit host instance, modify BTSNTSvc64.exe.config config file and not BTSNTS.exe.config file.

BizTalk Configuration section

The local proxy on port 8888 is the Fiddler proxy. Make sure the default proxy uses default credentials of the host instance by setting the useDefaultCredentials attribute to true.

<system.net>
    <!-- Setting to let SharePoint Web Requests go through Fiddler proxy -->
    <defaultProxy useDefaultCredentials="true">
      <proxy usesystemdefault="true" proxyaddress="http://127.0.0.1:8888" />
    </defaultProxy>
  </system.net>

Sample Fiddler results

2016-11-02-11_51_07-clipboard

Full contents of BTSNTSvc.exe.config file

Don’t just copy and paste the config file to your environment. I am also using SharePoint assemblies redirection from version 14 to version 15. Copy only the system.net section.

<?xml version="1.0" ?>
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" />
  </startup>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="BizTalk Assemblies;Developer Tools;Tracking;Tracking\interop" />
    </assemblyBinding>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.SharePoint.Client" publicKeyToken="71e9bce111e9429c" culture="neutral" />
        <bindingRedirect oldVersion="14.0.0.0" newVersion="15.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.SharePoint.Client.Runtime" publicKeyToken="71e9bce111e9429c" culture="neutral" />
        <bindingRedirect oldVersion="14.0.0.0" newVersion="15.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.net>
    <!-- Setting to let SharePoint Web Requests go through Fiddler proxy -->
    <defaultProxy useDefaultCredentials="true">
      <proxy usesystemdefault="true" proxyaddress="http://127.0.0.1:8888" />
    </defaultProxy>
  </system.net>
  <!-- End of SharePoint proxy settings -->
  <system.runtime.remoting>
    <channelSinkProviders>
      <serverProviders>
        <provider id="sspi" type="Microsoft.BizTalk.XLANGs.BTXEngine.SecurityServerChannelSinkProvider,Microsoft.XLANGs.BizTalk.Engine" securityPackage="ntlm" authenticationLevel="packetPrivacy" />
      </serverProviders>
    </channelSinkProviders>
    <application>
      <channels>
        <channel ref="tcp" port="0" name="">
          <serverProviders>
            <provider ref="sspi" />
            <formatter ref="binary" typeFilterLevel="Full"/>
          </serverProviders>
        </channel>
      </channels>
    </application>
  </system.runtime.remoting>
</configuration>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s