使用 WSO2 EI(6.5.0) DataService
时如何返回自定义错误响应验证输入值时出现此错误:
{
"Fault": {
"faultcode": "axis2ns16:VALIDATION_ERROR",
"faultstring": "DS Code: VALIDATION_ERROR\nNested Exception:-\njavax.xml.stream.XMLStreamException: DS Code: VALIDATION_ERROR\nSource Data Service:-\nName: MWGetBranchCodes\nLocation: \\MWGetBranchCodes.dbs\nDescription: N/A\nDefault Namespace: http://ws.wso2.org/dataservice\nCurrent Request Name: _post_getbankcodes\nCurrent Params: {SOURCE=source, REQUESTER=bond, FUNCTION=function, SECURITYCODE=1FE550839D5DD7933032340DA85F614}\nNested Exception:-\nSecuritycode and Function are not matched : \nField Name: SECURITYCODE\nField Value: 1FE550839D5DD7933032340DA85F614\n\n",
"detail": ""
}
}
我想要这个:
{
"Error": {
"ErrorCode": "0", 0-failed/ 1-success
"ErrorMessage": "VALIDATION_ERROR : Securitycode is NULL",
"detail": " \nField Name: SECURITYCODE\nField Value: null\n\n"
}
}
请帮助我,谢谢。
答案 0 :(得分:0)
我认为,对于该行为,您需要创建自定义验证器,请查看以下文章: http://mycodeideas.blogspot.com/2016/07/custom-validators-with-wso2-dss.html