You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by George I Matkovits <ma...@uswest.net> on 2000/12/22 13:24:05 UTC

Re: using proxy

IMHO this would only work over an URL connection.
Regards - George

aoyagi@wsd.mt.nec.co.jp wrote:

> Hi,
> I want to connect with soap server using proxy server.
> I wrote the program as follows.
>  import org.apache.soap.Constants;
>  import org.apache.soap.rpc.*;
>  import org.apache.soap.SOAPException;
>  import java.net.URL;
>  import java.net.MalformedURLException;
>  import java.util.Vector;
>  import java.util.Properties;
>  import java.lang.System;
>  public class SoapClient{
>   public static void main(String[] args) {
>
>     // Modify system properties
>     Properties sysProperties = System.getProperties();
>     // Specify proxy settings
>     sysProperties.put("proxyHost", "proxysv.wsd.mt.nec.co.jp");
>     sysProperties.put("proxyPort", "8080");
>     sysProperties.put("proxySet",  "true");
>
>     Call call = new Call();
>     call.setTargetObjectURI("urn:testservice");
>     call.setMethodName("add");
>     call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>     Vector params = new Vector();
>     params.addElement (new Parameter("num1",Integer.class,args[1],null));
>     params.addElement (new Parameter("num2",Integer.class,args[2],null));
>     call.setParams(params);
>     try{
>       try{
>         Response resp =  call.invoke(new URL(args[0]),"");
>         Parameter result = resp.getReturnValue();
>         System.out.println(result.getValue());
>         //      System.out.println("aaa");
>       }catch(MalformedURLException e){
>         System.out.println(e);
>       }
>     }catch(SOAPException e){
>       System.out.println(e);
>     }
>   }
>  }
>
> However, my program tries connection not to proxy server but to true server.
> When how carries out, I want you to teach whether it can connect now using
> proxy server.
>
> Thank you.