简体   繁体   中英

web service test ejb3 passing as Date parameter

My web service looks like

import entities.Expense;
import java.math.BigDecimal;
import java.util.Date;
import javax.ejb.EJB;
import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import logic.ExpenseSessionBeanLocal;

/**
 *
 * @author nikola
 */
@WebService(serviceName = "ExpenseWebService")
@Stateless()
public class ExpenseWebService {
    @EJB
    private ExpenseSessionBeanLocal ejbRef;// Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Web Service Operation")

    @WebMethod(operationName = "makeExpenseOnce")
    public Expense makeExpenseOnce(@WebParam(name = "expenseName") String expenseName, @WebParam(name = "expenseRecipient") String expenseRecipient, @WebParam(name = "purpose") String purpose, @WebParam(name = "username") String username, @WebParam(name = "expenseDate") Date expenseDate, @WebParam(name = "amount") BigDecimal amount, @WebParam(name = "currency") String currency) {
        return ejbRef.makeExpenseOnce(expenseName, expenseRecipient, purpose, username, expenseDate, amount, currency);
    }

}

Image from test is below

在此处输入图片说明

How to input date in the test with javax.xml.datatype.XMLGregorianCalendar as parameter?

AFAIK it's not possible to pass Objects to the Webservice-Tester (other than Strings). At least I never managed to post BigIntegers, for instance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM