From 5dd253b422de3e483bac1d642efd60bbe59831f9 Mon Sep 17 00:00:00 2001 From: Dulanjali Dilmi Date: Wed, 23 Aug 2023 10:46:09 +0530 Subject: [PATCH] Fix soap12 response issue on failed operation Fix wso2/micro-integrator#2934 --- .../micro/integrator/security/pox/POXSecurityHandler.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/mediation/extensions/org.wso2.micro.integrator.security.handlers/utsecurity/src/org/wso2/micro/integrator/security/pox/POXSecurityHandler.java b/components/mediation/extensions/org.wso2.micro.integrator.security.handlers/utsecurity/src/org/wso2/micro/integrator/security/pox/POXSecurityHandler.java index 3f50b1e4f7..dbf414e2ec 100644 --- a/components/mediation/extensions/org.wso2.micro.integrator.security.handlers/utsecurity/src/org/wso2/micro/integrator/security/pox/POXSecurityHandler.java +++ b/components/mediation/extensions/org.wso2.micro.integrator.security.handlers/utsecurity/src/org/wso2/micro/integrator/security/pox/POXSecurityHandler.java @@ -151,7 +151,12 @@ public InvocationResponse invoke(MessageContext msgCtx) throws AxisFault { if (faultCodeObject instanceof SOAP11FaultCodeImpl) { faultCode = ((SOAP11FaultCodeImpl) faultCodeObject).getTextContent(); } else if (faultCodeObject instanceof SOAP12FaultCodeImpl) { - faultCode = ((SOAP12FaultSubCodeImpl) ((SOAP12FaultCodeImpl) faultCodeObject).getSubCode()).getTextContent(); + if (null != ((SOAP12FaultCodeImpl) faultCodeObject).getSubCode()) { + faultCode = ((SOAP12FaultSubCodeImpl) ((SOAP12FaultCodeImpl) faultCodeObject) + .getSubCode()).getTextContent(); + } else { + faultCode = ((SOAP12FaultCodeImpl)faultCodeObject).getTextContent(); + } } if (faultCode != null && faultCode.contains("FailedAuthentication")) { // this is standard error code according to the WS-Sec