2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.logging.filter.base;
25 import javax.xml.namespace.QName;
26 import javax.xml.ws.handler.MessageContext;
27 import javax.xml.ws.handler.soap.SOAPHandler;
28 import javax.xml.ws.handler.soap.SOAPMessageContext;
30 public class SoapMetricLogHandler extends AbstractBaseMetricLogFilter<SOAPMessageContext, SOAPMessageContext>
31 implements SOAPHandler<SOAPMessageContext> {
34 protected int getHttpStatusCode(SOAPMessageContext ctx) {
35 return (Integer) ctx.get(MessageContext.HTTP_RESPONSE_CODE);
39 protected String getResponseCode(SOAPMessageContext ctx) {
40 Integer responseCode = (Integer) ctx.get(MessageContext.HTTP_RESPONSE_CODE);
41 return String.valueOf(responseCode);
45 protected String getTargetEntity(SOAPMessageContext ctx) {
46 return Constants.DefaultValues.UNKNOWN_TARGET_ENTITY;
50 protected String getTargetServiceName(SOAPMessageContext ctx) {
51 QName svc = (QName) ctx.get(SOAPMessageContext.WSDL_SERVICE);
52 QName op = (QName) ctx.get(SOAPMessageContext.WSDL_OPERATION);
53 return svc.getLocalPart() + ":" + op.getLocalPart();
57 public void close(MessageContext context) {
62 public boolean handleFault(SOAPMessageContext context) {
68 public boolean handleMessage(SOAPMessageContext context) {
74 public Set<QName> getHeaders() {
78 private void logMessage(SOAPMessageContext context) {
79 boolean outbound = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
83 this.post(context, context);