users@jax-rpc.java.net

RE: jaxrpc with https

From: Potter, Brian L <brian.potter_at_intergraph.com>
Date: Fri, 22 Oct 2004 09:42:12 -0500

kathy, did you ever get a chance to look at this?

-----Original Message-----
From: Potter, Brian L
Sent: Tuesday, October 12, 2004 10:47 AM
To: 'users_at_jax-rpc.dev.java.net'
Subject: RE: jaxrpc with https


btw, you don't even need to build the mutualauth service; it never gets that
far.

-----Original Message-----
From: Potter, Brian L
Sent: Tuesday, October 12, 2004 10:43 AM
To: users_at_jax-rpc.dev.java.net
Subject: RE: jaxrpc with https


i'm running on Windows XP (version 5.1).
 
i left out one possibly important detail; my client is based on the
dynamicproxy example instead of the staticstub example (like
mutualauthclient). i'm not sure if that's important. here's a revised
HelloClient.java (originally from the mutualauthclient example, modified to
use a dynamic proxy). it fails with the same error as my client
(java.io.IOException: HTTPS host name wrong: should be <localhost>).
 
package mutualauthclient;
 
import javax.xml.rpc.Stub;
import java.net.URL;
import javax.xml.rpc.Service;
import javax.xml.rpc.JAXRPCException;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceFactory;
import com.edms.utils.*;
 
public class HelloClient {
    public static void main(String[] args) {
        if (args.length != 5) {
            System.out.println("5 command-line parms required");
            System.exit(1);
        }
 
        String keyStore = args[0];
        String keyStorePassword = args[1];
        String trustStore = args[2];
        String trustStorePassword = args[3];
        String endpointAddress = args[4];
 
        System.out.println("keystore: '" + keyStore + "'");
        System.out.println("keystorePassword: '" + keyStorePassword + "'");
        System.out.println("trustStore: '" + trustStore + "'");
        System.out.println("trustStorePassword: '" + trustStorePassword +
"'");
        System.out.println("Endpoint address = '" + endpointAddress + "'");
 
        try {
            System.setProperty("javax.net.ssl.keyStore", keyStore);
            System.setProperty("javax.net.ssl.keyStorePassword",
                keyStorePassword);
            System.setProperty("javax.net.ssl.trustStore", trustStore);
            System.setProperty("javax.net.ssl.trustStorePassword",
                trustStorePassword);
 
   URL loginWsdlUrl = new URL (endpointAddress + "?WSDL");
   ServiceFactory serviceFactory = ServiceFactory.newInstance();
   String nameSpaceUri = "urn:foo";
   String serviceName = "MySecureHelloService";
   String portName = "HelloIFPort";
   Service hello = serviceFactory.createService(loginWsdlUrl, new
QName(nameSpaceUri, serviceName));
   HelloIF helloIF = (HelloIF) hello.getPort(new QName(nameSpaceUri,
portName),
    HelloIF.class);
            System.out.println(helloIF.sayHello(" Duke (secure)"));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
 
    private static Stub createProxy() {
        return (Stub) (new MySecureHelloService_Impl().getHelloIFPort());
    }
}


-----Original Message-----
From: kathy walsh [mailto:Kathleen.Walsh_at_Sun.COM]
Sent: Tuesday, October 12, 2004 10:10 AM
To: users_at_jax-rpc.dev.java.net
Subject: Re: jaxrpc with https


Also-
what platform, oOS are you running on?
tx,
Kathy

kathy walsh wrote:


Brian-
Can you send me a sample service
and client that reproduces this problem-
ie, something I can drop into J2EE 1.4, deploy and run?
I will try to reproduce the problem and see if I can find
out the problem you are having-
Kathy

Potter, Brian L wrote:


i've written a J2EE 1.4 JAXRPC web service that works great using http and
port 8080. but when i try to call it using https and port 1043, i get:
 
Client exception: modeler error: failed to parse document at "
<https://localhost:1043/procnetService/procnetService?WSDL>
https://localhost:1043/procnetService/procnetService?WSDL":
java.io.IOException: HTTPS host name wrong: should be <localhost>
 
looks like the client cert's hostname is incorrect, but the sample
(security/mutualauth and security/mutualauthclient) works fine using the
same keystore and truststore. i'm using the ones delivered in
C:/Sun/AppServer/domains/domain1/config.

Brian L. Potter
Software Scientist
Solutions Group
Intergraph Corporation (NASDAQ:INGR)
170 Graphics Drive, Madison, AL 35758
P 1.256.730.8219 F 1.256.730.7514
brian.potter_at_intergraph.com <mailto:brian.potter_at_intergraph.com> <
mailto:brian.potter_at_intergraph.com <mailto:brian.potter_at_intergraph.com> >,
www.intergraph.com <http://www.intergraph.com>