SOAPe is a tool that was developed primarily for testing and troubleshooting EWS, though can also support other web services. It has a built-in EWS trace analyser that can assist in identifying issues and spotting errors.
SOAPe is available from Github, and full source is published: https://github.com/David-Barrett-MS/SOAPe
Analysing EWS Traces
The EWS Managed API (also available from Github, though note that you'll want to link to this one as it includes various bugfixes) can trace all EWS requests/responses it makes by setting up and attaching a trace listener (e.g. this one). The Java API also supports adding a trace listener, but if you are using any other API (or SOAP directly), then you'll need to implement your own trace listener.
The first step in troubleshooting an EWS issue is usually to look at the EWS trace, so it is important to ensure that your application is capable of capturing such a trace. For a production application, this is still important but of course you'll want to add an option to enable and disable such a trace (an application running in production would not normally want to create a full EWS trace except when troubleshooting issues).
Once you have an EWS trace, load it in SOAPe. To do this:
- Open SOAPe, then open the Log Viewer (Tools..., Log Viewer...)
- Click Load Log..., and browse to the EWS trace to load. Depending upon the size of the log, it may take some time to load.
- Once the log is loaded, SOAPe then goes through the trace looking for errors in the EWS responses. Any found are highlighted:
Note that for a large log, it may take a little time for the errors to be highlighted as SOAPe does this in the background.
- The list on the left shows the calls that were made, and the timing. It also shows the thread (this is useful in troubleshooting multi-threaded applications, as the EWS Managed API stored the thread it is working on). Columns can be sorted by clicking the column header, and the default sort is by time (for multithreaded applications, it is best to sort by thread Id, which will secondarily sort by time). This list is good for analysing patterns, and spotting where optimisations could be implemented.
- To look at a specific data entry, just select it from the list on the left and you'll see the payload on the right:
- The right-click menu of the content viewer allows you to validate Xml, and has some other useful options:
Testing EWS Requests
You can test EWS requests directly from SOAPe using the main window. You can copy/paste information from the log viewer, or use one of SOAPe's built in templates (click the Load from Template button to open the template viewer). The template viewer has a selection of templates that allow you to create an EWS request. The following screenshot shows how to create a FindFolder request to retrieve information on the Inbox. Note that if you use any of the distinguished folder names (as detailed here) for folder, then the template will show this as a DistinguishedFolderId. Otherwise, use the EWS Id of the folder.
Clicking Ok will put the EWS request to the main SOAPe window.
To send the request, ensure that all the settings (such as EWS URL, credentials, impersonation, etc.) are set correctly in the main SOAPe window, and then click Send. A successful response will look like this:
Note that SOAPe also creates a trace (it can be found in the same folder as the application) that can be analysed in the log viewer (SOAPe automatically loads its own trace when the log viewer is first opened).
SOAPe also has some other features, including an HTTP listener that can be used to test EWS push subscriptions, and a Base64 decoder which can be used to decode any Base64 content that is returned (or for encoding data for a request).