Using WinHTTP Logging to Verify Get Traffic

If the generic host and client succeed but the actual host and client still fail, it is possible that the metadata request is not being initiated. WinHTTP logging can be used to verify that outbound messages are being generated and sent correctly.

WSDAPI-based client applications use WinHTTP to connect to devices. WSDAPI-based device hosts do not use WinHTTP. Also, some third-party proxies do not use WinHTTP. When troubleshooting a host or proxy that does not use WinHTTP, skip this diagnostic procedure and continue troubleshooting by following the procedures in Inspecting Network Traces for HTTP Metadata Exchange.

WinHTTP logging does not show all TCP-level traffic. Skip to Inspecting Network Traces for HTTP Metadata Exchange if traffic besides the HTTP traffic is of interest.

Bb648705.wedge(en-us,VS.85).gifTo use WinHTTP logging to verify Get traffic

  1. Capture the WinHTTP logs.
  2. Start Notepad or another text editor. The text editor must be run as Administrator.
  3. Open the WinHTTP log file.
  4. Verify that the required HTTP requests and metadata messages were sent.

If a Get message for the host is found in the WinHTTP logs, then the metadata requests are being sent to WinHTTP successfully. Continue troubleshooting by following the procedures in Inspecting Network Traces for HTTP Metadata Exchange.

If a Get message cannot be found for the host in the WinHTTP logs, then the metadata request is not being initiated. This can happen when the host publishes invalid XAddrs. Verify that the XAddrs on the host conform to the XAddr validation rules.

Verifying that the required HTTP requests and metadata messages were sent

The following events must occur for successful metadata exchange:

  • The WSDAPI client generates an outbound HTTP request. This request is sent to the WSDAPI host.
  • The client sends a Get message to the host.

These events are captured in the WinHTTP logs.

The following WinHTTP log file snippet shows an outbound HTTP request generated by a WSDAPI client.

16:51:47.893 ::*0000004* :: WinHttpSendRequest(0x36aae0, "", 0, 0x0, 0, 658, 0)
16:51:47.893 ::*0000004* :: WinHttpSendRequest() returning TRUE
16:51:47.897 ::*0000004* :: sending data:
16:51:47.897 ::*0000004* :: 226 (0xe2) bytes
16:51:47.897 ::*0000004* :: <<<<-------- HTTP stream follows below ----------------------------------------------->>>>
16:51:47.897 ::*0000004* :: POST /dbe17c74-3b21-4f52-addc-b84b444f73a0 HTTP/1.1
16:51:47.897 ::*0000004* :: Content-Type: application/soap+xml
16:51:47.897 ::*0000004* :: User-Agent: WSDAPI
16:51:47.897 ::*0000004* :: Host: 192.168.0.1:5357
16:51:47.897 ::*0000004* :: Content-Length: 658
16:51:47.897 ::*0000004* :: Connection: Keep-Alive
16:51:47.897 ::*0000004* :: Cache-Control: no-cache
16:51:47.897 ::*0000004* :: Pragma: no-cache
16:51:47.897 ::*0000004* :: 
16:51:47.897 ::*0000004* :: 
16:51:47.897 ::*0000004* :: <<<<-------- End ----------------------------------------------->>>>

The following WinHTTP log file snippet shows a Get message. This message should immediately follow the HTTP request.

16:51:47.898 ::*0000004* :: WinHttpWriteData(0x36aae0, 0x11aa7c4, 658, 0x0)
16:51:47.899 ::*0000004* :: sending data:
16:51:47.899 ::*0000004* :: 658 (0x292) bytes
16:51:47.899 ::*0000004* :: <<<<-------- HTTP stream follows below ----------------------------------------------->>>>
16:51:47.899 ::*0000004* :: <?xml version="1.0" encoding="utf-8" ?>
16:51:47.899 ::*0000004* :: <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"><soap:Header><wsa:To>urn:uuid:dbe17c74-3b21-4f52-addc-b84b444f73a0</wsa:To><wsa:Action>http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</wsa:Action><wsa:MessageID>urn:uuid:8506ac50-3646-4621-9680-86f484d87909</wsa:MessageID><wsa:ReplyTo><wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address></wsa:ReplyTo><wsa:From><wsa:Address>urn:uuid:b32467b5-e7ee-4ae3-8a8e-f5aa417c23b6</wsa:Address></wsa:From></soap:Header><soap:Body></soap:Body></soap:Envelope>
16:51:47.899 ::*0000004* :: <<<<-------- End ----------------------------------------------->>>>
16:51:47.899 ::*0000004* :: WinHttpWriteData() returning TRUE

The Action element (<wsa:Action>http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</wsa:Action>) identifies the message as a Get message. Verify that the value of the To element (for example, <wsa:To>urn:uuid:dbe17c74-3b21-4f52-addc-b84b444f73a0</wsa:To>) matches the device ID advertised by the host in the original UDP WS-Discovery messages. The device ID advertised by the host can be checked by using the WSD Debug Host. For more information, see Using a Generic Host and Client for UDP WS-Discovery.

In addition, the host's response to the metadata request can be found in the client's WinHTTP logs. The host generates a GetResponse message in response to the client's Get message.

The following WinHTTP log file snippet shows an inbound GetResponse message received by a WSDAPI client.

16:51:47.899 ::*0000004* :: WinHttpReceiveResponse(0x36aae0, 0x0)
16:51:47.899 ::*0000004* :: WinHttpReceiveResponse() returning TRUE
16:51:47.899 ::*Session* :: DllMain(0x73fc0000, DLL_THREAD_ATTACH, 0x0)
16:51:47.902 ::*0000004* :: received data:
16:51:47.902 ::*0000004* :: 1024 (0x400) bytes
16:51:47.902 ::*0000004* :: <<<<-------- HTTP stream follows below ----------------------------------------------->>>>
16:51:47.902 ::*0000004* :: HTTP/1.1 200 
16:51:47.902 ::*0000004* :: Content-Type: application/soap+xml
16:51:47.902 ::*0000004* :: Server: Microsoft-HTTPAPI/2.0
16:51:47.902 ::*0000004* :: Date: Fri, 15 Jun 2007 23:51:47 GMT
16:51:47.905 ::*0000004* :: Content-Length: 2228
16:51:47.905 ::*0000004* :: 
16:51:47.905 ::*0000004* :: <?xml version="1.0" encoding="utf-8" ?>
16:51:47.905 ::*0000004* :: <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsdp="http://schemas.xmlsoap.org/ws/2006/02/devprof" xmlns:un0="http://schemas.microsoft.com/windows/pnpx/2005/10" xmlns:pub="http://schemas.microsoft.com/windows/pub/2005/07"><soap:Header><wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To><wsa:Action>http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse</wsa:Action><wsa:MessageID>urn:uuid:2884cbcc-2848-4c35-9327-5ab5451a8729</wsa:MessageID><wsa:RelatesTo>urn:uuid:8506ac50-3646-4621-9680-86f484d87909</wsa:RelatesTo></soap:Header><soap:Body><wsx:Metadata><wsx:MetadataSection Dialect="http://schemas.xmlsoap.org/ws/2006/02/devprof/ThisDevice"><wsdp:ThisDevice><wsd
16:51:47.905 ::*0000004* :: <<<<-------- End ----------------------------------------------->>>>

The Action element (<wsa:Action>http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse</wsa:Action>) identifies the message as a GetResponse message. Verify that the value of the RelatesTo element of the GetResponse message matches the value of the MessageID element of the Get message. In this example, the value of the RelatesTo element (<wsa:RelatesTo>urn:uuid:8506ac50-3646-4621-9680-86f484d87909</wsa:RelatesTo>) matches the value of the MessageID element of the Get message (<wsa:MessageID>urn:uuid:8506ac50-3646-4621-9680-86f484d87909</wsa:MessageID>).

Related topics

WinHTTP
Capturing WinHTTP Logs
WSDAPI Diagnostic Procedures
Getting Started with WSDAPI Troubleshooting

 

 

Community Additions

ADD
Show: