Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing Spring Validator on Web services
    text
    copied!<p>Is it possible to use Spring Validators to validate data from Web Services Soap requests? Or more so what should I change about the below approach to make it possible?</p> <p>The precise context that I have is below:</p> <p>I have a web front end using Freemarker and Controllers that works fine with validation for example using </p> <pre><code>&lt;bean id="stockValidator" class="com.client.validator.StockValidator" /&gt; </code></pre> <p>In the dispatcher-servlet.xml</p> <p>Then in the StockController the validation occurs on Post requests.</p> <pre><code> @RequestMapping(value = "/addStock", method = RequestMethod.POST) public String addStudent(@ModelAttribute Stock stock,BindingResult result, ModelMap model ) { StockValidator.validate(stock, result ); if (result.hasErrors()) { //model.addAttribute("stock", stock); return "stock"; } else { StockService.save(stock); model.addAttribute("stockId", stock.getStockId()); model.addAttribute("stockCode", stock.getStockCode()); model.addAttribute("stockName", stock.getStockName()); return "result"; } } </code></pre> <p>However my SOAP web services are Annotation based wired into the services</p> <pre><code>import javax.jws.WebService; import org.springframework.beans.factory.annotation.Autowired; import com.olympus.viewtheworld.server.dao.StockDao; import com.olympus.viewtheworld.server.service.StockService; import com.olympus.viewtheworld.shared.domain.Stock; @WebService(endpointInterface = "com.server.service.StockService") public class StockServiceImpl implements StockService{ @Autowired StockDao stockDao; </code></pre> <p>This is mapped in the dispatcher servlet as such:</p> <pre><code> &lt;jaxws:endpoint id="stockService" implementorClass="com.server.service.Impl.StockServiceImpl" implementor="#stockServiceImpl" address="/SoapService/stock"&gt; &lt;jaxws:serviceFactory&gt; &lt;ref bean="jaxws-and-aegis-service-factory"/&gt; &lt;/jaxws:serviceFactory&gt; &lt;/jaxws:endpoint&gt; </code></pre> <p>Sorry I am a hobby developer and think that somewhere along the way I have got a bit confused in how best to approach this setup. If it is more appropriate to start again from scratch let me know.</p> <p>Cheers, Rob</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload