AnsweredAssumed Answered

Change output type of jax-ws service

Question asked by bergerle on Jan 14, 2015
Latest reply on Jan 19, 2015 by bergerle

Hi fellow developers,

 

I'm currently developing a plugin in which I'm using jax-ws services with a declaration like this (in spring.xml):

<bean id="myServiceClass" class="full.qualified.name.of.myServiceClass">
</bean>
<jaxws:endpoint id="myServiceEp" address="/myService/path"
  bindingUri="http://apache.org/cxf/binding/http">
  <jaxws:implementor>
       <ref bean="myServiceClass" />
  </jaxws:implementor>
  <jaxws:serviceFactory>
       <ref bean="wrappedServiceFactory" />
  </jaxws:serviceFactory>
</jaxws:endpoint>

 

Basically this works fine, but it always outputs some kind of SOAP style XML, no matter what return type my method has.

 

How can I change that behavior to output simple text (in my case JSON)?

And if I can do this, can I also get it to support a file download (right now, if I return a DataHandler, it encodes it with Base64 and returns that string in XML).

 

I know I could achieve this by using struts actions, but I want to get it working with WebServices.

 

Can anyone please help me out here?

Outcomes