Web Service Debug logging

When enabled, MPS Web Service logging saves out the XML input (request) as well as the XML output (response) for each Web Service Request. This can be helpful in identifying malformed requests as a result of bugs in Web or Client interfaces or as a result of invalid data being submitted to the Web Services. The input XML files can be resubmitted through provtest for further troubleshooting after some minor modification.

Enabling MPS Web Service Debug Logging

To enable MPS Web Service Debug Logging you need to edit the MPSWS Web.Config file which is typically found at the following location: "C:\Program Files\Microsoft Hosting\Provisioning\MPSWS".

To enable logging you need to set the WriteDebug value = "true" and ensure that the DebugFilePath value is set to a valid location on the local hard disk. Here is a sample snippet from a Web.Config file configured for Web Service logging:

<?xml version="1.0" encoding="iso-8859-1" ?>
<configuration>
...
		<appSettings>
				<add key="WriteDebug" value="true" />
				<add key="DebugFilePath" value="C:\Debug\" />
				<!-- to enable event sink set to 1. Otherwise leave at 0-->
				<add key="EnableEventSink" value="1"/>
		</appSettings> 

It is important to ensure that the DebugFilePath value is set to a path that exists, otherwise you will get a .Net exception similar to the following:

System.IO.DirectoryNotFoundException: Could not find a part of the path "C:\Debug\<RequestName><TimeStamp>IN.xml". at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at System.Xml.XmlDocument.Save(String filename) at MPSWS.Utilities.SubmitRequest(XmlDocument requestXml)  

More on MPS Web Service Debug Logging

Once enabled a seperate file will be created under the DebugFilePath for each Request and one for each corresponding response the files are named as follows:

Note: A busy server may have hundreds if not thousands of files created under the DebugFilePath within minutes. This can have an impact on extremely busy Web Services servers with slow IO. However, the impact is typically minimal.

Resubmitting a Request through ProvTest

Besides the ability to know exactly what the request looked like, one of the valuable troubleshooting techniques that Web Service Logging enables is the ability to modify and resubmit the same request through ProvTest in order to further isolate an issue. To do this you must first slightly modify the Request file.

We'll look for example at one of the most common Web Services requests made by the Sample Web UI and/or Sample Control Panel. The request is to a Managed Hosting namespace procedure called GetCallerUIRoles.

<?xml version="1.0" encoding="iso-8859-1"?>
<request>
  <data>
	<hostingPath>LDAP://OU=Hosting,DC=fabrikam,DC=Com</hostingPath>
	<preferredDomainController>ADEXBE.fabrikam.com</preferredDomainController>
  </data>
  <procedure>
	<execute namespace="Managed Hosting" procedure="GetCallerUiRoles">
	<before source="data" destination="executeData" mode="merge" />
	<after source="executeData" destination="data" mode="insert" />
	</execute>
  </procedure>
  <context>
	<securityContext>
	<authentication>
		<basic username="FABRIKAM\Administrator" password="********" />
	</authentication>
	</securityContext>
  </context>
</request>

In order to resubmit this request, you need to deal with the password attribute of the basic authentication node as it has been populated with asterisks, to conceal the password. There are two options here you can set the correct password or remove the entire <context> node from this request. Resetting the password allows you to control the context of the request, removing the <context> node causes the request to be submitted under the context of the user you are logged in as when runnning provtest.

After fixing or removing the <context> node in the above file you can simply run ProvTest to submit this request as follows:

C:\Debug>provtest /x2 GetCallerUiRoles_Monday_11h16m50s_IN.xml
<response>
  <data>
	<hostingPath>LDAP://OU=Hosting,DC=fabrikam,DC=Com</hostingPath>
	<preferredDomainController>ADEXBE.fabrikam.com</preferredDomainController>
	<executeData>
	<hostingPath>LDAP://OU=Hosting,DC=fabrikam,DC=Com</hostingPath>
	<preferredDomainController>ADEXBE.fabrikam.com</preferredDomainController>
	<uiRoles>
		<uiRole>6000</uiRole>
		<uiRole>5000</uiRole>
		<uiRole>2000</uiRole>
		<uiRole>1500</uiRole>
		<uiRole>1000</uiRole>
		<uiRole>0500</uiRole>
		<uiRole>0100</uiRole>
		<uiRole>0000</uiRole>
	</uiRoles>
	<highestUiRole>6000</highestUiRole>
	</executeData>
  </data>
</response>

Note: This request will only work after adding the Provisioning Tools directory to your local path as described here.

[an error occurred while processing this directive]