users@jax-rpc.java.net

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

From: Kwan Hon Luen <hon_luen_at_YAHOO.COM>
Date: Wed, 30 Oct 2002 17:29:30 +0800

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: Ted O'Donovan
  To: 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 [mailto:hon_luen_at_YAHOO.COM]
    Sent: 30 October 2002 09:20
    To: 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: Harvinder Singh
      To: 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="http://java.sun.com/xml/ns/jax-rpc/ri/config"> <service name="HelloService"
         targetNamespace="http://192.168.168.88/HelloService.wsdl"
         typeNamespace="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"
            "http://java.sun.com/j2ee/dtds/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 https://192.168.168.88:443/helloservice/endpoint?WSDL, but that gives me errors. <?xml version="1.0" encoding="UTF-8"?>
        <configuration
          xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
          <wsdl location="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.
      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