Results 1 to 5 of 5

Thread: [SOLVED] [JAVA] SOAP request over http-proxy

  1. #1
    Join Date
    Jun 2007
    Posts
    3
    Rep Power
    8

    Default [SOLVED] [JAVA] SOAP request over http-proxy

    Hi,

    i'm currently trying to post some soap-requests from our intranet to our server that is in the internet, which means i need to use a proxy. Here's what i try:

    Code:
    System.setProperty("http.proxySet","true");
    System.setProperty("http.proxyHost","http-proxy.my-client.de");
    System.setProperty("http.proxyPort","8080"); 
    
    SoapProvisioning sp = new SoapProvisioning();
    sp.soapSetURI("https://my-company.de:7071/service/soap");
    sp.soapAdminAuthenticate("admin", "adminpwd");
    
    Account account = sp.get(Provisioning.AccountBy.name, "me@my-company.de");
    System.out.println(account);
    The exception that is thrown shows, that the System-properties regarding the proxy are simply ignored:
    [...]
    Caused by: java.net.UnknownHostException: my-company.de
    [...]

    I dont see how i can bind a proxy to the Object of Class SoapProvisioning.

    Can anyone help me?

    Thanks
    Last edited by fink; 12-11-2008 at 09:24 AM.

  2. #2
    Join Date
    Sep 2005
    Posts
    78
    Rep Power
    10

    Default

    SoapProvisioning uses our SoapHttpTransport to invoke the request, which then uses Jakarta Commons HttpClient 3.0. Ideally you should be able to specify SoapTransport options on SoapProvisioning. I poked around in the code and didn't find a way to do this. You could take a look at HttpClient and see if they have their own system-wide properties for specifying a proxy.

    If you think this is something we should add to the product, please file an RFE in Bugzilla.

  3. #3
    Join Date
    Jun 2007
    Posts
    3
    Rep Power
    8

    Thumbs up Solved

    I've checked out the Edison-Branch from your SVN and added a method to SoapProvisioning.java:

    Code:
       public void soapSetTransport(HttpClient httpClient, String uri) {
            if (mTransport != null) mTransport.shutdown();
            mTransport = new SoapHttpTransport(httpClient, uri);
            if (mAuthToken != null)
                mTransport.setAuthToken(mAuthToken);
            if (mDebugListener != null)
                mTransport.setDebugListener(mDebugListener);
        }
    and a constructor for SoapHttpTransport:

    Code:
        public SoapHttpTransport(HttpClient httpClient, String uri)
        {
    	super();
    	mClient = httpClient;
    	commonInit(uri);
         }
    Now i can instantiate a SoapProvisioning like this:

    Code:
    HttpClient httpClient = new HttpClient();
    httpClient.getHostConfiguration().setProxy("proxy-host", 8080);
    SoapProvisioning sp = new SoapProvisioning();
    sp.soapSetTransport(httpClient, soapURI);
    I've also added a method in ZMailbox.Options:

    Code:
            public void setHttpClient(HttpClient httpClient)
            {
            	mHttpClient=httpClient;
            }
    and changed the initPreAuth- and setSoapURI-Methods:

    Code:
        public void initPreAuth(String uri, SoapTransport.DebugListener listener, HttpClient httpClient) {
            mNameToTag = new HashMap<String, ZTag>();
            mIdToItem = new HashMap<String, ZItem>();                
            setSoapURI(uri, httpClient);
            if (listener != null) mTransport.setDebugListener(listener);
        }
    
       private void setSoapURI(String uri, HttpClient httpClient) {
            if (mTransport != null) mTransport.shutdown();
            if (httpClient != null)  mTransport = new SoapHttpTransport(httpClient, uri);
            else mTransport = new SoapHttpTransport(uri);
            mTransport.setUserAgent("zclient", BuildInfo.VERSION);
            mTransport.setMaxNoitfySeq(0);
            if (mAuthToken != null)
                mTransport.setAuthToken(mAuthToken);
        }
    Now its working

  4. #4
    Join Date
    Sep 2005
    Posts
    78
    Rep Power
    10

    Default

    Great! Glad you were able to get it working. I filed bug 34091 for this issue.

  5. #5
    Join Date
    Sep 2005
    Posts
    78
    Rep Power
    10

    Default

    Oops, I just took a closer look and realized that proxy support was added in 5.0. See bug 15835 for details.

Similar Threads

  1. DNS Questions and Trouble Installing
    By smurraysb in forum Installation
    Replies: 22
    Last Post: 03-14-2008, 04:27 PM
  2. Error loading on Mac OS X 10.4.10 server PPC
    By qprcanada in forum Installation
    Replies: 7
    Last Post: 10-26-2007, 07:25 AM
  3. Replies: 26
    Last Post: 02-12-2007, 07:23 PM
  4. How to make Zimbra use HTTP Proxy on outgoing requests?
    By martinm_76 in forum Installation
    Replies: 2
    Last Post: 09-03-2006, 10:13 AM
  5. Replies: 6
    Last Post: 03-17-2006, 10:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •