Hello everybody!

I've been trying to get a working soap connection (code attached) through my
company's proxy gateway which requires authentication.  I first got it to
work to the target via http, but when I tried to go against the same service
via https, I started getting the following exception:

[SOAPException: faultCode=SOAP-ENV:Client; msg=Error SSL connecting to
##.##.##.###:443 via httpdal2:80:
java.lang.reflect.InvocationTargetException;
targetException=java.lang.reflect.InvocationTargetException]

I am using yesterday's nightly build as the "stable" version didn't work,
and there have been several recent commits working on this problem.

Any ideas?

Thanks,
mike.



/*
 * testauthproxy.java
 *
 * Created on October 18, 2002, 2:13 PM
 */

package sage2.src.Sensors.Core2;

import java.net.URL;
import java.lang.Integer;
import java.util.Hashtable;
import java.util.ArrayList;
import java.util.Vector;
import java.io.*;
import sun.misc.BASE64Encoder;

import org.apache.soap.*;
import org.apache.soap.rpc.*;
import org.apache.soap.encoding.SOAPMappingRegistry;
import org.apache.soap.encoding.soapenc.BeanSerializer;
import org.apache.soap.util.xml.QName;
import org.apache.soap.transport.http.SOAPHTTPConnection;

/**
 *
 * @author  mike
 */
public class testauthproxy {
    
    /** Creates a new instance of testauthproxy */
    public testauthproxy() {
    }

    public static void main (String args[]) {
        
        String ttarget = new String(
"https://##.##.##.###/soap/servlet/rpcrouter"; );
        
        String proxyHost = new String( "httpdal2" );
        String proxyPort = new String( "80" );
        String proxyUserName = new String( "ladwimi" );
        String proxyPassword = new String( "sniper!duck!" );
        
        /* Tried this approach based on Phil Bohnenkamp patch
        String password = " " + proxyUserName + ":" + " " + proxyPassword;
        BASE64Encoder B64Encoder = new BASE64Encoder ();
        String encodedPassword = B64Encoder.encode( password.getBytes ());
        
        System.setProperty( "https.proxyHost", proxyHost );
        System.setProperty( "https.proxyPort", proxyPort );
        System.setProperty( "https.proxyAuth", "basic " + encodedPassword );
        */
        
        // Tried this approach based on working http connection through
proxy based on Steve Nichol patch
        SOAPHTTPConnection connection = new SOAPHTTPConnection();
        connection.setProxyHost( proxyHost );
        connection.setProxyPort( 80 );
        connection.setProxyUserName( proxyUserName );
        connection.setProxyPassword( proxyPassword );
        
        System.err.println("List");
        
        Call call = new Call ();
        call.setSOAPTransport( connection );
        call.setTargetObjectURI ("urn:sage2-sensor-core2");
        call.setMethodName ("List");
        call.setEncodingStyleURI( Constants.NS_URI_SOAP_ENC );

        Response resp = null;
        try { resp = call.invoke ( new URL( ttarget ), /* actionURI */ "" );
}
        catch( Exception ex ) { System.err.println("Editor.List exception: "
+ ex); System.exit(1); }

        if (resp.generatedFault ()) {
          Fault fault = resp.getFault ();
          System.out.println ("Editor.List: Call failure: ");
          System.out.println ("-Fault Code   = " + fault.getFaultCode ());
          System.out.println ("-Fault String = " + fault.getFaultString ());
          System.exit(1);
        }
        
        Parameter result = resp.getReturnValue();
        System.err.println( ">>>>>> " + result.getValue() );
    }
}

--
To unsubscribe, e-mail:   <mailto:soap-user-unsubscribe@;xml.apache.org>
For additional commands, e-mail: <mailto:soap-user-help@;xml.apache.org>

Reply via email to