Sunday, 15 January 2012

c# - ServiceStack New API - How to get raw request/response -


I am using the new ServiceStack.Client to consume a ServiceStack API, And simple prototype for a customer, because they are using PHP, I would like to request the request to report the raw request and response using the internal service service.

Can I hook something away from the raw URL and data sent to the client, which is sent to the API and the raw JSON, which we are getting from the API call?

An example I am using:

var service = new JsonServiceClient (gko_url); Var response = service.Post & lt; Authentication & gt; ("/ Auth", authenticate new () {UserName = username, password = password, random = true});

If you are trying to inspect the raw HTTP request & amp; The response between the service stack client and the service is the easiest way to run a proxy on the same PC as a customer.

Then set the service stack client to use the fidder as proxy (by default To LocalHost Port 8888):

  var Client = New JsonServiceClient (gko_url); IWebProxy webProxy = New WebProxy ("http: // localhost: 8888"); Client Proxy = WebPix; Var response = client.Post & lt; Authentication & gt; ("/ Auth", authenticate new () {UserName = username, password = password, RememberMe = true});  

You can again inspect the raw HTTP request and response between the client and the server via the Fixer UI. This will give confidence to you and others on the "wire" communication, which is pure HTTP + JSON and language-independent.

This can be more effective for "showing", because you are not asking service stacks customers to give you raw HTTP communication - this is a completely different application (Fidler Web Proxy) is coming.


No comments:

Post a Comment