List Info

Thread: XML-RPC over SSL




XML-RPC over SSL
user name
2006-07-28 14:51:52
Hi
    I have xml-rpc running in tomcat server. I have enabled https. I want to access it over https but Im getting error on client side. IO am running client using following command

%JAVA_HOME%\bin\java -cp classes;%JARS% com.edb.usm.test.SecureXmlRpcTest https://localhost 8443 .keystore changeit
where %JAR% contains reference to
commons-codec-1.3.jar;commons-httpclient-3.0.1.jar;commons-logging-1.0.4.jar ;edb-commons.jar;ws-commons-util.jar;xmlrpc-3.0a1.jar;xmlrpc-1.2-b1.jar

and getting following error.

java.io.IOException: sun.security.validator.ValidatorException: No trusted certificate found
java.io.IOException : sun.security.validator.ValidatorException: No trusted certificate found
        at org.apache.xmlrpc.XmlRpcClient$Worker.execute(XmlRpcClient.java:444)
     ;   at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java :163)
      ;  at com.edb.usm.test.SecureXmlRpcTest.main(SecureXmlRpcTest.java:98)

Can Any one help me on this
My client programm is


/********************************************************************************************************************/

/**
 * $Id: SecureXmlRpcTest.java,v 1.1 2003/12/10 18:49:22 dkha Exp $
 */

package com.edb.usm.test;

import java.util.Vector;
import java.io.IOException;
import java.io.FileInputStream;
import java.net.MalformedURLException;
import java.security.KeyStore;
import java.security.NoSuchAlgorithmException;
import java.security.KeyStoreException;
import java.security.KeyManagementException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.TrustManagerFactory;

import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.secure.SecureXmlRpcClient;
import org.apache.xmlrpc.secure.SecurityTool ;

/**
 * Tests a secure XML-RPC call (using Apache XML-RPC).
 *
 * version $Revision: 1.1 $
 * author Daniel Kha, <a href=";mailto:yorku.ca">dkhayorku.ca&quot;>yorku.ca"> dkhayorku.ca&lt;/a>
&nbsp;*/
public class SecureXmlRpcTest {
 &nbsp;  public static final String SECURE_ALGORITHM = "SunX509";
  ;  public static final String SECURE_PROTOCOL = "SSL&quot;;
&nbsp; &nbsp; public static final String KEYSTORE_TYPE = "JKS&quot;;

&nbsp; &nbsp; public static SSLSocketFactory getSSLSocketFactory(String keyStoreFilename,
&nbsp; &nbsp; &nbsp;   ; &nbsp;  String keyStorePassword)
&nbsp; &nbsp; &nbsp;   ; &nbsp;  throws NoSuchAlgorithmException, KeyStoreException,
&nbsp; &nbsp;   ; &nbsp; &nbsp;  CertificateException, UnrecoverableKeyException,
&nbsp; &nbsp; &nbsp; &nbsp;   ;  KeyManagementException, IOException {

 &nbsp;   ; &nbsp; char[] keyStorePasswordCharArray = keyStorePassword.toCharArray();

 &nbsp; &nbsp; &nbsp;  KeyStore ks = KeyStore.getInstance(KEYSTORE_TYPE);
   ; &nbsp; &nbsp; ks.load(new FileInputStream(keyStoreFilename),
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   keyStorePasswordCharArray);

&nbsp; &nbsp; &nbsp;   KeyManagerFactory kmf =
 &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; KeyManagerFactory.getInstance(SECURE_ALGORITHM);
 ; &nbsp; &nbsp; &nbsp; kmf.init(ks, keyStorePasswordCharArray);

&nbsp; &nbsp; &nbsp;   TrustManagerFactory tmf =
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   TrustManagerFactory.getInstance(SECURE_ALGORITHM);
&nbsp; &nbsp; &nbsp;   tmf.init(ks);

   ; &nbsp; &nbsp; SSLContext sslCtx = SSLContext.getInstance(SECURE_PROTOCOL);
&nbsp; &nbsp;   ;  sslCtx.init(kmf.getKeyManagers(), tmf.getTrustManagers (), null);

&nbsp; &nbsp;   ;  return(sslCtx.getSocketFactory());
 &nbsp;  }

 &nbsp;  public static void main(String[] args) {
 &nbsp; &nbsp;   ; if (args.length < 4) {
 &nbsp; &nbsp;   ; &nbsp; &nbsp; System.out.println(&quot;Usage: java SecureXmlRpcTest <host&gt; <port&gt; <keystore> <keystorePassword&gt;");
 &nbsp; &nbsp; &nbsp;   ; &nbsp; System.exit(0);
 ; &nbsp; &nbsp; &nbsp; }

 &nbsp;   ; &nbsp; String host = args[0];
&nbsp;   ; &nbsp;  int port = 0;
 &nbsp;   ; &nbsp; try {
 &nbsp; &nbsp;   ;  &nbsp;  port = Integer.parseInt(args[1]);
 ; &nbsp; &nbsp; &nbsp; } catch (NumberFormatException e) {
 &nbsp;   ; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Using default port = "+port);
 &nbsp;   ; &nbsp; }
 &nbsp; &nbsp;   ; String keyStoreFilename = args[2];
&nbsp;   ; &nbsp;  String keyStorePassword = args[3];

  ; &nbsp; &nbsp;  try {

 &nbsp;   ; &nbsp; &nbsp; &nbsp; SSLSocketFactory socketFactory = getSSLSocketFactory(
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; keyStoreFilename, keyStorePassword);

&nbsp;   ; &nbsp; &nbsp; &nbsp;  HttpsURLConnection.setDefaultSSLSocketFactory(socketFactory);

&nbsp; &nbsp;   ; &nbsp; &nbsp;  SecureXmlRpcClient client = new SecureXmlRpcClient(host, port);

&nbsp;   ; &nbsp; &nbsp; &nbsp;  // Fill in the appropriate method call that's available on your
 ; &nbsp; &nbsp; &nbsp; &nbsp;   // server.
&nbsp; &nbsp;   ; &nbsp; &nbsp;  String method = "Service.methodName";

 &nbsp; &nbsp; &nbsp; &nbsp;   ; // Set the appropriate parameters
 &nbsp; &nbsp; &nbsp;   ; &nbsp; Vector paramsVector = new Vector();

 &nbsp;   &nbsp;   &nbsp;  // Here I am adding parameters for method
&nbsp; &nbsp; &nbsp;   ; &nbsp;  paramsVector.addElement( new Object);

  ; &nbsp; &nbsp; &nbsp; &nbsp;  Object result = client.execute(method, paramsVector);
 ; &nbsp; &nbsp; &nbsp; &nbsp;   System.out.println(&quot;XML-RPC result = "+result);

&nbsp; &nbsp; &nbsp; &nbsp; } catch (XmlRpcException e) {
 &nbsp; &nbsp;   ; &nbsp; &nbsp; System.err.println(e);
 &nbsp; &nbsp; &nbsp;   ; &nbsp; e.printStackTrace();
  ; &nbsp; &nbsp;  } catch (MalformedURLException e) {
 &nbsp;   ; &nbsp; &nbsp; &nbsp; System.err.println(e);
 &nbsp; &nbsp; &nbsp;   ; &nbsp; e.printStackTrace();
  ; &nbsp; &nbsp;  } catch (IOException e) {
 &nbsp; &nbsp;   ; &nbsp; &nbsp; System.err.println(e);
 &nbsp; &nbsp; &nbsp;   ; &nbsp; e.printStackTrace();
  ; &nbsp; &nbsp;  } catch (Exception e) {
 &nbsp;   ; &nbsp; &nbsp; &nbsp; System.err.println(e);
 &nbsp; &nbsp; &nbsp;   ; &nbsp; e.printStackTrace();
  ; &nbsp; &nbsp;  }
 &nbsp;  }
}

/********************************************************************************************************************/

XML-RPC over SSL
user name
2006-07-28 19:21:04
On 7/28/06, Rafaqat Ali <smoken0gmail.com> wrote:

>     I have xml-rpc running in tomcat server. I have
enabled https. I want to
> access it over https but Im getting error on client
side. IO am running
> client using following command

See

    http://ws.apache
.org/xmlrpc/ssl.html


-- 
My wife Mary and I have been married for forty-seven years
and not
once have we had an argument serious enough to consider
divorce;
murder, yes, but divorce, never.
(Jack Benny)

------------------------------------------------------------
---------
To unsubscribe, e-mail: xmlrpc-user-unsubscribews.apache.org
For additional commands, e-mail: xmlrpc-user-helpws.apache.org

XML-RPC over SSL
user name
2006-07-30 12:25:08
Hi
 &nbsp;  I tried this and while creating client I am using
SecureXmlRpcClient client = new SecureXmlRpcClient(&quot;https://localhost:8443/xmlrpc&quot;);
after execution I am getting

java.io.IOException: Server returned HTTP response code: 405 for URL: https://lo
calhost:8443/edb/
&nbsp; &nbsp;   ;  at org.apache.xmlrpc.XmlRpcClient$Worker.execute(XmlRpcClient.java:444)
   ; &nbsp; &nbsp; at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:163)
&nbsp; &nbsp; &nbsp;   at com.edb.usm.test.SecureXmlRpcTest.main(SecureXmlRpcTest.java:99)

Yes it is true. In case of normal execution when I enter webservice URL in browser it shows
HTTP Status 405 - HTTP method GET is not supported by this URL
and in my application it works fine.

But in case of secure execution it throws Exception. Any help ????

Regards
Rafaqat Ali


On 7/29/06, Jochen Wiedmann <gmail.com"> jochen.wiedmanngmail.com> wrote:
On 7/28/06, Rafaqat Ali <gmail.com"> smoken0gmail.com> wrote:

&gt; &nbsp; &nbsp; I have xml-rpc running in tomcat server. I have enabled https. I want to
> access it over https but Im getting error on client side. IO am running
&gt; client using following command

See

   http://ws.apache.org/xmlrpc/ssl.html


--
My wife Mary and I have been married for forty-seven years and not
once have we had an argument serious enough to consider divorce;
murder, yes, but divorce, never.
(Jack Benny)

---------------------------------------------------------------------
To unsubscribe, e-mail: ws.apache.org">xmlrpc-user-unsubscribews.apache.org
For additional commands, e-mail: ws.apache.org">xmlrpc-user-helpws.apache.org


XML-RPC over SSL
user name
2006-07-30 12:27:20
Sorry I am creating client as
SecureXmlRpcClient client = new SecureXmlRpcClient(&quot;https://localhost:8443/edb &quot;);
And here my service is deployed

On 7/30/06, Rafaqat Ali <gmail.com">smoken0gmail.com> wrote:
Hi
 ; &nbsp; I tried this and while creating client I am using
SecureXmlRpcClient client = new SecureXmlRpcClient(&quot; https://localhost:8443/xmlrpc&quot;);
after execution I am getting

java.io.IOException: Server returned HTTP response code: 405 for URL: https://lo
calhost:8443/edb/

 &nbsp; &nbsp;   ; at org.apache.xmlrpc.XmlRpcClient$Worker.execute(XmlRpcClient.java:444)
   ; &nbsp; &nbsp; at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:163)
  ; &nbsp; &nbsp;  at com.edb.usm.test.SecureXmlRpcTest.main(SecureXmlRpcTest.java:99)

Yes it is true. In case of normal execution when I enter webservice URL in browser it shows
HTTP Status 405 - HTTP method GET is not supported by this URL
and in my application it works fine.

But in case of secure execution it throws Exception. Any help ????

Regards
Rafaqat Ali



On 7/29/06, Jochen Wiedmann <gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> jochen.wiedmanngmail.com> wrote:
On 7/28/06, Rafaqat Ali <gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> smoken0gmail.com> wrote:

&gt; &nbsp; &nbsp; I have xml-rpc running in tomcat server. I have enabled https. I want to
> access it over https but Im getting error on client side. IO am running
&gt; client using following command

See

   http://ws.apache.org/xmlrpc/ssl.html


--
My wife Mary and I have been married for forty-seven years and not
once have we had an argument serious enough to consider divorce;
murder, yes, but divorce, never.
(Jack Benny)

---------------------------------------------------------------------
To unsubscribe, e-mail: ws.apache.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> xmlrpc-user-unsubscribews.apache.org
For additional commands, e-mail: ws.apache.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">xmlrpc-user-helpws.apache.org



XML-RPC over SSL
user name
2006-07-30 18:08:35
Rafaqat Ali wrote:
> java.io.IOException: Server returned HTTP response
code: 405 for URL: 
> https://lo
> calhost:8443/edb/
>         at 
>
org.apache.xmlrpc.XmlRpcClient$Worker.execute(XmlRpcClient.j
ava:444)
>         at
org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:163
)
>         at 
>
com.edb.usm.test.SecureXmlRpcTest.main(SecureXmlRpcTest.java
:99)

Servers log file?


------------------------------------------------------------
---------
To unsubscribe, e-mail: xmlrpc-user-unsubscribews.apache.org
For additional commands, e-mail: xmlrpc-user-helpws.apache.org

XML-RPC over SSL
user name
2006-07-31 07:58:28
It is now working if I enter localhost against firstname and last name when executing command
%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA
And when I run client using localhost on local machine it works fine.
but when I try to access it with ip address it doesn't work even I tried to put my machine's ip in first name and last name
I use following command to run program
java -cp classes;%JARS% com.edb.usm.test.SecureXmlRpcTest 10.90.1.124 8443 "C:\Documents and Settings\rafaqat\.keystore" changeit

but it thorws Exception

java.io.IOException: HTTPS hostname wrong:&nbsp; should be < 10.90.1.124>
java.io.IOException: HTTPS hostname wrong:&nbsp; should be <10.90.1.124>
&nbsp; &nbsp; &nbsp; &nbsp; at org.apache.xmlrpc.XmlRpcClient$Worker.execute(XmlRpcClient.java:444)
 &nbsp;   ; &nbsp; at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:163)
&nbsp; &nbsp;   ;  at com.edb.usm.test.SecureXmlRpcTest.main(SecureXmlRpcTest.java:116)

and in (SecureXmlRpcTest.java at line 116 I am calling execute method as
   ; &nbsp; &nbsp; &nbsp; &nbsp; Object result = client.execute(method, paramsVector);



On 7/30/06, Jochen Wiedmann <gmail.com"> jochen.wiedmanngmail.com> wrote:
Rafaqat Ali wrote:
>; java.io.IOException : Server returned HTTP response code: 405 for URL:
> https://lo
> calhost:8443/edb/
>; &nbsp; &nbsp; &nbsp; &nbsp; at
> org.apache.xmlrpc.XmlRpcClient$Worker.execute(XmlRpcClient.java:444)
>&nbsp; &nbsp; &nbsp;   ; at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:163)
&gt; &nbsp; &nbsp; &nbsp;   at
> com.edb.usm.test.SecureXmlRpcTest.main(SecureXmlRpcTest.java:99)

Servers log file?


---------------------------------------------------------------------
To unsubscribe, e-mail: ws.apache.org">xmlrpc-user-unsubscribews.apache.org
For additional commands, e-mail: ws.apache.org">xmlrpc-user-helpws.apache.org


XML-RPC over SSL
user name
2006-08-01 20:29:54
Rafaqat Ali wrote:

> And when I run client using localhost on local machine
it works fine.
> but when I try to access it with ip address it doesn't
work even I tried 
> to put my machine's ip in first name and last name

As I wrote in a previous mail, I am unsure, whether an IP
address works. 
AFAIK, you are supposed to use a host name, for which the
certificate is 
issued.


Jochen


------------------------------------------------------------
---------
To unsubscribe, e-mail: xmlrpc-user-unsubscribews.apache.org
For additional commands, e-mail: xmlrpc-user-helpws.apache.org

[1-7]

about | contact  Other archives ( Real Estate discussion Medical topics )