The spring configuration will look something like this:
<jaxws:endpoint id="jsonWS"
implementor="#myService"
address="/json/MyService"
bindingUri="http://apache.org/cxf/binding/http">
<jaxws:properties>
<entry key="Content-Type" value="text/plain"/>
</jaxws:properties>
<jaxws:serviceFactory>
<bean
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
<property name="wrapped" value="false"/> <!-- Wrapped
services bugged: CXF-903 -->
<property name="properties">
<map>
<entry>
<key><value>javax.xml.stream.XMLInputFactory</value></key>
<bean
class="org.codehaus.jettison.mapped.MappedXMLInputFactory">
<constructor-arg>
<map>
<entry
key="http://myserviceiface.example.org/" value="myservice"/>
<entry
key="http://myserviceimpl.example.org/" value="myserviceimpl"/>
</map>
</constructor-arg>
</bean>
</entry>
<entry>
<key><value>javax.xml.stream.XMLOutputFactory</value></key>
<bean
class="org.codehaus.jettison.mapped.MappedXMLOutputFactory">
<constructor-arg>
<map>
<entry
key="http://myserviceiface.example.org/" value="myservice"/>
<entry
key="http://myserviceimpl.example.org/" value="myserviceimpl"/>
</map>
</constructor-arg>
</bean>
</entry>
</map>
</property>
</bean>
</jaxws:serviceFactory>
</jaxws:endpoint>
Liu, Jervis wrote:
Hi Kaleb, I am really not sure if it makes sense to convert SOAP message to
JSON. But if the payload is Plain-old--XML(POX), it should be doable in CXF. At
the moment, CXF HTTP binding can serve RESTful service in both POX and JSON
payload. Details can be found from
http://cwiki.apache.org/CXF20DOC/http-binding.html and
samples\restful_http_binding. If this is what you are looking for, we can spend
more time to figure what the spring configuration would look like for JSON.
Cheers,
Jervis
-----Original Message-----
From: Kaleb Walton [mailto:[EMAIL PROTECTED]
Sent: 2007?8?22? 22:42
To: [email protected]
Subject: JSON output
Is there an easy way to use JSON as the transport protocol
when configuring
a Service in Spring? I have a SOAP service working quite
nicely but would
like to expose the same service using JSON with minimal additional
configuration. I looked at the instructions on the wiki but
they only show
the programmatic way and I'd prefer to use Spring.
The pertinent parts of my current configuration are as follows:
<lang:groovy id="groovyService"
script-source="classpath:a/b/c/webservices/GroovyServiceImpl.groovy"/>
<simple:server id="groovy"
serviceClass="a.b.c.webservices.GroovyService"
serviceBean="#groovyService" address="/Groovy"/>
It'd be great to be able to create another service that
outputs JSON with
only a few extra lines of configuration. Please excuse me if
this seems a
simple problem, I admit I'm having trouble figuring out the
correlation
between the Spring server config and the programmatic
ServerFactoryBean.
Regards,
Kaleb
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland