Yes, that is what I did. You need to create a new WSDL file that has the
https endpoint url. I created my WSDL with Java2WSDL, so I only changed the
-l parameter to the new url. Be sure that you use the same server name as
will be used when you create the SSL certificate which now will be required
on your client PC. I used "https://bwerth2:8443"; (with axis, etc. added of
course).

A message I read that helped is:
http://forum.java.sun.com/thread.jsp?forum=331&thread=305036&tstart=45&trang
e=15

I didn't end up following the instructions in the above thread exactly. This
thread appears to be talking about using the prior version before AXIS. So
when creating the client, I found I only had to add the following set
property to get the client to locate the SSL certificate:

System.setProperty("javax.net.ssl.trustStore", "C:\\Documents and
Settings\\bwerth\\.keystore");

Also I used IBM's Keyman to create the certificate instead of keytool.

After you create the WSDL, then of course you use WSDL2JAVA, same as you had
before using SSL.

When creating the SSL certificate keep in mind:
1) Create one at the server that has the first and last name (CN) set to the
server hostname. On our lan, this was just the machine name of BWERTH2. If
on the internet, It would look a little different.
2) Export this certificate and copy it either to the client PC or to a
different location if you are testing on the same PC.
3) Generate the client keystore (the "truststore") by importing the above
certificate and setting it to trusted.

You then point your client to it with the setProperty as I showed above. I
used the above location because that is also where a .NET client will look
for it. A .NET client doesn't need the setProperty type of statement because
it knows where to look for the certificate on a Windows PC.

-----Original Message-----
From: Gries, Matthias [mailto:[EMAIL PROTECTED]
Sent: Monday, July 12, 2004 12:37 AM
To: [EMAIL PROTECTED]
Subject: Axis client with https


Hi all,

allthaugh I've found some threads regarding my topic in the mailing list
this still seems to be a little bit unclear for me. 

I've generated my client stubs via WSDL2JAVA. Using http my axis client
using these stubs works fine. But what do I have to consider if I'd have
to use https? Do I have to generate the stubs again, now with a new wsdl
which points to a https-endpoint-url? Or do I have to modify my client
code with statements like these:

      System.setProperty("java.protocol.handler.pkgs",
"com.sun.net.ssl.internal.www.protocol");
      System.setProperty("javax.net.ssl.trustStore", certificate);
      Security.addProvider(new Provider());

By the way, I'm using JDK 1.3.

My client code (without specific https parts and just a short
extraction) until now looks like:

    try
    {
      Booking     service = new BookingLocator();
      BookingPort port;

      if ((endpoint != null) && !endpoint.trim().equalsIgnoreCase(""))
      {
        URL newEndpoint = new URL(endpoint);
        port = service.getBookingPort(newEndpoint);
      }
      else
      {
        port = service.getBookingPort();
      }

      // here we're doing the webservice call
      result   = port.book(myParam1, myParam2,...);
    }

Thanks and regards
Matthias

Reply via email to