Announcement Announcement Module
Collapse
No announcement yet.
SimpleJaxWsServiceExporter and https Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SimpleJaxWsServiceExporter and https

    Hello everyone,

    I have made a soap api with Java 6, Jax-ws and Spring. I annotate my soap interface with @WebService, and expose it using the following Spring configuration:

    Code:
    <bean class="org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter" lazy-init="false">
    	<property name="baseAddress" value="http://localhost:9801/" />
    </bean>
    This all works very well, but now I want https support. And that's where the troubles start. When I change http to https in the baseAddress property, I get the following error:

    java.lang.IllegalArgumentException: https protocol based address is not supported.

    However, Java 6 is supposed to support https, isn't it? How to make this work?

    With kind regards,

    Leadpumper

  • #2
    In SimpleJaxWsServiceExporter there is an instance variable of type HttpServer.

    In the afterPropertiesSet() method the server is created and started. This would need to be overriden by a subclass to be created, using particularly Sun's classes HttpsServer and HttpsConfigurator.

    Unfortunately, usage isn't well documented, and there appear to be no working samples on the web. - You'll probably end up with a "real" web server.

    Comment


    • #3
      Originally posted by robbbert View Post
      In SimpleJaxWsServiceExporter there is an instance variable of type HttpServer.

      In the afterPropertiesSet() method the server is created and started. This would need to be overriden by a subclass to be created, using particularly Sun's classes HttpsServer and HttpsConfigurator.

      Unfortunately, usage isn't well documented, and there appear to be no working samples on the web. - You'll probably end up with a "real" web server.
      Hi Robbert,

      Thanks for your reply. It has put me in the right direction for solving this.

      For the record, I think you ment SimpleHttpServerJaxWsServiceExporter instead of SimpleJaxWsServiceExporter.

      I'm now implementing my own version of SimpleHttpServerJaxWsServiceExporter. This is not as "extend-friendly" as I think it should be (I ended up copying the source instead of extending it), and so I created a Jira ticket: SPR-5849.

      With kind regards,

      Leadpumper

      Comment


      • #4
        Ooops, I'm afraid of having fooled you with that "extend and overwrite" stuff:

        The SimpleHttpServerJaxWsServiceExporter has a setServer(HttpServer) method, and a HttpsServer extends HttpServer!

        Sorry

        Comment


        • #5
          I appreciate this thread is a little old, but having needed to do this recently and being unable to find much detail from anyone who has managed to do it previously I thought I would share.

          I did indeed take the SimpleHttpServerJaxWsServiceExporter approach, but you can do this almost entirely in config. The one exception is you need to initialise the SSLContext object you need to configure the HTTPS connection. I did this by implementing a simple class with a static method I could use to initialise the context and return it into the remainder of my config.

          I put full instructions on how I managed it here - http://www.codeghost.co.uk/blog/2011...-services.html

          Comment

          Working...
          X