java - Passing data (transactionId) to CXF interceptors -
i trying build ui view soap transactions sent out application.
a typical scenario each user transaction include multiple web-service request multiple systems , generating transactionid user transaction , logging logs transactionid in log file, log file can searched using transactionid , corrosponding log statements can displayed on ui.
so, able append generated transactionid log statements , able pull them log files.
but issue soap request, unable figure out way to add same transactionid in log file in soap request.
can provide me pointers how can pass generated transactionid cxf interceptors ( or custom cxf interceptors) when cxf logs soap request , repsonse append passed transactionid.
like this
info: outbound message --------------------------- transactionid=1234abcxxx id: 1 address: http://localhost:8080/zservice/get?wsdl encoding: utf-8 http-method: post content-type: text/xml headers: {accept=[*/*], soapaction=[""]} payload: <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:body><ns2:get xmlns:ns2="http://service.zservice.com/"><arg0/></ns2:get></soap:body></soap:envelope>
i able active using mdc
in web-service adapter invoking web-service client set transaction id in mdc this.
mdc.put("transaction", transid); account acct= new account(); //set requrest //invoke ws client client.get(acct);
in custom interceptors, retrieve transaction id
public void handlemessage(soapmessage message) { string transaction = mdc.get("transaction"); logger.info("transaction id: {} ", transaction); try { loginutil.logging(logger, message, transaction); } catch (exception ex) { logger.warn("unable save soap response due {}",ex.getmessage()); } }
Comments
Post a Comment