You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Davanum Srinivas <da...@gmail.com> on 2007/06/24 13:53:00 UTC

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 <sa...@opensource.lk> 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.
>
> barrettj@apache.org 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")));
> > +    }
> > +}
> > +
> > +@WebService(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: axis-cvs-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-cvs-help@ws.apache.org
> >
> >
>
> --
> 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: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>


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

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: [axis2] header processing by !handlers

Posted by Davanum Srinivas <da...@gmail.com>.
Sounds good Jeff.

On 6/28/07, Jeff Barrett <ba...@us.ibm.com> wrote:
> Hi All,
>
> Thanks for all the feedback.  I think we need to break this up into two
> different threads of discussion:
> - What to do in 1.3 (so there are no API changes)
> - How to fix this correctly in post 1.3 for all the scenarios (which will
> include API changes for headers and roles, plugability, and such)
>
> I'll start a new thread for the post 1.3 discussion.
>
> For the 1.3 discussion, I agree with David Illsley's observation that the
> JAXWS-handler approach and marking headers as "processed" even though they
> have not been is a "hack".  But I also understand Sanjiva's concern about
> introducing an API that doesn't necessarily solve all the problems this
> close to 1.3.  So, I'm thinking through if the JAXWS handler hack will
> solve the specific issues my commit (and a few subsequent changes based on
> it) was addressing.  Assuming it will, I'll post a description of how I
> intend to refactor it to remove the API introduced on AxisOperation.  This
> refactoring will be done under
> https://issues.apache.org/jira/browse/AXIS2-2853 , but note that the 1.3
> solution will likely not be pluggable, just workable.
>
> Thanks,
> Jeff
>
> IBM Software Group - WebSphere Web Services Development
> Phone: 512-838-4587 or Tie Line 678-4587
> Internet e-mail and Sametime ID: barrettj@us.ibm.com
>
>
>
> Sanjiva Weerawarana <sa...@opensource.lk>
> 06/27/2007 07:44 PM
> Please respond to
> axis-dev@ws.apache.org
>
>
> To
> axis-dev@ws.apache.org
> cc
>
> Subject
> Re: [axis2] header processing by !handlers
>
>
>
>
>
>
> Glen Daniels wrote:
> >
> > So we're not going to support <soap:header> in 1.3 either then - or at
> > least not completely, in that if someone actually sends us one of the
> > headers they specified in the WSDL with MU switched on, we'll barf?
>
> Hmm. Yes I think this is what I'm saying. I believe that's been the case
> since Axis1 days right?
>
> > If you're vetoing a commit (which it sounds like you are?), fire away
> > with the -1s!  However... I'm not entirely sure that "adding a feature
> > without discussion" is sufficient technical justification for a -1,
> > though.  If we were doing review-then-commit, sure, but we're doing
> > commit-then-review.  What do you think?
>
> I was talking about vetoing a commit on the basis that its not the right
> solution and that a better solution needs more fundamental design. I was
> avoiding doing it and suggesting that we don't do this feature at this
> point.
>
> > Not sure exactly what the right thing here is, but I think I'd prefer to
>
> > leave it in in some form rather than having JAXWS rely on a
> > Handler-based mechanism....
>
> Problem is "some form" is not a good model because whatever we put in is
> permanent and this is a key API that'd touch a lot including codegen. If
> JAX-WS rely on a handler based mechanism for now I'd rather let get go and
>
> talk thru some of the scenarios and figure out the right solution (which
> is very likely along the path you suggested).
>
> Sanjiva.
> --
> 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: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>


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

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: [axis2] header processing by !handlers

Posted by Jeff Barrett <ba...@us.ibm.com>.
Hi All,

Thanks for all the feedback.  I think we need to break this up into two 
different threads of discussion:
- What to do in 1.3 (so there are no API changes)
- How to fix this correctly in post 1.3 for all the scenarios (which will 
include API changes for headers and roles, plugability, and such)

I'll start a new thread for the post 1.3 discussion.

For the 1.3 discussion, I agree with David Illsley's observation that the 
JAXWS-handler approach and marking headers as "processed" even though they 
have not been is a "hack".  But I also understand Sanjiva's concern about 
introducing an API that doesn't necessarily solve all the problems this 
close to 1.3.  So, I'm thinking through if the JAXWS handler hack will 
solve the specific issues my commit (and a few subsequent changes based on 
it) was addressing.  Assuming it will, I'll post a description of how I 
intend to refactor it to remove the API introduced on AxisOperation.  This 
refactoring will be done under 
https://issues.apache.org/jira/browse/AXIS2-2853 , but note that the 1.3 
solution will likely not be pluggable, just workable.

Thanks,
Jeff

IBM Software Group - WebSphere Web Services Development
Phone: 512-838-4587 or Tie Line 678-4587
Internet e-mail and Sametime ID: barrettj@us.ibm.com



Sanjiva Weerawarana <sa...@opensource.lk> 
06/27/2007 07:44 PM
Please respond to
axis-dev@ws.apache.org


To
axis-dev@ws.apache.org
cc

Subject
Re: [axis2] header processing by !handlers






Glen Daniels wrote:
> 
> So we're not going to support <soap:header> in 1.3 either then - or at 
> least not completely, in that if someone actually sends us one of the 
> headers they specified in the WSDL with MU switched on, we'll barf?

Hmm. Yes I think this is what I'm saying. I believe that's been the case 
since Axis1 days right?

> If you're vetoing a commit (which it sounds like you are?), fire away 
> with the -1s!  However... I'm not entirely sure that "adding a feature 
> without discussion" is sufficient technical justification for a -1, 
> though.  If we were doing review-then-commit, sure, but we're doing 
> commit-then-review.  What do you think?

I was talking about vetoing a commit on the basis that its not the right 
solution and that a better solution needs more fundamental design. I was 
avoiding doing it and suggesting that we don't do this feature at this 
point.

> Not sure exactly what the right thing here is, but I think I'd prefer to 

> leave it in in some form rather than having JAXWS rely on a 
> Handler-based mechanism....

Problem is "some form" is not a good model because whatever we put in is 
permanent and this is a key API that'd touch a lot including codegen. If 
JAX-WS rely on a handler based mechanism for now I'd rather let get go and 

talk thru some of the scenarios and figure out the right solution (which 
is very likely along the path you suggested).

Sanjiva.
-- 
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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: [axis2] header processing by !handlers

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
Glen Daniels wrote:
> 
> So we're not going to support <soap:header> in 1.3 either then - or at 
> least not completely, in that if someone actually sends us one of the 
> headers they specified in the WSDL with MU switched on, we'll barf?

Hmm. Yes I think this is what I'm saying. I believe that's been the case 
since Axis1 days right?

> If you're vetoing a commit (which it sounds like you are?), fire away 
> with the -1s!  However... I'm not entirely sure that "adding a feature 
> without discussion" is sufficient technical justification for a -1, 
> though.  If we were doing review-then-commit, sure, but we're doing 
> commit-then-review.  What do you think?

I was talking about vetoing a commit on the basis that its not the right 
solution and that a better solution needs more fundamental design. I was 
avoiding doing it and suggesting that we don't do this feature at this point.

> Not sure exactly what the right thing here is, but I think I'd prefer to 
> leave it in in some form rather than having JAXWS rely on a 
> Handler-based mechanism....

Problem is "some form" is not a good model because whatever we put in is 
permanent and this is a key API that'd touch a lot including codegen. If 
JAX-WS rely on a handler based mechanism for now I'd rather let get go and 
talk thru some of the scenarios and figure out the right solution (which 
is very likely along the path you suggested).

Sanjiva.
-- 
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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: [axis2] header processing by !handlers

Posted by Glen Daniels <gl...@thoughtcraft.com>.
Hi Sanjiva!

>> So I think we should carefully review, but keep the idea.
> 
> I'm not against a longer term fully general solution but I am opposed to 
> putting it into 1.3. This is a significant new feature added without 
> recent discussion and I request that it be removed at least for now. The 
> original issue can be handled with handlers as Jeff has already replied.

So we're not going to support <soap:header> in 1.3 either then - or at 
least not completely, in that if someone actually sends us one of the 
headers they specified in the WSDL with MU switched on, we'll barf?

> (Trying hard to avoid using negative numbers in emails as those appear 
> unpopular ;-).)

:)

If you're vetoing a commit (which it sounds like you are?), fire away 
with the -1s!  However... I'm not entirely sure that "adding a feature 
without discussion" is sufficient technical justification for a -1, 
though.  If we were doing review-then-commit, sure, but we're doing 
commit-then-review.  What do you think?

Not sure exactly what the right thing here is, but I think I'd prefer to 
leave it in in some form rather than having JAXWS rely on a 
Handler-based mechanism....

Thanks,
--Glen

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


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

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
Glen Daniels wrote:
> 
> Sanjiva, you know me, I'm Mr. Architectural Purity, but unfortunately 
> there are cases where Handlers aren't the best, or the most natural, way 
> to deal with headers.  If soap:header had never been added to WSDL, 
> maybe, but since it's there and the common idiom seems to be adding the 
> header as an extra parameter to the codegen'ed methods... we need to 
> allow the engine to recognize that those headers are OK to pass through. 
>  Now, we certainly could come up with a handler-based solution (gen a 
> Stub/Skel, and that autodeploys a Handler who just marks the header as 
> processed), but I think it's easier to just allow registration in a way 
> similar to what Jeff did.
> 
> So I think we should carefully review, but keep the idea.

I'm not against a longer term fully general solution but I am opposed to 
putting it into 1.3. This is a significant new feature added without 
recent discussion and I request that it be removed at least for now. The 
original issue can be handled with handlers as Jeff has already replied.

(Trying hard to avoid using negative numbers in emails as those appear 
unpopular ;-).)

Sanjiva.
-- 
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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


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

Posted by Glen Daniels <gl...@thoughtcraft.com>.
A few comments:

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

I don't think we should go too far in a "pluggable MU handling" 
direction.  I do think we need a single API for allowing external 
components (i.e. Stubs/Skels) to register that they process/understand 
particular handlers.

> On 6/24/07, Sanjiva Weerawarana <sa...@opensource.lk> 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, you know me, I'm Mr. Architectural Purity, but unfortunately 
there are cases where Handlers aren't the best, or the most natural, way 
to deal with headers.  If soap:header had never been added to WSDL, 
maybe, but since it's there and the common idiom seems to be adding the 
header as an extra parameter to the codegen'ed methods... we need to 
allow the engine to recognize that those headers are OK to pass through. 
  Now, we certainly could come up with a handler-based solution (gen a 
Stub/Skel, and that autodeploys a Handler who just marks the header as 
processed), but I think it's easier to just allow registration in a way 
similar to what Jeff did.

So I think we should carefully review, but keep the idea.

--Glen

>> barrettj@apache.org 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")));
>> > +    }
>> > +}
>> > +
>> > +@WebService(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: axis-cvs-unsubscribe@ws.apache.org
>> > For additional commands, e-mail: axis-cvs-help@ws.apache.org
>> >
>> >
>>
>> -- 
>> 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: axis-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-dev-help@ws.apache.org
>>
>>
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


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

Posted by David Illsley <da...@gmail.com>.
Sure,
The RM one is that, because the envelope is serialised/deserialised
mid flow, the isProcessed values are lost, so I believe the
work-around used by Sandesha is just to mark all the headers processed
on deserialisation. (Can anyone confirm/deny this is how this still
works?)

The ESB on (the name is a poor one) was simply where you want to use
Axis2 as part of a larger soap processing node, which has it's own
handlers/mediations/whetever which might deal with headers outside of
the Axis2 flows. In that case you have to let the mU checking happen
elsewhere.
David

On 25/06/07, Sanjiva Weerawarana <sa...@opensource.lk> wrote:
> 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 <ba...@us.ibm.com> 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: barrettj@us.ibm.com
> >>
> >>
> >>
> >> "Davanum Srinivas" <da...@gmail.com>
> >> 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 <sa...@opensource.lk> 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.
> >> >
> >> > barrettj@apache.org 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")));
> >> > > +    }
> >> > > +}
> >> > > +
> >> > > +@WebService(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: axis-cvs-unsubscribe@ws.apache.org
> >> > > For additional commands, e-mail: axis-cvs-help@ws.apache.org
> >> > >
> >> > >
> >> >
> >> > --
> >> > 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: axis-dev-unsubscribe@ws.apache.org
> >> > For additional commands, e-mail: axis-dev-help@ws.apache.org
> >> >
> >> >
> >>
> >>
> >> --
> >> Davanum Srinivas :: http://davanum.wordpress.com
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-dev-help@ws.apache.org
> >>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-dev-help@ws.apache.org
> >>
> >>
> >
> >
>
> --
> 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: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>


-- 
David Illsley - IBM Web Services Development

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


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

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
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 <ba...@us.ibm.com> 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: barrettj@us.ibm.com
>>
>>
>>
>> "Davanum Srinivas" <da...@gmail.com>
>> 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 <sa...@opensource.lk> 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.
>> >
>> > barrettj@apache.org 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")));
>> > > +    }
>> > > +}
>> > > +
>> > > +@WebService(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: axis-cvs-unsubscribe@ws.apache.org
>> > > For additional commands, e-mail: axis-cvs-help@ws.apache.org
>> > >
>> > >
>> >
>> > --
>> > 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: axis-dev-unsubscribe@ws.apache.org
>> > For additional commands, e-mail: axis-dev-help@ws.apache.org
>> >
>> >
>>
>>
>> -- 
>> Davanum Srinivas :: http://davanum.wordpress.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-dev-help@ws.apache.org
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-dev-help@ws.apache.org
>>
>>
> 
> 

-- 
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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: [axis2] header processing by !handlers

Posted by Glen Daniels <gl...@thoughtcraft.com>.
David Illsley wrote:
> 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.

Hi David:

I'd really rather not look at it this way.  I want the MU handling in 
the Engine to be *flexible*, not *omittable*.  A mechanism which lets 
external components register QNames they are taking responsibility for 
is fine (and I don't think of that as really "hacking around" the MU 
code, just extending it).  An easy mechanism to completely switch off 
the MU checking is, IMHO, fraught with peril. :)  Yes, you can screw up 
either way, but I think putting in pluggability at the level you suggest 
  would make it easier.

Thanks,
--Glen

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


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

Posted by David Illsley <da...@gmail.com>.
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 <ba...@us.ibm.com> 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: barrettj@us.ibm.com
>
>
>
> "Davanum Srinivas" <da...@gmail.com>
> 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 <sa...@opensource.lk> 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.
> >
> > barrettj@apache.org 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")));
> > > +    }
> > > +}
> > > +
> > > +@WebService(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: axis-cvs-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: axis-cvs-help@ws.apache.org
> > >
> > >
> >
> > --
> > 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: axis-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-dev-help@ws.apache.org
> >
> >
>
>
> --
> Davanum Srinivas :: http://davanum.wordpress.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>


-- 
David Illsley - IBM Web Services Development

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


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

Posted by Glen Daniels <gl...@thoughtcraft.com>.
Hi guys:

Comments inline.

Jeff Barrett wrote:
> 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?

That is certainly one way of doing it, and not even necessarily a bad 
one.  But keep in mind that there are two parts to this design - 1) the 
Handler itself, and 2) the APIs and data structures that are used to get 
the header information to the Handler (i.e. particular context 
properties, etc).  The second part is going to be needed anyway, and we 
should design that appropriately - I think the technique of registering 
QNames with the AxisOperation (or AxisService even) seems fine.  That 
seems like the big API issue to me, and once that's done it doesn't so 
much matter whether there is a particular Handler to do the job or 
whether the AxisEngine itself does it... and I think I prefer the 
latter.  We're going to need the exact same functionality to get 
soap:header working right with ADB, so I'd rather leave it core.

> 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.

Right - this functionality has been built into Axiom since March, I 
believe.  The missing part is for Axis2 to have some configuration to 
indicate in which roles a given service/operation plays.  Then that 
feeds into the call at AxisEngine.java:69.

> 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 

Correct.  In particular, it very carefully says that it must *act as if* 
no processing had occurred.  In other words, as long as there are no 
post-processing side effects that affect the state of the system in a 
significant way, you can do whatever you want.

> 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.

Again, nailed it.  In Axis1 (and 2) we decided that the best way to deal 
with this is a "do and rollback" approach as opposed to a "pre-flight 
check".  This is why it's so critical to get flowComplete() to be able 
to understand if it's being called as a result of a fault or a normal 
completion.... (and frankly why I'd prefer a separate revoke() method!)

> 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).

+1, but can we discuss these on the list before making too many further 
changes?

--Glen

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


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

Posted by Jeff Barrett <ba...@us.ibm.com>.
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: barrettj@us.ibm.com



"Davanum Srinivas" <da...@gmail.com> 
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 <sa...@opensource.lk> 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.
>
> barrettj@apache.org 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")));
> > +    }
> > +}
> > +
> > +@WebService(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: axis-cvs-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-cvs-help@ws.apache.org
> >
> >
>
> --
> 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: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
>
>


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

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org