Just to let you know that it worked perfectly in WAS CE 2.1.1.3 (latest) with cxf and dependencies embedded in the WAR file. Note: CXF is NOT bundled with WAS CE 2.1.1.3 but it was in WAS CE 2.1.1.2 Strange.
Thanks again ________________________________________ From: Sergey Beryozkin [[email protected]] Sent: 11 November 2009 17:38 To: [email protected] Subject: Re: JAXB xml response marshalling issue See a servlet named "CXFServlet" in this web.xml (theer're 4 of them there) http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/resources/jaxrs_non_spring/WEB-INF/web.xml It has a "/singleton/*" pattern and it sets no jaxrs address (which is equivalent to '/'). Changing "/singleton/*" to "/services/*" and updating the client code accordingly also works cheers, Sergey ----- Original Message ----- From: "Cristian Botiza" <[email protected]> To: <[email protected]> Sent: Wednesday, November 11, 2009 3:08 PM Subject: RE: JAXB xml response marshalling issue The exception only says something about the CORBA binding (!). IllegalAccessError: tried to access field org.apache.cxf.binding.AbstractBindingFactory.bus from class org.apache.cxf.binding.corba.CorbaBindingFactory Doesn't seem to have anything to do with my issue. ________________________________________ From: Sergey Beryozkin [[email protected]] Sent: 11 November 2009 17:07 To: [email protected] Subject: Re: JAXB xml response marshalling issue assuming you have /services/* and jaxrs.address / then URIs starting from /services/ should be accepted Perhaps the exception you're referring to can provide some clues ? cheers, Sergey ----- Original Message ----- From: "Cristian Botiza" <[email protected]> To: <[email protected]> Sent: Wednesday, November 11, 2009 2:24 PM Subject: RE: JAXB xml response marshalling issue Followed this (using CXFNonSpringJaxrsServlet): created my Application implementation. When deploying to geronimo, I get some huge stack trace but it still deploys. However, no matter what I set in <init-param>jaxrs.address I still get the message: setting the server publish address to be / The servlet is mapped to url-pattern /services/* However, I always get: Can't find the the request for <URL>'s Observer - in the logs and a response of 'No service was found' What am I doing wrong? ________________________________________ From: Sergey Beryozkin [[email protected]] Sent: 11 November 2009 13:04 To: [email protected] Subject: Re: JAXB xml response marshalling issue Please see http://cwiki.apache.org/CXF20DOC/jax-rs.html#JAX-RS-ConfiguringJAXRSservices thanks, Sergey ----- Original Message ----- From: "Cristian Botiza" <[email protected]> To: <[email protected]> Sent: Wednesday, November 11, 2009 10:46 AM Subject: RE: JAXB xml response marshalling issue I used a classpath file cxf.xml: web.xml: <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:cxf.xml </param-value> </context-param> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> And in cxf.xml: <jaxws:server id="mathservice" serviceClass="com...MathService" address="http://localhost:8080/MathService/" bindingId="http://apache.org/cxf/binding/http"> <jaxws:serviceBean> <bean class="com...MathResource"/> </jaxws:serviceBean> <jaxws:serviceFactory> <bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"> <property name="wrapped" value="true" /> </bean> </jaxws:serviceFactory> </jaxws:server> ________________________________________ From: Sergey Beryozkin [[email protected]] Sent: 11 November 2009 12:43 To: [email protected] Subject: Re: JAXB xml response marshalling issue Hi I'm sorry, can't help you here. Please consider moving to JAXRS as the HTTP binding (the one you're using) is not mantained, only some of the blockers for the existing users might get fixed occasionally. > unfortunately the jaxrs annotations seem to be ignored by CXF at least in my > experience How did you register a jaxrs:server endpoint from Spring ? Sergey ----- Original Message ----- From: "Cristian Botiza" <[email protected]> To: <[email protected]> Sent: Wednesday, November 11, 2009 10:35 AM Subject: RE: JAXB xml response marshalling issue Thanks for your quick response. I'm using annotations from org.codehaus.jra package (unfortunately the jaxrs annotations seem to be ignored by CXF at least in my experience). Ok, the code follows. interface: @WebService() @Produces("application/xml") @Consumes("application/xml") @HttpResource(location="/services/maths") public interface MathService { @Put @HttpResource(location="/Add") MathResponse sum(MathRequest req); @Post @HttpResource(location="/Subtract") MathResponse subtract(MathRequest req); @Post @HttpResource(location="/Multiply") MathResponse multiply(MathRequest req); } implementation class: public class MathResource implements MathService { public MathResource() { } public MathResponse sum(MathRequest req) { } public MathResponse multiply(MathRequest req) { BigDecimal result = req.getNumber1().multiply(req.getNumber2()); MathResponse r = new MathResponse(); r.setStatusCode(200); r.setError(false); r.setResult(result); return r; } public MathResponse subtract(MathRequest req) { //see above } } And the JAXB annotated classes (MathRequest, MathResponse): @XmlRootElement(name="CALCREQUEST") public class MathRequest { private BigDecimal number1; private BigDecimal number2; @XmlElement(name="NUM1") public BigDecimal getNumber1() { return number1; } public void setNumber1(BigDecimal number1) { this.number1 = number1; } @XmlElement(name="NUM2") public BigDecimal getNumber2() { return number2; } public void setNumber2(BigDecimal number2) { this.number2 = number2; } } @XmlRootElement(name="RESPONSE") @XmlAccessorType(XmlAccessType.PROPERTY) public class MathResponse { private BigDecimal result; private boolean error; private String errorDescription; private int statusCode; private String statusDescription; @XmlElement(name="RESULT") public BigDecimal getResult() { return result; } public void setResult(BigDecimal result) { this.result = result; } @XmlElement(name="ERROR") public boolean isError() { return error; } public void setError(boolean error) { this.error = error; } @XmlElement(name="ERROR_DESC") public String getErrorDescription() { return errorDescription; } public void setErrorDescription(String errorDescription) { this.errorDescription = errorDescription; } @XmlElement(name="STAT_CD") public int getStatusCode() { return statusCode; } public void setStatusCode(int statusCode) { this.statusCode = statusCode; } @XmlElement(name="STAT_DESC", defaultValue="Success") public String getStatusDescription() { return statusDescription; } public void setStatusDescription(String statusDescription) { this.statusDescription = statusDescription; } } Thanks again, Cristian ________________________________________ From: Sergey Beryozkin [[email protected]] Sent: 11 November 2009 12:33 To: [email protected] Subject: Re: JAXB xml response marshalling issue Hi Yes please. Just the method signature and the response class should do Also, do you use deprecated HTTP or JAXRS binding ? thanks, Sergey ----- Original Message ----- From: "Cristian Botiza" <[email protected]> To: <[email protected]> Sent: Wednesday, November 11, 2009 10:14 AM Subject: JAXB xml response marshalling issue Hi, I've developed a simple RESTful service with CXF 2.2.4. I use the HTTP transport, CXFServlet and Spring-based configuration. Everything works fine except that when marshalling the response into XML, the root element is auto-generated by CXF. More exactly, I get: <ns1:sumResponse> <RESULT>100</RESULT> <STAT_CD>200</STAT_CD> </ns1:sumResponse> instead of the expected: <RESPONSE> <RESULT>100</RESULT> <STAT_CD>200</STAT_CD> </RESPONSE> I can provide further details (code, Spring xml, web.xml) if needed. Regards, Cristian ________________________________ The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Any opinions expressed are mine and do not necessarily represent the opinions of the Company. Emails are susceptible to interference. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is strictly prohibited and may be unlawful. If you have received this message in error, do not open any attachments but please notify the EndavaIT Service Desk on (+44 (0)870 423 0187), and delete this message from your system. The sender accepts no responsibility for information, errors or omissions in this email, or for its use or misuse, or for any act committed or omitted in connection with this communication. If in doubt, please verify the authenticity of the contents with the sender. Please rely on your own virus checkers as no responsibility is taken by the sender for any damage rising out of any bug or virus infection. Endava Limited is a company registered in England under company number 5722669 whose registered office is at 125 Old Broad Street, London, EC2N 1AR, United Kingdom. Endava Limited is the Endava group holding company and does not provide any services to clients. Each of Endava Limited and its subsidiaries is a separate legal entity and has no liability for another such entity's acts or omissions. Please refer to the “Legal” section on our website for a list of legal entities.
