You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2021/08/30 16:28:34 UTC

[cxf] branch 3.4.x-fixes updated: CXF-8587: Don't check the validation flag and get the schema on every iteration for SoapHeader. (#839)

This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch 3.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.4.x-fixes by this push:
     new ce4dd92  CXF-8587: Don't check the validation flag and get the schema on every iteration for SoapHeader. (#839)
ce4dd92 is described below

commit ce4dd92d8db804e9351ab1b43fc2b1f5b92ed089
Author: Ilya Mikhailov <el...@gmail.com>
AuthorDate: Mon Aug 30 16:05:24 2021 +0300

    CXF-8587: Don't check the validation flag and get the schema on every iteration for SoapHeader. (#839)
    
    * CXF-8587: Don't check the validation flag and get the schema on every iteration for SoapHeader.
    
    * CXF-8587: SoapHeader validation call moved back to main cycle.
    
    Co-authored-by: Ilya Mikhailov <Il...@lanit-tercom.com>
---
 .../binding/soap/interceptor/SoapHeaderInterceptor.java    | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java
index d2ab75c..5e9d91f 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapHeaderInterceptor.java
@@ -107,12 +107,19 @@ public class SoapHeaderInterceptor extends AbstractInDatabindingInterceptor {
 
         boolean supportsNode = this.supportsDataReader(message, Node.class);
         Service service = ServiceModelUtil.getService(message.getExchange());
+
+        Schema schema = null;
+        final boolean schemaValidationEnabled
+                = ServiceUtils.isSchemaValidationEnabled(SchemaValidationType.IN, message);
+        if (schemaValidationEnabled) {
+            schema = EndpointReferenceUtils.getSchema(service.getServiceInfos().get(0),
+                    message.getExchange().getBus());
+        }
+
         for (SoapHeaderInfo header : headers) {
             MessagePartInfo mpi = header.getPart();
             try {
-                if (ServiceUtils.isSchemaValidationEnabled(SchemaValidationType.IN, message)) {
-                    Schema schema = EndpointReferenceUtils.getSchema(service.getServiceInfos().get(0), message
-                                                                     .getExchange().getBus());
+                if (schemaValidationEnabled && schema != null) {
                     validateHeader(message, mpi, schema);
                 }
             } catch (Fault f) {
@@ -121,6 +128,7 @@ public class SoapHeaderInterceptor extends AbstractInDatabindingInterceptor {
                 }
                 throw f;
             }
+
             if (mpi.getTypeClass() != null) {
 
                 Header param = findHeader(message, mpi);