package io.irontest.ws;

import io.irontest.db.ArticleDAO;
import io.irontest.models.Article;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import java.util.Date;
import java.util.List;

/**
 * Created by Zheng on 30/06/2015.
 */
@WebService
public class ArticleSOAP {
    private final ArticleDAO dao;

    public ArticleSOAP(ArticleDAO dao) {
        this.dao = dao;
    }

    @WebMethod
    public List<Article> findAll() {
        return dao.findAll();
    }

    @WebMethod
    public List<Article> findByCreationTime(@WebParam(name = "startTime") Date startTime,
                                            @WebParam(name = "endTime") Date endTime) {
        return dao.findByCreationTime(startTime, endTime);
    }
}

@@ -754,11 +754,248 @@
 );%0A    %7D
+%0A%0A    @WebMethod%0A    public void createArticle(@WebParam(name = %22title%22) String title, @WebParam(name = %22content%22) String content) %7B%0A        Article article = new Article(0, title, content, null, null);%0A        dao.insert(article);%0A    %7D
 %0A%7D%0A

add createArticle operation to the Article web service