免费的工具-Fiddler(查探Vault API的调用流程)

来源:互联网 发布:淘宝联盟等级划分 编辑:程序博客网 时间:2024/04/29 04:51

转载自:It's all just ones and zeros -> Fiddling with the Vault API

For a while, I’ve been looking for a good way to detect if binary transfer is set up properly for a Vault app.  I’ve finally found that way, and its name is Fiddler

If you don’t know what Fiddler is, it’s a tool that lets you monitor HTTP traffic on your computer.  It’s the type of utility that has millions of uses, but I’ll be focusing only on using it to help with Vault programming.  Since Vault uses web services for server communication, you can use Fiddler to verify that your files are transferring properly.

One of the aspects of the Vault API is that you need to configure things very specifically in order to get files to transfer in a binary mode.  If you get a step wrong, then files get transferred as text.   But your app still works, so it’s a tricky problem to locate.  I’ll show you how to use Fiddler to verify the binary transfer.


Steps:

  1. Install Fiddler.
  2. Open Fiddler.
  3. Run your app.  Make sure to have a real computer name as the Vault server; do not use “localhost” or “127.0.0.1”.
  4. Upload or download a file.  The size of the file does not matter, but I suggest a binary file, such as an image.
  5. In Fiddler, locate the entry that corresponds to the API call that performed the file transfer. 
    1. The left pane, shows all the HTTP requests.  Vault API calls will show the URL of the web service.
    2. The right top pane shows the outgoing request.  For Vault API calls, this has the raw SOAP data, including the function name and parameter set.
    3. The bottom right pane shows the incoming response.  For Vault API calls, this has the raw SOAP data, this has the function name and return values.
    4. You can use either pane on the right to find the function name.  It’s best to use the Text View and scroll to the bottom of the pane.  The element directly inside <soap:Body> is the function name.
  6. If you are doing an upload, you want to check the outgoing pane at the right-top.  If you are doing a download, you want to check the incoming pane at the right-bottom.
  7. If you configured things correctly, there should be a section at the bottom indicating a MIME attachment.  There may also be a gibberish representation of the binary data. 
    If you configured things incorrectly, there will be no MIME attachment.  The file data will show as a large text string in a function parameter or return value.

If things are good, Fiddler should show something like this: 
 
(click image for larger view)

 

If things are bad, Fiddler will show something like this: 
 
(click image for larger view)

 

NOTE:  When things are configured incorrectly, with MTOM not enabled, you can use the XML View in Fiddler.  When MTOM is correctly turned on, then the XML View is blank.


原创粉丝点击