You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rpc-user@xml.apache.org by Ro...@AngleBar.com on 2002/09/09 17:22:03 UTC

SSL & Secure Client

I've tried to find an example of how to use the SecureClient to send a 
message to a SSL (https) server but have had no luck.  It is probably my 
lack of understanding of SSL.  But an example would greatly help.  I'm 
kinda desprate at this point.  I'm willing to pay somebody if you can help 
me get this working.  Anybody need some extra money?

Here is my current code.  I get the error "java.net.MalformedURLException: 
unknown protocol: https". 

package org.apache.xmlrpc;

import java.util.*;
import java.io.*;
import org.apache.xmlrpc.*;
import org.apache.xmlrpc.secure.*;
import java.net.*;

public class Example2 {


        public static final String userName = "username";
        public static final String password = "password";
        public static final String urlGetFileName = 
"https://anglebar.com/perl/getfilename";
        public static final String serviceGetFileName = "Service.GetName";
 

public static void main(String[] args) {
 
                sendCusFile("x"); 

}
private static void sendCusFile(String fileName) {
        try {

                SecureXmlRpcClient xmlrpc = new 
SecureXmlRpcClient(urlGetFileName);
 
                // set Authentication
                xmlrpc.setBasicAuthentication(userName, password);

                URL urlS = xmlrpc.getURL();
 
                Vector params = new Vector();
                params.addElement(userName);
                params.addElement(password);
                params.addElement("A"); 
                params.addElement("0100"); 
                params.addElement("PR"); 
                // this method returns a string
                String result = (String) 
xmlrpc.execute(serviceGetFileName, params);

        }
        catch (IOException ioE) {
                ioE.printStackTrace();
        }
        catch (XmlRpcException xmlRpcE) {
                xmlRpcE.printStackTrace();
        }

}
}

Re: SSL & Secure Client

Posted by "James O. Flynn" <ja...@melloworld.com>.
Been through some of the same pain. Quite seperately from using the SecureClient, you may want
to prime the java secure socket factory using the java security stuff, let me dig out some of
what I did...

	/// Not too sure what all of this is for.

	SSLContext context = SSLContext.getInstance( "TLS" );
	KeyManagerFactory keyFactory = KeyManagerFactory.getInstance( "SunX509" );
	KeyStore store = KeyStore.getInstance( "JKS" );
	store.load( new FileInputStream( keyFile ), passphrase );
	keyFactory.init( store, passphrase );
	context.init( keyFactory.getKeyManagers(), null, null );

	client = new SecureXmlRpcClient( "https://someurl..." );
	...

This didn't work for me, but I was trying to use PKCS12 keys with java 1.3 and for some
reason it NullPointerExceptioned deep in the native stuff. Might give you luck.
Cheers,
James.
-- 
4920616d206e6f742061206e756d62657221

Junk mail systematically deleted.

Re: SSL & Secure Client

Posted by Tim Heath <wg...@fedex.com>.
I would like to know how to do this once someone figures it out, could
someone make a tutorial?

Thanks,

Tim Heath

Ryan Hoegg wrote:
> 
> Hello,
> 
> A little more information may be appropriate.  What version of the JDK
> are you using?  Have you tried the same XML-RPC method over HTTP?  Have
> you tested SSL to the server using a plain web browser?
> 
> The next step for me would be to download the source to this library and
> follow the exception stack trace.
> 
> Good luck,
> Ryan Hoegg
> ISIS Networks
> 
> Robert.Mattler@AngleBar.com wrote:
> 
> > I've tried to find an example of how to use the SecureClient to send a
> > message to a SSL (https) server but have had no luck.  It is probably
> > my lack of understanding of SSL.  But an example would greatly help.
> >  I'm kinda desprate at this point.  I'm willing to pay somebody if you
> > can help me get this working.  Anybody need some extra money?
> >
> > Here is my current code.  I get the error
> > "java.net.MalformedURLException: unknown protocol: https".

Re: SSL & Secure Client

Posted by Tim Heath <wg...@fedex.com>.
I would like to know how to do this once someone figures it out, could
someone make a tutorial?

Thanks,

Tim Heath

Ryan Hoegg wrote:
> 
> Hello,
> 
> A little more information may be appropriate.  What version of the JDK
> are you using?  Have you tried the same XML-RPC method over HTTP?  Have
> you tested SSL to the server using a plain web browser?
> 
> The next step for me would be to download the source to this library and
> follow the exception stack trace.
> 
> Good luck,
> Ryan Hoegg
> ISIS Networks
> 
> Robert.Mattler@AngleBar.com wrote:
> 
> > I've tried to find an example of how to use the SecureClient to send a
> > message to a SSL (https) server but have had no luck.  It is probably
> > my lack of understanding of SSL.  But an example would greatly help.
> >  I'm kinda desprate at this point.  I'm willing to pay somebody if you
> > can help me get this working.  Anybody need some extra money?
> >
> > Here is my current code.  I get the error
> > "java.net.MalformedURLException: unknown protocol: https".

Re: SSL & Secure Client

Posted by Ryan Hoegg <rh...@isisnetworks.net>.
Hello,

A little more information may be appropriate.  What version of the JDK 
are you using?  Have you tried the same XML-RPC method over HTTP?  Have 
you tested SSL to the server using a plain web browser?

The next step for me would be to download the source to this library and 
follow the exception stack trace.

Good luck,
Ryan Hoegg
ISIS Networks

Robert.Mattler@AngleBar.com wrote:

> I've tried to find an example of how to use the SecureClient to send a 
> message to a SSL (https) server but have had no luck.  It is probably 
> my lack of understanding of SSL.  But an example would greatly help. 
>  I'm kinda desprate at this point.  I'm willing to pay somebody if you 
> can help me get this working.  Anybody need some extra money?
>
> Here is my current code.  I get the error 
> "java.net.MalformedURLException: unknown protocol: https". 



Re: SSL & Secure Client

Posted by "James O. Flynn" <ja...@melloworld.com>.
Been through some of the same pain. Quite seperately from using the SecureClient, you may want
to prime the java secure socket factory using the java security stuff, let me dig out some of
what I did...

	/// Not too sure what all of this is for.

	SSLContext context = SSLContext.getInstance( "TLS" );
	KeyManagerFactory keyFactory = KeyManagerFactory.getInstance( "SunX509" );
	KeyStore store = KeyStore.getInstance( "JKS" );
	store.load( new FileInputStream( keyFile ), passphrase );
	keyFactory.init( store, passphrase );
	context.init( keyFactory.getKeyManagers(), null, null );

	client = new SecureXmlRpcClient( "https://someurl..." );
	...

This didn't work for me, but I was trying to use PKCS12 keys with java 1.3 and for some
reason it NullPointerExceptioned deep in the native stuff. Might give you luck.
Cheers,
James.
-- 
4920616d206e6f742061206e756d62657221

Junk mail systematically deleted.

Re: SSL & Secure Client

Posted by Ryan Hoegg <rh...@isisnetworks.net>.
Hello,

A little more information may be appropriate.  What version of the JDK 
are you using?  Have you tried the same XML-RPC method over HTTP?  Have 
you tested SSL to the server using a plain web browser?

The next step for me would be to download the source to this library and 
follow the exception stack trace.

Good luck,
Ryan Hoegg
ISIS Networks

Robert.Mattler@AngleBar.com wrote:

> I've tried to find an example of how to use the SecureClient to send a 
> message to a SSL (https) server but have had no luck.  It is probably 
> my lack of understanding of SSL.  But an example would greatly help. 
>  I'm kinda desprate at this point.  I'm willing to pay somebody if you 
> can help me get this working.  Anybody need some extra money?
>
> Here is my current code.  I get the error 
> "java.net.MalformedURLException: unknown protocol: https".