To go through an HTTP proxy with Apache SOAP 2.3.1, your client code must create an 
instance of SOAPHTTPConnection, call setProxyHost, setProxyPort and (optionally) 
setProxyUserName and setProxyPassword, then call call#setTransport to use this 
instance.

For the nightly build of Apache SOAP and, I believe, any version of Axis, one uses 
System properties.  For example,

    java -Dhttp.proxyHost=myproxy -Dhttp.proxyPort=myproxyport me.MyClient

The http.proxyHost, etc., system properties follow Sun's standards.

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: "Shaoguang Cong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 04, 2004 8:02 AM
Subject: Re: SOAPException: Error opening socket: Connection timed out:


> Yes. I'm behind a firewall and use a proxy server to connect outside. I
> originally thought the firewall may be the problem. But check around and
> think port 80 should be open.  I'll double check that again.
> 
> I tried to find whether can set the proxy host/port in the code but see no
> APIs from apache.soap or Axis packages. Do you know a way to pass the
> firewall?
> 
> Thanks.
> Shao Guang Cong
> 
> ----- Original Message -----
> From: "Scott Nichol" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, August 03, 2004 4:37 PM
> Subject: Re: SOAPException: Error opening socket: Connection timed out:
> 
> 
> The client is unable to connect to the server at the TCP/IP level.  Are you
> behind a firewall that requires you to use an HTTP proxy to connect to the
> outside?
> 
> Scott Nichol
> 
> Do not send e-mail directly to this e-mail address,
> because it is filtered to accept only mail from
> specific mail lists.
> ----- Original Message -----
> From: "Shaoguang Cong" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, August 03, 2004 5:15 PM
> Subject: SOAPException: Error opening socket: Connection timed out:
> 
> 
> I'm getting the following error when trying to run the sample client
> attached and got the exceptions with no idea about what could be the real
> problem.  Thanks for any help.
> 
> -Shao
> 
> 
> [SOAPException: faultCode=SOAP-ENV:Client; msg=Error opening socket:
> java.net.ConnectException: Connection timed out: connect;
> targetException=java.lang.IllegalArgumentException: Error opening socket:
> java.net.ConnectException: Connection timed out: connect]
> 
>  at
> org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.ja
> va:354)
>  at org.apache.soap.rpc.Call.invoke(Call.java:248)
>  at
> com.uhc.ubh.facets.util.CurrencyExchange.getRate(CurrencyExchange.java:46)
>  at com.uhc.ubh.facets.util.CurrencyExchange.main(CurrencyExchange.java:21)
> 
> import java.io.*;
> import java.net.*;
> import java.util.*;
> import org.apache.soap.util.xml.*;
> import org.apache.soap.*;
> import org.apache.soap.rpc.*;
> 
> 
> public class CurrencyExchange {
>     public static void main(String[] args) {
>         try {
>             String url = new String("http://services.xmethods.net:80/soap";);
>             String country1= "us";
>             String country2= "taiwan";
>             float rate = getRate(url, country1, country2);
>             System.out.println(rate);
>         } catch (Exception ex)
>         {
>             ex.printStackTrace();
>         }
>     }
>     public static float getRate (String url, String country1, String
> country2) throws Exception {
>       Call call = new Call();
>       // Service uses standard SOAP encoding
>       String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
>       call.setEncodingStyleURI(encodingStyleURI);
> 
>       // Set service locator parameters
>       call.setTargetObjectURI("urn:xmethods-CurrencyExchange");
>       call.setMethodName("getRate");
>       call.setTimeout(600);
> 
>       // Create input parameter vector
>       Vector params = new Vector();
>       params.addElement(new Parameter("country1", String.class, country1,
> null));
>       params.addElement(new Parameter("country2", String.class, country2,
> null));
>       call.setParams(params);
> 
>       // Invoke the service ....
>       Response resp = call.invoke(new java.net.URL(url), "");
> 
>       // ... and evaluate the response
>       if (resp.generatedFault()) {
>         throw new Exception();
>       }
>       else {
>         // Call was successful. Extract response parameter and return result
>         Parameter result = resp.getReturnValue();
>         Float rate = (Float) result.getValue();
>         return rate.floatValue();
>       }
>     }
> }
> 
>

Reply via email to