JAX-WS JSON extension can be used with JAX-WS Spring extension for more flexible configuration --- in particular to expose the same endpoint as both SOAP and JSON.

The following definitions show how to run GreetingService and expose it both as a SOAP endpoint (at http://yourhost/contextPath/soap) and as a JSON endpoint (at http://yourhost/contextPath/json)

  <wss:binding url="/soap">
    <wss:service>
      <ws:service bean="#myService" />
    </wss:service>
  </wss:binding>

  <wss:binding url="/json">
    <wss:service>
      <ws:service bean="#myService" bindingID="http://jax-ws-commons.java.net/json/" />
    </wss:service>
  </wss:binding>

  <bean id="myService" class="greeter.GreetingService" scope="prototype">
    ...
  </bean>

See the sample application for the complete example of how to put this all together by using Maven.

The prototype scope is so that the two endpoints use different instances of GreetingService. This is necessary for WebServiceContext injection to happen properly.


Terms of Use; Privacy Policy; Copyright ©2013-2014 (revision 20131025.e7cbc9d)
 
 
Close
loading
Please Confirm
Close