configure Spring to use jax-ws endpoint to consume XML then produceJSON

J

Jimmy

With the bean definition in spring.xml below, I'm getting the
following exception. It seems like it's trying to consume the request
as a JSON formated string rather than XML. How can I have the
endpoint to consume XML request then produce JSON response back to
caller? What's wrong with the spring bean definition?

Thanks,
Jimmy
P.S.


WARN org.apache.cxf.phase.PhaseInterceptorChain - Interceptor has
thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Marshalling Error: Invalid JSON
namespace: http://mydomain.com/blah/webservices
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:
161)
at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:
169)
at
org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:
114)
:
:



<jaxws:endpoint id="testServiceEndPoint" address="/testService"
bindingUri="http://apache.org/cxf/binding/http">
<jaxws:implementor>
<ref bean="testService" />
</jaxws:implementor>
<jaxws:serviceFactory>
<bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
<property name="wrapped" value="false"/>
<property name="properties">
<map>
<entry key="Content-Type" value="text/plain"/>
<entry>
<key>
<value>javax.xml.stream.XMLInputFactory</value>
</key>
<bean class="com.ctc.wstx.stax.WstxInputFactory">
</bean>
</entry>
<entry>
<key>
<value>javax.xml.stream.XMLOutputFactory</value>
</key>
<bean
class="org.codehaus.jettison.mapped.MappedXMLOutputFactory">
<constructor-arg>
<map>
</map>
</constructor-arg>
</bean>
</entry>
</map>
</property>
</bean>
</jaxws:serviceFactory>
</jaxws:endpoint>
 
J

Jimmy

@WebService(name = "TestServicePort", serviceName = "TestService",
targetNamespace = "http://mydomain.com/blah/webservices")
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use =
SOAPBinding.Use.LITERAL,
parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
public interface TestService {

@WebMethod
@Post
@HttpResource(location = "/doStuff")
@WebResult ReturnStuff doStuff(
@WebParam(name = "paramStuff")
ParamStuff paramStuff);
}

@XmlType(name = "ParamStuff")
public class ParamStuff {
private String stuff;

public void setStuff(String stuff) {
this.stuff = stuff;
}

public String getStuff() {
return stuff;
}
}

@XmlType(name = "ReturnStuff")
public class ReturnStuff {

private String stuff;

public void setStuff(String stuff) {
this.stuff = stuff;
}

public String getStuff() {
return stuff;
}
}

<!-- this is the xml request send from the caller -->
<doStuff>
<paramStuff>
<stuff>parameterValue</stuff>
</paramStuff>
</doStuff>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top