• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SSL Web Service Client

 
Bernhard Haeussermann
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I have a SSL web service running on a Glassfish application server.
After registering the certificate, I managed to write a client in .NET.
However, I need to get a client working in Java.
Here are my attempts:
When I try to add a web service reference to a Dynamic Web Project in Eclipse using the New Web Service Client wizard, it tells me "The service definition selected is invalid" when I enter the address https://ec2-175-129-234-13.compute-1.amazonaws.com:8181/secureservice/SecureService?wsdl.
When I execute the Ant-script



I get the following error:


Certainly I must tell the client stub generator where it can find the certificate (?). How should I go about this?

Thanks in advance.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
Is it a requirement that clients have to access the WSDL using SSL?
If not, you may consider applying SSL to the web service calls, but allowing normal HTTP access of the WSDL.
Actually, JSR-109 in section 9.3.2 specifies that only POST requests are to be protected by SSL in JAX-RPC and JAX-WS web services, thus GET requests used to retrieve the WSDL should not be protected by SSL.
To accomplish this, you specify the security constraints for the web service in the web.xml deployment descriptor as in this exampleÖ

Best wishes!
 
Bernhard Haeussermann
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ivan.

No, it's not necessary that the WSDL has to be accessed using SSL.
However, when I deploy the web service omitting in the web.xml file, I get errors in the clients when I do a test web service call (however, the client stub code generation is successful).
The .NET client that worked before (with <http-method>GET</http-method>) throws the following exception when I do a web service call:



A web service call in Java with the Axis client stubs (via the Add New Web Service Client wizard) yields:



When I generate the client stubs with wsimport (that Ant-file) I get


 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bernhard Haeussermann wrote:
However, when I deploy the web service omitting in the web.xml file, I get errors in the clients when I do a test web service call

As before, you should not omit the <http-method> specification, but change it to <http-method>POST</http-method>.
With this configuration, GET requests retrieving the WSDL will not be encrypted, and you can generate client artifacts using wsimport. Requests to the service, which are always HTTP POST requests, will require HTTPS.
Best wishes!
 
Bernhard Haeussermann
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I had two <http-method> specifications - one for POST and one for GET. I just removed the one for GET.
In fact, my web.xml looks just like the one you gave me. Sorry for the misunderstanding.
What else could be wrong? Might there be a problem with my web service?
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
First of all, as a desperate measure , I enclose the complete web.xml deployment descriptor:


Second, it looks strange that your web service replies with text/html when you request the WSDL. Are you able to successfully request the WSDL from a browser? Try using some kind of tool that let you see the HTTP headers and examine them.
Most of my experience is with the Metro web service stack and I have not seen problems like these before.
Good luck!
 
Bernhard Haeussermann
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My web.xml looks identical to yours.
Furthermore, there is no problem with retrieving the WSDL.
The three errors above all occur only when I attempt to make a web service call.
 
Bernhard Haeussermann
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I got one step further now. The following blog helped quite a bit: http://blogs.sun.com/andreas/entry/no_more_unable_to_find.
The Axis-generated code works now. Because my web service is currently using a test certificate I had to add it as a trusted certificate to the KeyStore on the client-side.
However, I still get the UnsupportedMediaException with the wsimport code. As it seems to me this is probably the same problem that the .NET client is moaning about.
Any ideas?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it looks strange that your web service replies with text/html when you request the WSDL. Are you able to successfully request the WSDL from a browser? Try using some kind of tool that let you see the HTTP headers and examine them.

I think this is the key to a solution. Make sure you're not getting back an HTML error page created by the server.
 
Bernhard Haeussermann
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic