Hi

I think you need to remove 'v1' in the initial address  you're passing in to
the JAXRSClientFactory, the proxy will get it from ContentImportServiceImpl.

I'm not sure why 'null' is returned though - perhaps because the target
server returns 200 or 204 with the empty body ? Is it a CXF server ? You may
want to capture the payload on the wire just to verify...

cheers, Sergey

On Thu, Dec 2, 2010 at 4:35 PM, mschipperheyn <[email protected]>wrote:

>
> Hi,
>
> Newbie question: I keep getting the proxy return null, e.g. in the test
> below when I call importProxy.ping() or importContent. If I call the ping()
> method in the browser, everything work ok. I have the following
> configuration.
>
> Any suggestions on this one?
>
> Thanks!
>
> Marc
>
> @Test
> public void testStandardInsertValidation(){
>        MyVO vo = new MyVO();
>        importProxy = (ContentImport)
> JAXRSClientFactory.create("http://www.mysite.com.br:90/services/v1
> ",ContentImportServiceImpl.class,"user","pass","file:H:/java/projects/META-INF/spring/applicationContext.xml");
>        String res = importProxy.ping();
>        ResponseObject response = importProxy.importContent(vo);
>        [...]
> }
>
> @Service("contentImport")
> @Secured({"ROLE_WS","ROLE_ADMIN"})
> @Path("/v1")
> public class ContentImportServiceImpl extends AbstractContentImport
> implements ContentImport{
>
>        private static final Log log =
> LogFactory.getLog(ContentImportServiceImpl.class);
>
>        @POST
>        @Path("/import/standard")
>        @Secured({"ROLE_WS","ROLE_ADMIN"})
>        @Produces("text/xml")
>        public ResponseObject importContent(BaseOfferVO vo){
>                BindingResult result = new
> BeanPropertyBindingResult(vo,"offer");
>                ResponseObject response = validate(vo,null,result);
>
>                if(!result.hasErrors()){
>                        //proceed with insert
>                }
>
>                return response;
>        }
>
>        @GET
>        @Path("/ping")
>        @Produces("text/plain")
>        public String ping(){
>                return "Hello";
>        }
> }
>
> @XmlRootElement
> public class ResponseObject {
>        //Map<fieldname,error>
>        private Map<String,String> errors = new HashMap<String,String>();
>        private List<Long> ids = new ArrayList<Long>();
>        private int status;
>
>        @XmlElement
>        public Map<String, String> getErrors() {
>                return errors;
>        }
>
>        public void setErrors(Map<String, String> errors) {
>                this.errors = errors;
>        }
>
>        public void addFieldError(String field,String error){
>                errors.put(field,error);
>        }
>
>        public void addGeneralError(String error){
>                errors.put("general",error);
>        }
>
>        @XmlElement
>        public List<Long> getIds() {
>                return ids;
>        }
>
>        public void setIds(List<Long> ids) {
>                this.ids = ids;
>        }
>
>        public void addId(Long id){
>                ids.add(id);
>        }
>
>        @XmlAttribute
>        public int getStatus() {
>                return status;
>        }
>
>        public void setStatus(int status) {
>                this.status = status;
>        }
> }
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/jaxrs-proxy-always-returns-null-tp3289652p3289652.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>

Reply via email to