aspose file tools*
The moose likes Web Services and the fly likes Binding Endpoint to HTTPS problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Binding Endpoint to HTTPS problem" Watch "Binding Endpoint to HTTPS problem" New topic
Author

Binding Endpoint to HTTPS problem

Chris Luc
Greenhorn

Joined: Jan 19, 2011
Posts: 5
Hi guys. I created a basic REST service that works when it is invoked over a http connection. But when I try to add SSL on top I have some problems.

This is the code for the server creation:


The class RestSourcePayloadProvider has the public method invoke, but it never gets called when using https insteand of http. I suppose that the reason for this behaviour is that the binding for the endpoint is HTTPBinding.HTTP_BINDING, and not HTTPS. But I didn't manage to find a way to bind to https.

If I run the test client or the browser on "https://127.0.0.1:443/customerservice/customer" I get the same answer:

500 Internal Server Error No handler for context

Anyone has any idea about what's going on?
Thanks.
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

Hi Chris,
What server you are using?

Usually, HTTPS configuration should be available by uncommenting corresponding xml fragment in your server configuration file. If you are using JBoss, let me know I can explain through. But, unless you need your web service using a different binding name you don't need to really bind with HTTPS! Binding with HTTP automaticallly binds with HTTPS. It's a matter of enabling HTTPS on the server.


Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Chris Luc
Greenhorn

Joined: Jan 19, 2011
Posts: 5
Hi Naren,
Thanks for the reply.

Actually I am not running my server on an Application Server, like JBoss. My server is a standalone application that I start by calling the main method.
The server class is called "RestSourcePayloadProvider" and implements the interface "Provider". Interface "Provider" has only one method that must be implemented, and this method is "invoke". The application creates a server endpoint like this:



You can see that the binding for the created endpoint is HTTPBinding.HTTP_BINDING, and when I call the invoke method from the client nothing happens.

The client creates an object of Dispatch, by calling Service.create(). This Dispatch object connects to my server application and calls "invoke" to get what I need.Over HTTP I have no problems communicating, but when I switch to HTTPS there is no binding for the server.

Check this example to see how exactly I created my server and client applications: http://www.oracle.com/technetwork/articles/javase/index-137171.html

If you have a better idea please let me know.

Thanks a lot for your support.
Chris Luc
Greenhorn

Joined: Jan 19, 2011
Posts: 5
I found the answer to my problem. I was not creating a handler for the incoming requests. I was supposed to use



instead of



It looks like the interface Endpoint is implemented by the EndpointImpl class in Apache's CFX. When calling "publish(address)" the method called in EndpointImpl creates a ServerImpl that will be the service server. If I call "publish(server context)" nothing happens, because EndpointImpl doesn't override that method also.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Binding Endpoint to HTTPS problem