users@glassfish.java.net

Web Service with Glassfish and SSL

From: <glassfish_at_javadesktop.org>
Date: Wed, 12 Nov 2008 12:00:37 PST

Hi all. I have a WebServer running in Glassfish and a WebClient in Visual Studio written in C#.

The client is only a form that has a button and a text box. When you click the button, it passes 2 numbers to the server, the server adds them, then sends the solution back to the client and displays it in the form's text box. This works perfect without SSL turned on.

When I turn on Transport SSL in Glassfish, I am using the default Glassfish certificate and have imported it into my certificate manager in Windows. Then I added code to the client to find the certificate. When I run it now, I get a 403 Unauthorized error at the point where it passes the numbers to the server (the line that reads: int a = service.add(2, 4);)

I know that the client is at least passing my network credentials user / pass. With the correct user / pass in there I get the 403 error I mentioned above. With an incorrect user / pass, I get a 401 error basically telling me that the credentials are wrong.
 


Any help with this would be much appreciated. I have been looking at this for about a week now and have tried serveral things to get the data to pass to the server without any progress. Obviously I am missing something...

Thanks,
REM2500

Here is my code for the client:

private void button1_Click(object sender, EventArgs e)
        {
            X509Store store = new X509Store(StoreLocation.LocalMachine);
            store.Open(OpenFlags.ReadOnly);
            X509Certificate2Collection col = store.Certificates.Find(X509FindType.FindBySerialNumber, "4991d31e", true);
            
            NewWebServiceService service = new NewWebServiceService();
            
            if (col.Count == 1)

            {
              service.Credentials = new NetworkCredential("user", "pass");
              int a = service.add(2, 4);
              textBox1.Text = a.ToString();

                
          }
        }
[Message sent by forum member 'rem2500' (rem2500)]

http://forums.java.net/jive/thread.jspa?messageID=316385