Hi all

I've got an issue with a mustUnderstand SOAP Header that is used as service
parameter (it's a method parameter of the implementor).
As the MustUnderstandInterceptor is placed in the PRE_PROTOCOL phase, the
binding operation is not known at this time (except if there is a
SOAPAction header somewhere), so
the HeaderUtil.getHeaderQNameInOperationParam(soapMessage) don't return the
QName of the param header.

That leads the MustUnderstandInterceptor to think that the header is not
understood by the current interceptor chain. And thus, it register a
SOAPFault in the Message, fault that will be thrown as an Exception in
the MustUnderstandEndingInterceptor.

I've got that issue as part of the Java EE TCK on OW2 JOnAS, running CXF
2.5.2 (but it's also broken with 2.3.9).

I've attached to this message a modification of a soap header test case
that show the problem.

After some analyzing, it appears the MU interceptor runs too early in the
chain : before one of the AbstractInDatabindingInterceptor sub-classes (I
presume that on of theses implementations is setting up the
BindingOperationInfo into the message).
I've done a (naive) workaround simply by chaging the phase of the MU
interceptor: from PRE_PROTOCOL to UNMARSHAL.
That fixes the test, but I don't know if this is the right approach, or if
that breaks the streaming, or anything else ... :)

Any advice ?
Should I create a bug with the testcase and my proposed patch ?

Thanks
--Guillaume

PS: Theses git patches are build against the 2.5.x-fixes branch of the
github CXF mirror
From 83b2d6cbebc2a4446c9638ddca4f1ac0163b7767 Mon Sep 17 00:00:00 2001
From: Guillaume Sauthier <guillaume.sauth...@ow2.org>
Date: Fri, 24 Feb 2012 10:51:46 +0100
Subject: [PATCH 1/2] Adapted the soap_header testcase to show the error

---
 .../systest/soapheader/HeaderClientServerTest.java |    1 +
 .../test/resources/wsdl_systest/pizza_service.wsdl |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapheader/HeaderClientServerTest.java b/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapheader/HeaderClientServerTest.java
index 2aa2bed..2d68c95 100644
--- a/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapheader/HeaderClientServerTest.java
+++ b/systests/uncategorized/src/test/java/org/apache/cxf/systest/soapheader/HeaderClientServerTest.java
@@ -63,6 +63,7 @@ public class HeaderClientServerTest extends AbstractBusClientServerTestBase {
         CallerIDHeaderType header = new CallerIDHeaderType();
         header.setName("mao");
         header.setPhoneNumber("108");
+        header.setMustUnderstand(true);
 
         OrderPizzaResponseType res =  port.orderPizza(req, header);
 
diff --git a/systests/uncategorized/src/test/resources/wsdl_systest/pizza_service.wsdl b/systests/uncategorized/src/test/resources/wsdl_systest/pizza_service.wsdl
index b1465b8..cbaa9f2 100644
--- a/systests/uncategorized/src/test/resources/wsdl_systest/pizza_service.wsdl
+++ b/systests/uncategorized/src/test/resources/wsdl_systest/pizza_service.wsdl
@@ -22,6 +22,7 @@ under the License.
       targetNamespace="http://cxf.apache.org/pizza";
       xmlns:tns="http://cxf.apache.org/pizza";
       xmlns:types="http://cxf.apache.org/pizza/types";
+      xmlns:env="http://schemas.xmlsoap.org/soap/envelope/";
       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
 
@@ -32,6 +33,8 @@ under the License.
                   elementFormDefault="qualified"
                   version="1.0">
 
+        <xsd:import namespace="http://schemas.xmlsoap.org/soap/envelope/";
+                schemaLocation="http://schemas.xmlsoap.org/soap/envelope/"; />
         <xsd:element name="CallerIDHeader" type="tns:CallerIDHeaderType" />
 
         <xsd:complexType name="CallerIDHeaderType">
@@ -39,6 +42,7 @@ under the License.
             <xsd:element name="Name" type="xsd:string" />
             <xsd:element name="PhoneNumber" type="xsd:string" />
           </xsd:sequence>
+          <xsd:attribute ref="env:mustUnderstand" />
         </xsd:complexType>
 
         <xsd:element name="OrderRequest" type="tns:OrderPizzaType" />
-- 
1.7.9.1

From 7af8c7e0efc6953958e091e5ce556fca55d90342 Mon Sep 17 00:00:00 2001
From: Guillaume Sauthier <guillaume.sauth...@ow2.org>
Date: Fri, 24 Feb 2012 10:52:14 +0100
Subject: [PATCH 2/2] Proposed fix (move the MU interceptor later in the
 chain)

---
 .../interceptor/MustUnderstandInterceptor.java     |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
index c981ded..0b04d8c 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/MustUnderstandInterceptor.java
@@ -56,7 +56,7 @@ public class MustUnderstandInterceptor extends AbstractSoapInterceptor {
     private MustUnderstandEndingInterceptor ending = new MustUnderstandEndingInterceptor();
         
     public MustUnderstandInterceptor() {
-        super(Phase.PRE_PROTOCOL);
+        super(Phase.UNMARSHAL);
     }
     public MustUnderstandInterceptor(String phase) {
         super(phase);
-- 
1.7.9.1

Reply via email to