Repeating webrequest (emulate Charles Proxy) - c#

i just want to ask you about a way to make something like what charles proxy do! www.charlesproxy.com it injects or makes proxy between it and browser, so it record each step (Sending and receive or Download and upload), i just wanna to make a project that inject or to be proxy then record the uploaded and received data! :) That's all!
Or just want to know how to start? is it WebRequest as i said?! or how to make it to be proxy via Chrome as example.
If anyone don't know it, just ask what is it?! and i can answer ;).

Many systems use proxies that are openly available in code across many platforms. For instance, one I've used in the past for proxying GIS queries is the ESRI proxy. The source can be found at https://github.com/Esri/resource-proxy and it is quite complete, including forwarding form parameters, iirc. In this case the proxy is used something along the lines of http://proxyurl.com/proxy.ashx?http://www.requestedsite.com. I would start by checking out the source for the .NET subtree of that GIT repo.

Related

How do i set up a SOAP webservice

First off a little context, I work for a channel manager company that builds custom endpoints for their clients to talk to. We currently mostly code in c#.
This is the first time we are connecting with a client that asked us to support a soap web service.
Sadly, we don't have previous experience in this and I can't find any concrete explanations to what it looks like to support a SOAP call.
Currently, it looks like that I have to simply use text processing methods to run through the received XML and parse it in a non-generic way.
But this feels like there should be a more straightforward approach since the protocol is almost 20 years old.
For almost every search result I only get examples of what the XML looks like, but what I'm interested in, is what I need to implement in my application to host an endpoint for the client to successfully post and receive a SOAP message from. And if there is a way to do this without something like XmlWriters/Readers.
Anything to help me get on my way mary is appreciated!
Greetings, Davey
WCF is the least outdated library for offering SOAP.
When you can define the contracts then you're in luck, that's just writing a C# interface.
But when necessary you can also import WSDL specifications and generate C# from that.
it looks like that I have to simply use text processing methods to run through the received XML and parse it
Don't even consider that. Everything is under control of schemas. And you will also have to generate valid return packages.

Windows Phone 8 Communication

I have various questions about windows phone 8 communications which I hope someone out there will be able to clarify.
What is the best method to communicate between a wp8 device and a server? WCF, OData, Json, Webclient, other? Does anyone know what is the recommend standard if any?
Based on 1, will using SSL or similar work? How do you encrypt data over the wire if SSL is not a an option.
Sample on how to use wcf (or other) using Async Await? The sample I'm working on, though not familiar with it all, I'm using wcf and I'm confused as to how I should go about it. Assume the following basic scenario:
a) The user is provided with a logon page. The user then clicks Login.
b) The proxy is first opened by calling the .Open (should I call openasync?).
c) A wcf call is made to call the .LogonUser (should I call LogonUserAsync?).
d) The proxy is then closed by calling .Close (should I call CloseAsync?).
Again I'm confused as if I don't use asynchronous call, it doesn't feel right, thought it might be ok. Can someone confirm this? Second, if I use async, should I call the .LogonUser from inside the OpenCompleted event and then call the .Close within the LogonUserCompleted? Seems messy and dirty coding? Again I could be completely off, but it just doesn't feel right?
Is there any good sample out there providing and explaining step by step on what should be the correct communication protocol that should be use and how to use it. Most of the wcf sample I'm finding never seem to call the .Open & .Close methods which I assume is a must and that's maybe why it is omitted but again, it's not obvious when you don't know what you're doing.
Should wcf (or any other) always call open & close for each call made i.e. logon, search, etc... rather than keeping this open for the entire session when the application is opened and re-using the same object?
Thanks and sorry for the many questions in one post.
Thanks.
T.
#1 There is no rule of thumb to decide which is the best method amongst: WCF, OData, Json,
I think what should be used should be decided by the requirement. In Windows Phone you can use any of these,.
#2 If you are not using SSL, then you can think of private/public key encryption
#3 I am not sure about whether openasync() should be really used. In one of my project I have consumed WCF service without calling openasync(). You should use Aync methods.

Custom WMS Service

I'm doing an program, which is running on an local system, with no internet access. Is it possible to create my own custom Web Map Service (WMS) server, using C#. I no that there are free open source system's. But i like to have full control.
Thanks Morten Starck
That is very possible, but you might be in for a headache or two before you are done. The implementation specification and more is available from the Open Geospatial Consortium at the url below.
http://www.opengeospatial.org/standards/wms
It's quite a large specification but you might be able to get away with implementing only the parts you really need and leaving some of the more specific stuff out. You will of course also need to parse and render the map data from some source which might be your largest problem (for which I really would suggest you have a look at SharpMap, http://sharpmap.codeplex.com/ instead of rolling your own).

As3 Communicate with C# or Asp.net

I have been looking around for hours trying to find a clear simple solution to my question and have yet to find a good answer. I am trying to do a URL request in flash to my NOPCommerce site. I want to pass a GET value to the my .cs file which i'll then use that value to grab specific information and return it back to flash. How would I set up the C# or asp.net side of things? If anyone could give me an example of what I am looking for I would greatly appreciate it.
I don't know if I am supposed to use a .aspx, .cs or .ascx file.
Thanks,
Brennan
I found it to be extremely simple with web services in as3. Here is a link to see what I mean
As3 Web Services
Use the HttpWebRequest class to GET the variables, do the magic and return a result by invoking the HttpWebRequest again.
Examples and usage here:
http://www.csharp-station.com/HowTo/HttpWebFetch.aspx
You have a few options for server-side communication with flash.
Flash remoting. This is the most popular because it's the most performant, but not the easiest to understand at first glance. It transfers data in a binary format. Available libraries are Weborb and Fluorine.
Web Services as mentioned in a previous post.
Ajax/JSON. I think with Flash Player 11.3, JSON decoding is native in the player now.
Straight up http request.
Sockets (not recommended for beginners)
To answer your question as you asked it, though, for all but #4, you'd be using a CS file to retrieve your data. For #4, you'd most likely be using an .aspx page, but it could be a combination of .aspx and .ascx files.
My recommendation is that you do some research on each of these methods to decide what would work best with your development environment, required level of security, and project. Then, ask specific questions about each method as necessary.
Good Luck!

Help Conceptualizing XML HTTP POST Automation through Application Layer

For this post, I'm looking for more conceptual help than a specific technical solution (although anything helps).
Basically, I've been asked to automate an XML HTTP POST through an application layer. I've never done anything like this before, so I'm a bit confused where to even start on a high level. It would be great if someone could share with me what steps I would need to take to accomplish this task. Here is some more background information:
Currently, our company uses an application (we'll call it Program.exe) on a daily basis to design front-end interfaces with a visual editor. Once the interface is completed, Program.exe creates JSP files and submits them to the server. Unfortunately, the process of creating and sending the files takes an awfully large number of clicks, so management would like to automate this process by running a script that would take the project files from Program.exe, convert them to JSP and accurately submit them through the application layer of Program.exe to the appropriate server.
So far I have used WireShark to sniff the packets of a simple transaction using Program.exe and discovered a number of HTTP/XML POST packets that contained XML data with information like "Current File Name" "User name" and more. Curiously, all of these data items were submitted in different packets, not all in one. There are also multiple references to SOAP. (I have almost no knowledge of SOAP, except that it exists)
At this point, this is all of the information I have. I am unsure what steps I should take from here. I would really like to understand this process on a high level, so any conceptual information would be greatly appreciated.
Finally, we use C# primarily for these sorts of tasks, so if someone would like to share a technical solution feel free to use C#.
Thank you all very much.
I would tackle this by completely ignoring the expected method of solving the problem (generating an HTTP POST) and instead focusing on what the actual problem is.
What are your inputs? A bunch of JSP files by the sound of it.
What are your outputs? The same bunch of JSP files.
What has to be accomplished? Moving the inputs from one know location to another.
Now with a well defined problem, a solution is much more likely to clearly present itself.
For example, by looking at the problem I've defined I would think that XCopy would be an elegant solution to the problem.
Any time I get handed a solution and then told to go solve a certain problem, I am always highly suspicious of the tool I've been given. If they knew that this was the best solution to the problem, why didn't they do it themselves?
My advice: Find your own solution.
Hope that helps!

Categories

Resources