David, can you explain what RM and ESB scenarios require this? I don't see Sandesha or Synapse needing it. I don't know enough about JAX-WS to have intelligent input.

Sanjiva.

David Illsley wrote:
Jeff,
I still think some kind of pluggability would be a good thing, as this
has come up for a number of scenarios (JAX-WS, building an ESB,
WS-RM). What you're describing is really a hack, and it doesn't
actually stop the mU code running in the engine. How about a form of
plugability at the level of a boolean on AxisConfiguration which can
turn off the built in mU code? It's clear from these discussions that
it's really easy to hack round the mU code. I can't see the harm in
making it easier and more effiecient for those who really want to do
it.
David

On 25/06/07, Jeff Barrett <[EMAIL PROTECTED]> wrote:
Hi Dims and Sanjiva,

I've read the previous discussion of mustUnderstand processing which Dims
sent me via a chat http://marc.info/?t=116949973400005&r=1&w=2 (Thanks,
Dims)

Given that discussion, I believe the suggested approach here is to add a
handler in the distpatch phase that will mark the headers as processed,
even though they are not actually processed yet. In our JAX-WS case, that
handler would mark headers as processed for:
- Headers that correspond to parameters on the SEI
- Headers that will be processed by JAX-WS application handlers

The headers would not actually be consumed until the JAX-WS message
receiver is invoked, but the headers would be marked as processed by the
new handler in order to pass mustUnderstand checks in the engine.   Did I
understand that correctly?

Beyond that, there are a couple more longer-term considerations (which my
commit did not address):

1) The mustUnderstand processing also needs to consider the SOAP
actor/role, which Axis2 currently does not do.  Only mustUnderstand
headers for roles in which the node acts should be checked; mustUnderstand
headers for roles the node does not act in should be ignored.   So, if
there's a mustUnderstand header for actor="notThisRole" and this node
doesn't act in that role, then that header somehow needs to be ignored by
the Axis2 checks.  I think to fix this will recquire a registration
mechanism for roles acted in and headers which are understood.  The roles
of NEXT and ULTIMATE_RECEIVER should always be checked I believe.

2) Strictly speaking per the SOAP spec, I believe the conformance
requirement is that no processing occur on a message if all the
mustUnderstand headers for the appropriate roles are not understood. That
means, ideally, the mustUnderstand checks should be done before the
handlers are invoked, which would also require registration of roles and
understood headers.  There are other issues with implenting this, though,
because of having to target the operation for example.

3) Some of the mustUnderstand processing requirements noted above are
conformance requirements tested to some extent by the JAX-WS and JSR-181
TCKs, and 1.4 CTS (this commit only addressed part of these issues; there
are more changes which are needed to pass these tests).

Thanks,
Jeff

IBM Software Group - WebSphere Web Services Development
Phone: 512-838-4587 or Tie Line 678-4587
Internet e-mail and Sametime ID: [EMAIL PROTECTED]



"Davanum Srinivas" <[EMAIL PROTECTED]>
06/24/2007 06:53 AM
Please respond to
axis-dev@ws.apache.org


To
axis-dev@ws.apache.org
cc

Subject
Re: [axis2] header processing by !handlers (was: Re: svn commit: r549924 -
in /webservices/axis2/trunk/java/modules:
kernel/src/org/apache/axis2/description/
kernel/src/org/apache/axis2/engine/
metadata/src/org/apache/axis2/jaxws/description/impl/ me






Jeff,

How about we make allow MU handling to be pluggable? with an entry in
axis2.xml, just like the TargetResolver

thanks,
dims

On 6/24/07, Sanjiva Weerawarana <[EMAIL PROTECTED]> wrote:
> Jeff, was this idea discussed/proposed on the list? If so apologies for
> missing it.
>
> IMO this is a departure from the principle that headers are handled by
> handlers.
>
> Sanjiva.
>
> [EMAIL PROTECTED] wrote:
> > Author: barrettj
> > Date: Fri Jun 22 11:33:38 2007
> > New Revision: 549924
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=549924
> > Log:
> > Add ability for other components (such as message recievers) to
indicate they will handle certain mustUnderstand headers.
> > Add registration of JAXWS header paramaters as headers that will be
understood by the JAXWS Message Receiver; add associated test.
> >
> > Added:
> >
webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/MustUnderstandTests.java
> > Modified:
> >
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperation.java
> >
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
> >
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
> >
> > Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperation.java
> > URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperation.java?view=diff&rev=549924&r1=549923&r2=549924

> >
==============================================================================
> > ---
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperation.java
(original)
> > +++
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisOperation.java
Fri Jun 22 11:33:38 2007
> > @@ -59,6 +59,20 @@
> >
> >      // to store mepURL
> >      private String mepURI;
> > + // List of Header QNames that have been registered as understood,
for example by message receivers.
> > +    // This list DOES NOT contain QNames for headers understood by
handlers (e.g. security or sandesha)
> > +    // This list is used in the Axis2 Engine checkMustUnderstand
processing to identify headers
> > +    // marked as mustUnderstand which  have not yet been processed
(via dispatch handlers),
> > +    // but which will be processed by the message receiver.
> > +    // REVIEW: (1) This only supports a single list of understood
headers; should there be
> > +    // different lists for INPUT messages and OUTPUT messages?
> > +    // (2) This probably needs to support SOAP actors/roles
> > +    // (3) Strictly speaking, per the SOAP spec, all mustUnderstand
checks should be performed
> > +    // before processing begins on the message.  So, ideally, even
the QoSes should register
> > + // the headers (and roles) they understand and the mustUnderstand
checks should be done before
> > +    // they are invoked.  There are issues with that, however, in
terms of targeting the operation, and
> > +    // the possible encryption of headers.
> > +    private ArrayList understoodHeaderQNames = new ArrayList();
> >
> >      private MessageReceiver messageReceiver;
> >
> > @@ -555,4 +569,29 @@
> >          return getChildren();
> >      }
> >
> > +    /**
> > +     * Return the list of SOAP header QNames that have been
registered as understood by
> > +     * message receivers, for example.  Note that this list DOES NOT
contain the QNames that are
> > + * understood by handlers run prior to the message receiver. This
is used in the Axis2
> > +     * Engine checkMustUnderstand processing to identify headers
marked as mustUnderstand which
> > + * have not yet been processed (via dispatch handlers), but which
will be processed by
> > +     * the message receiver.
> > +     *
> > +     * @return ArrayList of handler QNAames registered as understood
by the message receiver.
> > +     */
> > +    public ArrayList getUnderstoodHeaderQNames() {
> > +        return understoodHeaderQNames;
> > +    }
> > +
> > +    /**
> > +     * Add a SOAP header QName to the list of headers understood by
this operation.  This is used
> > +     * by other (non dispatch handler) components such as a message
receiver to register that it
> > +     * will process a header.
> > +     * @param understoodHeader
> > +     */
> > + public void registerUnderstoodHeaderQName(QName understoodHeader)
{
> > +        if (understoodHeader != null) {
> > +            understoodHeaderQNames.add(understoodHeader);
> > +        }
> > +    }
> >   }
> >
> > Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
> > URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java?view=diff&rev=549924&r1=549923&r2=549924

> >
==============================================================================
> > ---
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
(original)
> > +++
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/engine/AxisEngine.java
Fri Jun 22 11:33:38 2007
> > @@ -70,11 +70,29 @@
> >
> >          while (headerBlocks.hasNext()) {
> >              SOAPHeaderBlock headerBlock = (SOAPHeaderBlock)
headerBlocks.next();
> > +            QName headerQName = headerBlock.getQName();
> >
> >              // if this header block has been processed or
mustUnderstand isn't
> >              // turned on then its cool
> >              if (headerBlock.isProcessed() ||
!headerBlock.getMustUnderstand()) {
> >                  continue;
> > +            }
> > +            // Check if another component, such as the message
receiver, has  registered that
> > +            // they will process this header
> > +            AxisOperation axisOperation =
msgContext.getAxisOperation();
> > +            if (axisOperation != null) {
> > +                ArrayList understoodHeaderList = (ArrayList)
axisOperation.getUnderstoodHeaderQNames();
> > +                if (understoodHeaderList != null &&
!understoodHeaderList.isEmpty()) {
> > + if (understoodHeaderList.contains(headerQName)) {
> > +                        if (LoggingControl.debugLoggingAllowed &&
log.isDebugEnabled()) {
> > +                            log.debug("MustUnderstand header
registered as understood on AxisOperation: " + headerQName);
> > +                        }
> > +                        continue;
> > +                    }
> > +                }
> > +            }
> > +            if (LoggingControl.debugLoggingAllowed &&
log.isDebugEnabled()) {
> > +                log.debug("MustUnderstand header not processed or
registered as understood " + headerQName);
> >              }
> >
> >              // Oops, throw an appropriate MustUnderstand fault!!
> >
> > Modified:
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
> > URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java?view=diff&rev=549924&r1=549923&r2=549924

> >
==============================================================================
> > ---
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
(original)
> > +++
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
Fri Jun 22 11:33:38 2007
> > @@ -18,10 +18,12 @@
> >
> >  package org.apache.axis2.jaxws.description.impl;
> >
> > +import org.apache.axis2.AxisFault;
> >  import org.apache.axis2.description.AxisMessage;
> >  import org.apache.axis2.description.AxisOperation;
> >  import org.apache.axis2.description.AxisOperationFactory;
> >  import org.apache.axis2.description.AxisService;
> > +import org.apache.axis2.description.Parameter;
> >  import org.apache.axis2.description.WSDL2Constants;
> >  import org.apache.axis2.jaxws.ExceptionFactory;
> >  import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> > @@ -205,7 +207,9 @@
> >          } else {
> >              this.axisOperation = createAxisOperation();
> >          }
> > -    }
> > +        // Register understood headers on axisOperation
> > +        registerMustUnderstandHeaders();
> > +}
> >
> >      /**
> >       * Create an AxisOperation for this Operation.  Note that the
ParameterDescriptions must be
> > @@ -346,6 +350,8 @@
> >              parameterDescriptions = createParameterDescriptions();
> >              faultDescriptions = createFaultDescriptions();
> >          }
> > +        // Register understood headers on axisOperation
> > +        registerMustUnderstandHeaders();
> >      }
> >
> >      public EndpointInterfaceDescription
getEndpointInterfaceDescription() {
> > @@ -1617,5 +1623,48 @@
> >              return string.toString();
> >          }
> >          return string.toString();
> > +    }
> > +
> > +    /**
> > + * Adds a list of SOAP header QNames that are understood by JAXWS
for this operation to the
> > +     * AxisOperation.  This will be used by Axis2 to verify that all
headers marked as
> > +     * mustUnderstand have been or will be processed.
> > +     *
> > +     * Server side headers considered understood [JAXWS 2.0 Sec
10.2.1 page 117]
> > +     * - SEI method params that are in headers
> > +     * - Headers processed by application handlers (TBD)
> > +     *
> > +     * Client side headers considered understood: None
> > +     *
> > +     */
> > +    private void registerMustUnderstandHeaders() {
> > +
> > + // REVIEW: If client side (return value, OUT or INOUT params)
needs to be supported then
> > +        // this needs to process client and server differently.
> > +
> > +        AxisOperation theAxisOperation = getAxisOperation();
> > +        if (theAxisOperation == null) {
> > +            if (log.isDebugEnabled()) {
> > +                log.debug("The axis operation is null, so header
QNames could not be registered.  OpDesc = " + this);
> > +            }
> > +            return;
> > +        }
> > +
> > +        // If any IN or INOUT parameters are in the header, then add
their QNames to the list
> > +        ParameterDescription paramDescs[] =
getParameterDescriptions();
> > +        if (paramDescs != null && paramDescs.length > 0) {
> > +            for (ParameterDescription paramDesc : paramDescs) {
> > +                if (paramDesc.isHeader()
> > +                        && (paramDesc.getMode() == WebParam.Mode.IN
> > +                                || paramDesc.getMode() ==
WebParam.Mode.INOUT)) {
> > +                    QName headerQN = new
QName(paramDesc.getTargetNamespace(),
> > + paramDesc.getParameterName());
> > + theAxisOperation.registerUnderstoodHeaderQName(headerQN);
> > +                    if (log.isDebugEnabled()) {
> > +                        log.debug("OpDesc: understoodQName added to
AxisOperation (if not null) " + headerQN);
> > +                    }
> > +                }
> > +            }
> > +        }
> >      }
> >  }
> >
> > Added:
webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/MustUnderstandTests.java
> > URL:
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/MustUnderstandTests.java?view=auto&rev=549924

> >
==============================================================================
> > ---
webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/MustUnderstandTests.java
(added)
> > +++
webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/MustUnderstandTests.java
Fri Jun 22 11:33:38 2007
> > @@ -0,0 +1,82 @@
> > +/*
> > + * Licensed to the Apache Software Foundation (ASF) under one
> > + * or more contributor license agreements.  See the NOTICE file
> > + * distributed with this work for additional information
> > + * regarding copyright ownership.  The ASF licenses this file
> > + * to you under the Apache License, Version 2.0 (the
> > + * "License"); you may not use this file except in compliance
> > + * with the License.  You may obtain a copy of the License at
> > + *
> > + *      http://www.apache.org/licenses/LICENSE-2.0
> > + *
> > + * Unless required by applicable law or agreed to in writing,
> > + * software distributed under the License is distributed on an
> > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> > + * KIND, either express or implied.  See the License for the
> > + * specific language governing permissions and limitations
> > + * under the License.
> > + */
> > +package org.apache.axis2.jaxws.description;
> > +
> > +import org.apache.axis2.description.AxisOperation;
> > +
> > +import javax.jws.WebParam;
> > +import javax.jws.WebService;
> > +import javax.xml.namespace.QName;
> > +import javax.xml.ws.Holder;
> > +
> > +import java.util.ArrayList;
> > +
> > +import junit.framework.TestCase;
> > +
> > +/**
> > + *
> > + */
> > +public class MustUnderstandTests extends TestCase {
> > +
> > +    public void testHeaderParameters() {
> > +        // Test IN and INOUT header paramaters in SEI
> > +        ServiceDescription svcDesc =
DescriptionFactory.createServiceDescription(HeaderParameters.class);
> > +        assertNotNull(svcDesc);
> > +        EndpointDescription epDescs[] =
svcDesc.getEndpointDescriptions();
> > +        assertNotNull(epDescs);
> > +        assertEquals(1, epDescs.length);
> > +        EndpointInterfaceDescription epiDesc =
epDescs[0].getEndpointInterfaceDescription();
> > +        assertNotNull(epiDesc);
> > +
> > +        OperationDescription opDescs[] = epiDesc.getOperations();
> > +        assertNotNull(opDescs);
> > +        assertEquals(1, opDescs.length);
> > +        OperationDescription opDesc = opDescs[0];
> > +        assertEquals("echoString", opDesc.getOperationName());
> > +
> > +        AxisOperation axisOperation = opDesc.getAxisOperation();
> > +        assertNotNull(axisOperation);
> > +        ArrayList understoodQNames =
axisOperation.getUnderstoodHeaderQNames();
> > +        assertNotNull(understoodQNames);
> > +        assertEquals(4, understoodQNames.size());
> > +
> > +        assertTrue(understoodQNames.contains(new
QName("webservice.namespace", "renamedParam1")));
> > +        assertTrue(understoodQNames.contains(new
QName("webservice.namespace", "arg1")));
> > +        assertTrue(understoodQNames.contains(new
QName("webparam.namespace", "arg2")));
> > +        assertFalse(understoodQNames.contains(new
QName("webservice.namespace", "outOnly")));
> > +        assertFalse(understoodQNames.contains(new
QName("webservice.namespace", "arg3")));
> > +        assertTrue(understoodQNames.contains(new
QName("webservice.namespace", "inOut")));
> > +        assertFalse(understoodQNames.contains(new
QName("webservice.namespace", "arg4")));
> > +        assertFalse(understoodQNames.contains(new
QName("webservice.namespace", "notInHeader")));
> > +        assertFalse(understoodQNames.contains(new
QName("webservice.namespace", "arg5")));
> > +    }
> > +}
> > +
> > [EMAIL PROTECTED](targetNamespace="webservice.namespace")
> > +class HeaderParameters {
> > +    public String echoString(
> > +            @WebParam(name="renamedParam1", header=true) String
param1,
> > +            @WebParam(header=true) String param2,
> > +            @WebParam(targetNamespace="webparam.namespace",
header=true) String param3,
> > +            @WebParam(mode=WebParam.Mode.OUT, header=true)
Holder<String> outOnly,
> > +            @WebParam(name="inOut", mode=WebParam.Mode.INOUT,
header=true) Holder<String> inOut,
> > +            String notInHeader) {
> > +                return null;
> > +            }
> > +}
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> --
> Sanjiva Weerawarana, Ph.D.
> Founder & Director; Lanka Software Foundation; http://www.opensource.lk/
> Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/
> Director; Open Source Initiative; http://www.opensource.org/
> Member; Apache Software Foundation; http://www.apache.org/
> Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
Davanum Srinivas :: http://davanum.wordpress.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Sanjiva Weerawarana, Ph.D.
Founder & Director; Lanka Software Foundation; http://www.opensource.lk/
Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/
Director; Open Source Initiative; http://www.opensource.org/
Member; Apache Software Foundation; http://www.apache.org/
Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to