users@jax-rpc.java.net

Re: Java application trying to connect to remote web service via SSL

From: Ted O'Donovan <Ted.odonovan_at_ECET.COM>
Date: Wed, 30 Oct 2002 09:46:58 +0000

Yeah, with jwsdp 1.0 it is the client code that needs to be 1.4 as it is
this code that binds to the HTTP/HTTPS server.

Here is a link to some sample client code, with the errors we were getting
due to the above:
HYPERLINK
"http://swjscmail1.java.sun.com/cgi-bin/wa?A2=ind0208&L=jaxrpc-interest&P=R5
497"http://swjscmail1.java.sun.com/cgi-bin/wa?A2=ind0208&L=jaxrpc-interest&P
=R5497

As far as I know from there on u just need to configure your tomcat to use
ssl, rather than the web service to use ssl. So follow the steps in the RPC
tutorial for creating your certs/keystores etc as normal and then try use
the above code with 1.4 on the client side.

T.

-----Original Message-----
From: Kwan Hon Luen [mailto:hon_luen_at_YAHOO.COM]
Sent: 30 October 2002 09:30
To: JAXRPC-INTEREST_at_JAVA.SUN.COM
Subject: Re: Java application trying to connect to remote web service via
SSL


I am using JDK 1.4 on the machine hosting the web service, and JDK 1.3.1 on
the client machine. Will it do fine?

But I still need to know what to add in the client code, config.xml +
service config.xml + web.xml, to make the whole thing work with SSL.

Can someone help?


----- Original Message -----
From: HYPERLINK "mailto:Ted.odonovan_at_ECET.COM"Ted O'Donovan
To: HYPERLINK
"mailto:JAXRPC-INTEREST_at_JAVA.SUN.COM"JAXRPC-INTEREST_at_JAVA.SUN.COM
Sent: Wednesday, October 30, 2002 5:30 PM
Subject: Re: Java application trying to connect to remote web service via
SSL

We discovered that SSL did not work with jwsdp 1.0 and java 1.3.*, are u
using these? There are checks in the jwsdp 1.0 code that use http instead of
https if u are using 1.3.* jdk. If u try using 1.4.* it should be ok.

T.

-----Original Message-----
From: Kwan Hon Luen [ HYPERLINK
"mailto:hon_luen_at_YAHOO.COM"mailto:hon_luen_at_YAHOO.COM]
Sent: 30 October 2002 09:20
To: HYPERLINK
"mailto:JAXRPC-INTEREST_at_JAVA.SUN.COM"JAXRPC-INTEREST_at_JAVA.SUN.COM
Subject: Re: Java application trying to connect to remote web service via
SSL


The tutorial example uses Apache ANT. But I am trying to just use xrpcc for
both web service and client, which is okay for non-SSL. I am trying to find
out the correct steps for SSL. Does anyone know that?



----- Original Message -----
From: HYPERLINK "mailto:harvinder_at_SEECONSULTING.COM"Harvinder Singh
To: HYPERLINK
"mailto:JAXRPC-INTEREST_at_JAVA.SUN.COM"JAXRPC-INTEREST_at_JAVA.SUN.COM
Sent: Wednesday, October 30, 2002 5:09 PM
Subject: Re: Java application trying to connect to remote web service via
SSL

Hi,

If you follow the instructions given in Tutorial (Security for JAX-RPC )
..step by step it will work..


You need to give the path of the certificate through Tomact Admin interface.



It worked for me..should work for you also..


Regards


Harvinder


Kwan Hon Luen wrote:


Hi all, I have a problem here:A java client application (not a servlet, just
pure console) trying to connect to remote web service via SSL. I can just
this java console client to connect via non-SSL port. What modification do I
have to make to both the web service and the client, in order to connect via
SSL? I have checked out the Sun web service tutorial, but not relevant,
since I am using a java console client here, and not a servlet. Can someone
help? ~honluen
   _____

On the web service machine, This is the config.xml which I use xrpcc to
build the web service. <?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns=" HYPERLINK
"http://java.sun.com/xml/ns/jax-rpc/ri/config"http://java.sun.com/xml/ns/jax
-rpc/ri/config"> <service name="HelloService"
 targetNamespace=" HYPERLINK
"http://192.168.168.88/HelloService.wsdl"http://192.168.168.88/HelloService.
wsdl"
 typeNamespace=" HYPERLINK
"http://192.168.168.88/HelloService/HelloService/type"http://192.168.168.88/
HelloService/HelloService/type"
 packageName="hello"> <interface
  name="hello.HelloIF"
  servantName="hello.HelloImpl"/>
  </service>
</configuration> This is the web.xml which I use to deploy the web service
on tomcat server. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    " HYPERLINK
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd""http://java.sun.com/j2ee/dtd
s/web-app_2_3.dtd"> <web-app>
  <display-name>Hello World Application</display-name>
  <description>A Java application containing a simple JAX-RPC
endpoint</description>
  <session-config>
    <session-timeout>60</session-timeout>
  </session-config> <security-constraint>
    <web-resource-collection>
      <web-resource-name>helloservice</web-resource-name>
      <url-pattern>/endpoint*</url-pattern>
      <http-method>GET</http-method>
      <http-method>POST</http-method>
    </web-resource-collection>
    <auth-constraint>
      <role-name>manager</role-name>
    </auth-constraint>
  </security-constraint>
  <login-config>
    <auth-method>BASIC</auth-method>
  </login-config> <servlet>
      <servlet-name>JAXRPCEndpoint</servlet-name>
      <display-name>JAXRPCEndpoint</display-name>
      <description>Endpoint for Hello Service</description>

<servlet-class>com.sun.xml.rpc.server.http.JAXRPCServlet</servlet-class>
      <init-param>
           <param-name>configuration.file</param-name>

<param-value>/WEB-INF/HelloService_Config.properties</param-value>
      </init-param>
      <load-on-startup>0</load-on-startup>
  </servlet> <servlet-mapping>
      <servlet-name>JAXRPCEndpoint</servlet-name>
      <url-pattern>/endpoint/*</url-pattern>
  </servlet-mapping> <session-config>
      <session-timeout>60</session-timeout>
  </session-config>
</web-app>
   _____

 On the client machine, This is the config.xml which i use xrpcc to generate
the client stubs. Is there any wrong here? since I should be accessing via
HYPERLINK
"https://192.168.168.88:443/helloservice/endpoint?WSDL"https://192.168.168.8
8:443/helloservice/endpoint?WSDL, but that gives me errors. <?xml
version="1.0" encoding="UTF-8"?>
<configuration
  xmlns=" HYPERLINK
"http://java.sun.com/xml/ns/jax-rpc/ri/config"http://java.sun.com/xml/ns/jax
-rpc/ri/config">
  <wsdl location=" HYPERLINK
"http://192.168.168.88:8080/helloservice/endpoint?WSDL"http://192.168.168.88
:8080/helloservice/endpoint?WSDL"
       packageName="hello"/>
</configuration>This is the client code, which I suspect is not very
correct. package hello; import javax.xml.rpc.Stub; public class HelloClient
{
    public static void main(String[] args) { String trustStore =
"f:/SSL/client.keystore";
        String trustStorePassword = "12345678";
        String username = "honluen";
        String password = "12345678";

  try {
            HelloIF_Stub stub = (HelloIF_Stub)(new
HelloService_Impl().getHelloIFPort());
System.setProperty("javax.net.ssl.trustStore",
                trustStore);
            System.setProperty("javax.net.ssl.trustStorePassword",
               trustStorePassword);
            stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY,
                username);
            stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY,
                password);


    HelloIF_Stub hello = (HelloIF_Stub)stub;
            System.out.println(hello.sayHello("DSSS!"));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }}

   _____


--
Dr. Harvinder Singh
CTO
SeE Consulting {P} Ltd.
HYPERLINK "http://www.seeconsulting.com"http://www.seeconsulting.com
Ph.No: 91-11-6163260
Hp:(91) 9810381470
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.394 / Virus Database: 224 - Release Date: 03/10/2002
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.394 / Virus Database: 224 - Release Date: 03/10/2002
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.394 / Virus Database: 224 - Release Date: 03/10/2002
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.394 / Virus Database: 224 - Release Date: 03/10/2002