This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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?
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.
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Joined: Jan 19, 2011
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.
I found the answer to my problem. I was not creating a handler for the incoming requests. I was supposed to use
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.