0

I need to connect from a server to a web-service server to consume a SOAP service but due to restrictions in place I cannot connect directly.

They did however give me a proxy server that can, but it runs on the service on a different port:

[webserver] ----- [proxy:48650] ----- [webservice:8601]

Note (if it wasn't clear yet): I've simplified the hostnames as their very long corporate things and would needlessly complicate the question.

The big problem is that the WSDL of webservice contains a lot of referrals with the absolute URL (so webservice:8601). The includes go more than 1 level deep (so downloading the WSDL and doing a search/replace will not get me much further).

I've added a rule to /etc/hosts on webserver:

127.0.0.1 webservice

The underlying idea is to somehow proxy the 8601 port on localhost and make the soap-client think it is actually connecting to the webservice (via the proxy).

An SSH tunnel is unfortunately not an option to the proxy, same security reasons. I cannot make an SSH connection to the proxy.

iptables is a possibility but I can find a set of rules that takes a port on localhost (8601) and redirects it to an external host/different port (proxy:48650). Most of them are for incoming traffic.

I've been wasting a lot of time on this and am getting desperate. Is there anyone here who can provide me with some hints/solutions?

Pretty please?

  • Exactly what sort of proxy is that supposed to be? – Michael Hampton Aug 6 '14 at 14:53
  • Sorry I had to inquire for that here. It's an iptables forward. – Blizz Aug 12 '14 at 5:21
1

Remove the entry from your hosts file and use iptables to DNAT the traffic.

On your local machine:

iptables -t nat -A OUTPUT -d webservice -p tcp --dport 8601 -j DNAT --to proxy:48650

OR, on an intermediate router you'll need to use the PREROUTING chain instead of the OUTPUT chain:

iptables -t nat -A PREROUTING -d webservice -p tcp --dport 8601 -j DNAT --to proxy:48650

NOTE: You must use the IP Address of the proxy in the --to argument; iptables won't do name resolution there. You can use the hosting of the webservice as the argument to -d though.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.