java - @RequestBody is not working when used along with params attribute in @RequestMapping annotation -
my code below works fine , reads xml content @requestbody parameter
@requestmapping(method = requestmethod.post, value = "{clientcode}/paybycell.xml") public modelandview paybycell( httpservletrequest request, httpservletresponse response, @requestbody string xml, @pathvariable("clientcode") string clcode, @requestparam integer customerid) throws invalidrequestxmlexception, internalexception, exception { info("request body=="+xml); getservice().validatecitycodecid(clcode, customerid); paybycell(xml, clcode, customerid); response.setstatus(httpstatus.sc_ok); return null; }
the log file shows content eg
request body==<?xml version="1.0"encoding="utf-8" ?> <paybycell>
but wanted use same url pattern on different method baesd on request parameter,hence added params attribute in @requestmapping element shown below
@requestmapping(method = requestmethod.post, value = "/{clientcode}/paybycell.xml", params = { "customerid", "vendorname"}) public modelandview paybycellmultiplevendor( httpservletrequest request, httpservletresponse response, @requestbody string xml, @pathvariable("clientcode") string clcode, @requestparam("customerid") integer customerid, @requestparam("vendorname") string vendorname) throws invalidrequestxmlexception, internalexception, exception { if (vendorname == null) { throw new badrequestexception("check vendorname"); } info("request body=="+xml); getservice().validatecitycodecid(clcode, customerid); paybycell(xml, clcode, customerid, vendorname); response.setstatus(httpstatus.sc_ok); return null; }
but @requestbody content not read , shows empty vlue in logs like
request body==
what wrong.?
thanks in advance help
Comments
Post a Comment