How to make a simple proxy server? - delphi

I wanted to create a simple proxy to my localhost(xampp). I've looked into IdHTTPProxyServer but there is no available example of how to use it.
my intention is to monitor the Post/Get request of my application at runtime just like a debugger.
my application will Post/Get through localhost:8080 and then my proxy will be served as a bridge to localhost:80
any suggestion or example?
I am using D2009, D2010 must support Unicode.
Thank you in advance.

I know it's not Indy, but Synapse (I use it with Lazarus) has a Proxy Server Example included which should work on Delphi too. It worked well for me on FPC. The Demo is included in the Sources you get here:
http://www.ararat.cz/synapse/doku.php/download

You may use Overbyte ICS TCP/IP library, on the "user made" page you have a lot of proxy samples, one is tgphttpproxy.

Related

how to call a soap webservice made in delphi (on apache) from curl

In Delphi 11 Alexandria, I created a simple SOAP webservice using File->New->Soap Server. I asked to create the demo interfaces, I have built the project, corrected Apache conf, and I have copied the DLL inside Apache's module directory.
So, if I request:
http://127.0.0.1:81/xyz/mod_webbroker.dll
I get into the page where I see the interfaces, and I can view the WSDL.
Now, I would like to try to call the demo function (echoDouble) from PHP using curl.
How do I know what address I should use?
I tried:
http://127.0.0.1:81/xyz/wsdl/IMyService/echoDouble/
But it's not working.
Any help?
I understand my doubts now. I have always used "Datasnap rest application" but now I am trying "SOAP server application", that is why I cannot find the correct URL, because they work different. When using "Datasnap rest application" you need to go to a specific URL to get the function but SOAP works different, the base URL is always this (in my case):
http://127.0.0.1:81/xyz/wsdl/IMyService/
Sorry for that, I will switch back to "Datasnap rest application"

WebSocket client implementations for Delphi

Are there free WebSocket client implementations for Delphi? I found only this one:
WebSockets Delphi Components
but it is not free.
Here is my open source library:
https://github.com/andremussche/DelphiWebsockets
I've added support for WebSockets to xxm. Not all handlers support the required IXxmRawSocket interface, but the Apache httpd module (xxmAHttpd) and the SCGI handler do, and I still get the best results with the standalone 'raw' handler xxmHttp. See more here.

Delphi 2010 DataSnap Client with HTTPS

I have a DataSnap server written in Delphi XE3, deployed as an ISAPI module with SSL.
I'm writing a client application for this server, but it has to be written in Delphi 2010 for now. I'm having trouble connecting to the server through HTTPS. I have no trouble connecting to the server through HTTP.
I can write a client in XE3 that connects through HTTPS and succeeds, so I know the server is working fine.
The error I receive is:
Protocol HTTPS can be used after an adequate instance of TDBXCommunicationLayer is registered with TDBXCommunicationLayerFactory.
I've googled the solution to a problem like this and was instructed to add DSHTTPLayer to the uses clause of my unit, and that works for HTTP, but it's not working for HTTPS.
Any ideas out there? Thanks a lot for your time.
I ended up using TIdHTTP and TIdSSLIOHandlerSocketOpenSSL components to connect via HTTPS. I parsed the JSON with a TJSONParser. Delphi 2010 doesn't support HTTPS through the TDSRestConnection.

Is using PHP NuSOAP a bad idea?

I read somewhere here on stackoverflow that using NuSoap is not a good idea and its dead. If it is, what is the best possible solution to create WSDL files. I was just nusoap just for creating wsdl files and I never got the webservice to work
NuSOAP isn't being developed any more and hasn't been for a while.
I have looked at most of the current PHP Soap options, and settled for Zend_Soap_Server, specifically because of its AutoDiscovery component.
The main point about AutoDiscovery is that the WSDL is generated from the docblocks within your code. So as long as you follow the correct conventions, the component will build a well-formed WSDL for you.
If you don't want to use a framework, you can just include the files Server.php, AutoDiscover.php and Wsdl.php. I do it like this;
require_once 'Zend/Loader.php';
require_once "Zend/Loader/Autoloader.php";
$autoloader = Zend_Loader_Autoloader::getInstance();
Zend_Loader::loadClass('Zend_Soap_Server');
Zend_Loader::loadClass('Zend_Soap_AutoDiscover');
Zend_Loader::loadClass('Zend_Soap_Wsdl');
It's also worth remembering that AutoDiscovery alone IS NOT a SOAP server, it just generates your WSDL. So in theory, you could probably use it to create a WSDL, but use a different SOAP server if you wanted to i.e. the native PHP one (which does not generate WSDL). However, as you will have loaded up the Zend Soap Server it would seem a bit wasteful not to use it IMO.
If you're working with PHP4, it might be your only alternative.
With PHP5, you can use Zend Soap. http://framework.zend.com/manual/en/
I'm using Nusoap with php 5.2.5. Working great for me. But I never tested it with higher veersion.
Same as MacMan, I am using with php 5.2.17 and it is working great, easy that native PHP SOAP, I guess.

Fix non-standard web serverice port on contractRef and docRef

My problem is closely related to this one: How can I use .NET web services from non-standard ports?. My web service runs behind a port-forwarding firewall, so the port numbers reported in the WSDL document contain the internal high-numbered port. I wrote a SoapExtensionReflector class which is able to rewrite the WSDL document. So a request like example.com/path/loginservice?wsdl is handled correctly.
However, this doesn't handle the "disco" request: example.com/path/loginservice?disco. This returns an XML document like this:
<discovery>
<contractRef ref="http://example.com:10092/loginservice.asmx?wsdl" docRef="http://example.com:10092/loginservice.asmx"/>
<soap address="http://example.com/path/loginservice.asmx" binding="q1:LoginServiceSoap"/>
<soap address="http://example.com/path/loginservice.asmx" binding="q2:LoginServiceSoap12"/>
</discovery>
While the soap bindings have been properly re-written by the SoapExtensionReflector, the contractRef and docRef URLs have the high-numbered port. How can I rewrite them as well?
Finally figured something out. Created proxy classes manually using svcutil after migrating everything to WCF. I figure you could probably do the same thing using the wsdl tool that came with the old asp.net web services, but I haven't tried that.

Resources