On Mon, Nov 17, 2003 at 02:42:41PM +0800, Dwi Tjandra wrote: > A client has two IP addr, and by default always sends request through IP addr #1. IP > addr #1 and #2 are in different subnet. This problem occurs when I try to send a > request from IP addr #2 instead from IP addr #1, from client (AXIS ver 1.1) to > server-side (AXIS ver 1.1). > > 1. I've tried this line below before invoke the call but had no effect. > > Call call = (Call) service.createCall(); > Transport tran = call.getTransportForProtocol("http"); > tran.setUrl("xx.xx.xx.2"); //\\ --- set to IP addr #2
The JavaDoc for Transport.setUrl(String) is not specific, but my guess is that the setUrl method is intended to be used to specify the endpoint of the *server*, not the ip address to bind to on the client side. What you could do is setup a route specific to the endpoint you're trying to talk to. If the service you want to talk to is deployed on ws.foo.com (let's assume ws.foo.com resolves to 1.2.3.4), setup a route that says "to get to 1.2.3.4, go through the gateway on the subnet that ip addr #2 resides on". In linux you'd do something like this: route add host 1.2.3.4 gw 192.168.1.1 This assumes that ip addr number 2 is 192.168.1.2 (on the same subnet as 192.168.1.1). There might be a more Java-way of doing this. But the route command will work. -c -- 11:30:00 up 3 days, 21:40, 9 users, load average: 0.01, 0.08, 0.09