Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 13744 invoked from network); 19 Jul 2007 16:26:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Jul 2007 16:26:07 -0000 Received: (qmail 16394 invoked by uid 500); 19 Jul 2007 16:25:42 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 16309 invoked by uid 500); 19 Jul 2007 16:25:42 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 16298 invoked by uid 500); 19 Jul 2007 16:25:42 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 16295 invoked by uid 99); 19 Jul 2007 16:25:42 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Jul 2007 09:25:42 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Jul 2007 09:25:39 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 345D51A981A; Thu, 19 Jul 2007 09:25:19 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r557675 - in /webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj: SOAPConnectionImpl.java util/UnderstandAllHeadersHandler.java Date: Thu, 19 Jul 2007 16:25:19 -0000 To: axis2-cvs@ws.apache.org From: gawor@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070719162519.345D51A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gawor Date: Thu Jul 19 09:25:17 2007 New Revision: 557675 URL: http://svn.apache.org/viewvc?view=rev&rev=557675 Log: MU processing should not be done for SAAJ clients Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/util/UnderstandAllHeadersHandler.java (with props) Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java?view=diff&rev=557675&r1=557674&r2=557675 ============================================================================== --- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java (original) +++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPConnectionImpl.java Thu Jul 19 09:25:17 2007 @@ -30,8 +30,11 @@ import org.apache.axis2.client.Options; import org.apache.axis2.client.ServiceClient; import org.apache.axis2.context.MessageContext; +import org.apache.axis2.engine.AxisConfiguration; +import org.apache.axis2.engine.DispatchPhase; import org.apache.axis2.saaj.util.IDGenerator; import org.apache.axis2.saaj.util.SAAJUtil; +import org.apache.axis2.saaj.util.UnderstandAllHeadersHandler; import org.apache.axis2.wsdl.WSDLConstants; import javax.activation.DataHandler; @@ -55,6 +58,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; @@ -105,7 +109,8 @@ // initialize the Sender OperationClient opClient; try { - serviceClient = new ServiceClient(); + serviceClient = new ServiceClient(); + disableMustUnderstandProcessing(serviceClient.getAxisConfiguration()); opClient = serviceClient.createClient(ServiceClient.ANON_OUT_IN_OP); } catch (AxisFault e) { throw new SOAPException(e); @@ -121,6 +126,33 @@ } } + /* + * Installs UnderstandAllHeadersHandler that marks all headers as processed + * because MU validation should not be done for SAAJ clients. + */ + private void disableMustUnderstandProcessing(AxisConfiguration config) { + DispatchPhase phase; + phase = getDispatchPhase(serviceClient.getAxisConfiguration().getInFlowPhases()); + if (phase != null) { + phase.addHandler(new UnderstandAllHeadersHandler()); + } + phase = getDispatchPhase(serviceClient.getAxisConfiguration().getInFaultFlowPhases()); + if (phase != null) { + phase.addHandler(new UnderstandAllHeadersHandler()); + } + } + + private static DispatchPhase getDispatchPhase(List phases) { + Iterator iter = phases.iterator(); + while(iter.hasNext()) { + Object phase = iter.next(); + if (phase instanceof DispatchPhase) { + return (DispatchPhase)phase; + } + } + return null; + } + /** * Closes this SOAPConnection object. * Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/util/UnderstandAllHeadersHandler.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/util/UnderstandAllHeadersHandler.java?view=auto&rev=557675 ============================================================================== --- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/util/UnderstandAllHeadersHandler.java (added) +++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/util/UnderstandAllHeadersHandler.java Thu Jul 19 09:25:17 2007 @@ -0,0 +1,53 @@ +/* + * 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.saaj.util; + +import java.util.Iterator; + +import org.apache.axiom.soap.SOAPEnvelope; +import org.apache.axiom.soap.SOAPHeaderBlock; +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.handlers.AbstractHandler; + +/** + * Marks all SOAP headers as processed. + */ +public class UnderstandAllHeadersHandler extends AbstractHandler { + + public InvocationResponse invoke(MessageContext msgContext) throws AxisFault { + if (msgContext == null) { + return InvocationResponse.CONTINUE; + } + + SOAPEnvelope envelope = msgContext.getEnvelope(); + if (envelope.getHeader() == null) { + return InvocationResponse.CONTINUE; + } + + // Passing in null will get headers targeted for NEXT and ULTIMATE RECEIVER + Iterator headerBlocks = envelope.getHeader().getHeadersToProcess(null); + while (headerBlocks.hasNext()) { + SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) headerBlocks.next(); + headerBlock.setProcessed(); + } + return InvocationResponse.CONTINUE; + } + +} Propchange: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/util/UnderstandAllHeadersHandler.java ------------------------------------------------------------------------------ svn:eol-style = native --------------------------------------------------------------------- To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org For additional commands, e-mail: axis-cvs-help@ws.apache.org