Prev: Calling .NET exec from Java
Next: Business Calendar
From: Jimmy on 7 May 2010 13:18 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>
From: Jimmy on 7 May 2010 13:37 @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>
|
Pages: 1 Prev: Calling .NET exec from Java Next: Business Calendar |