Sunday, 15 September 2013

Conditional proxy server in python/perl/shell script -


I have an application that asks the host name: port for some service, some services during a webservice development One third is not available by the party or is not under construction, so to develop our application, I am thinking of using mockservices with soap as a stub for some services.

The problem is that I can only point out my application in one direction, so if I point out the house service, then I need to ensure that the fake service All services (& gt; 50), it is too overhead, so I was thinking of pointing to my application on a proxy server that would redirect some requests to Monarchives and send it to the actual service provider. Men will. Is there any way I can do this through a simple script?

Surely a thick sketch using perl:

  # ! Perl use strict; Use warnings; Plate :: app :: use proxy; My $ live_proxy = plack :: app :: proxy-> new (remote = & gt; "http://live.soap.service.com:80/"); My $ soapui_proxy = plack :: app :: proxy-> new (remote = & gt; "http: // localhost: 4567 /"); Sub (my $ env = shift; if ($ env- & gt; {REQUEST_URI} = ~ m [^ / some / path]) {return $ soapui_proxy- & gt; ($ env);} and {return $ live_proxy- ($ Env);}};   

Install it and run it as plackup filename . It creates two proxy apps, Which forwards all requests to the live service URL, and is the one who forwards all requests to your counterfeit service URL. The Cover app then selects the app to request any request based on the URL. To transmit (or based on something else, if required).

No comments:

Post a Comment