Exemple #1
0
func EncodeRequest(Cat cat.Cat, bts []byte, req *request.Request) util.Error {
	soapTran := Cat.NewTransaction("SOAP", "EncodeRequest")
	result := util.Error{}
	defer func() {
		if result.Err != nil && !result.IsNormal {
			soapTran.SetStatus(result.Err)
		} else {
			soapTran.SetStatus(CATTRANSUCCESS)
		}
		soapTran.Complete()
	}()
	if err := soapparse.EncReq(bts, req); err != nil {
		util.LogErrorEvent(Cat, "SoapParseRequestError", err.Error())
		result = util.Error{IsNormal: false, Err: err, Type: "SoapParseRequestError"}
	}
	return result
}
Exemple #2
0
func DecodeResponse(Cat cat.Cat, header *response.Header, resp interface{}) ([]byte, util.Error) {
	soapTran := Cat.NewTransaction("SOAP", "DecodeResponse")
	result := util.Error{}
	defer func() {
		if result.Err != nil && !result.IsNormal {
			soapTran.SetStatus(result.Err)
		} else {
			soapTran.SetStatus(CATTRANSUCCESS)
		}
		soapTran.Complete()
	}()
	content, err := soapparse.DecResp(header, resp) //
	if err != nil {
		util.LogErrorEvent(Cat, "SoapParseResponseError", err.Error())
		result = util.Error{IsNormal: false, Err: err, Type: "SoapParseResponseError"}
	}
	return content, result
}