如何用Java获取POST数据?

时间:2016-07-08 21:23:12

标签: java payu

我正在与Payu Web Checkout进行整合。放入帖子数据获得如下的POST:

response_code_pol=5
phone=
additional_value=0.00
test=1
transaction_date=2015-05-27 13:07:35
cc_number=************0004
cc_holder=test_buyer
error_code_bank=
billing_country=CO
bank_referenced_name=
description=test_payu_01
administrative_fee_tax=0.00
value=100.00

但我无法使用Rest Web Service @POST方法解析数据。

@POST
@Path("/status")
@Produces(ApiConstant.MEDIA_TYPE)
public Response status(
        @FormParam("transaction_date") String transactionDate,
        @FormParam("reference_sale") String referenceSale,
        @FormParam("sign") String sign,
        @FormParam("currency") String currency,
        @FormParam("state_pol") String state,
        @FormParam("extra1") String codigoBarras,
        @FormParam("response_code_pol") int stateCode,
        @FormParam("response_message_pol") int stateDescription,
        @HeaderParam("Host") String host) {

    try {
        Query updateFactura = em.createNativeQuery("UPDATE PAGOS.FACTURA SET ID_ESTADO = 2 WHERE CODIGO_BARRAS = ?1");
        updateFactura.setParameter(1, codigoBarras).executeUpdate();
    }
}

并显示此错误

Error 500: java.lang.IllegalArgumentException

0 个答案:

没有答案