How to bind SoapHttpClientProtocol to certain local endpoint?

H

Harri Pesonen

My web service client is running under ASP.NET in a web site, that has a
different ip address than the local machine. When calling a web service, my
client uses the ip address of the local machine, not the address of the web
site. This is a problem, because later the remote endpoint uses the ip
address that was used, and sends another soap call to that address, but there
is no active web site at that address.

Is it possible to bind SoapHttpClientProtocol to certain local endpoint?

If not, how the incoming soap call could be redirected to the correct web
site?

Thanks, Harri
 
J

Josh Twist

You can set the Url property of the web service proxy at runtime, e.g.

MyService myService = new MyService();
myService.proxy = "http://therealendpoint.com/webservice"; // TODO -
read this from config

In the above example MyService is autogenerated by adding a Web
Reference, but it inherits from SoapHttpClientProtocol class.
 
H

Harri Pesonen

Are you sure that proxy sets the local endpoint of the web service? I really
need to set the local endpoint of the socket that is used in soap http client
call. Proxy sounds like it would be used as a proxy to access the remote
endpoint.
 
J

Josh Twist

Sorry Harri, misunderstood you...

... I'm still not sure I get it...

You have two computers, A & B, where B is running a webservice at
http://B/MyService.asmx and A is a client of that web service. You can
already configure A to talk to B at http://B/MyService.asmx but you
also want to configure which port A uses? Right?

Why?

TCP/IP doesn't really work like that. A opens a connection with B, and
B sends the data requested back down using that connection.
 
H

Harri Pesonen

Two reasons: I would like to use the ip address of the web site, because the
ip address of the machine should not be visible. Also I would like to select
the port that I use, so that firewall configuration would be easier.
 
J

Josh Twist

Hi Harri,

With regards to hiding the IP, that kind of thing is down to your
network setup and nothing to do with your code.

I'm afraid I don't know how to control the port responses come back to
when making web requests. I've never had any reason to try (but I doubt
you can). Normally you just configure your firewall to allow
connections to port 80 on the target server and the firewall will look
after the connection back to the client (usually ports over 1200) for
you.

Josh
http://www.thejoyofcode.com/
 
J

Josh Twist

Hi Harri,

With regards to hiding the IP, that kind of thing is down to your
network setup and nothing to do with your code.

I'm afraid I don't know how to control the port responses come back to
when making web requests. I've never had any reason to try (but I doubt
you can). Normally you just configure your firewall to allow
connections to port 80 on the target server and the firewall will look
after the connection back to the client (usually ports over 1200) for
you.

Josh
http://www.thejoyofcode.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top