axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hemap...@apache.org
Subject svn commit: r164019 - in /webservices/axis/trunk/java/modules: core/src/org/apache/axis/engine/ core/src/org/apache/axis/handlers/addressing/ core/test/org/apache/axis/handlers/addressing/ samples/test/org/apache/axis/engine/ xml/src/org/apache/axis/om/ xml/src/org/apache/axis/om/impl/llom/
Date Thu, 21 Apr 2005 09:47:29 GMT
Author: hemapani
Date: Thu Apr 21 02:47:27 2005
New Revision: 164019

URL: http://svn.apache.org/viewcvs?rev=164019&view=rev
Log:
add the addressing, fix test cases only the Echo test left to done 

Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisEngine.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/MessageSender.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingInHandler.java
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingOutHandler.java
    webservices/axis/trunk/java/modules/core/test/org/apache/axis/handlers/addressing/AddressingInHandlerTest.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/HandlerFailureTest.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/SOAPHeader.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/SOAPHeaderImpl.java

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisEngine.java?rev=164019&r1=164018&r2=164019&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisEngine.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/AxisEngine.java Thu
Apr 21 02:47:27 2005
@@ -19,6 +19,8 @@
 import org.apache.axis.context.MessageContext;
 import org.apache.axis.context.ServiceContext;
 import org.apache.axis.description.AxisTransportIn;
+import org.apache.axis.handlers.addressing.AddressingInHandler;
+import org.apache.axis.handlers.addressing.AddressingOutHandler;
 import org.apache.axis.om.OMFactory;
 import org.apache.axis.om.SOAPBody;
 import org.apache.axis.om.SOAPEnvelope;
@@ -61,18 +63,19 @@
         try {
             ExecutionChain chain = context.getExecutionChain();
             ServiceContext serviceContext = context.getServiceContext();
-            
+
             /*
              * There is a two cases, at the server side(response) / client side
              * but in the server side there must be a Service object object set, as before
the 
              * out flow is started the user knows the services that will be invoked. 
              */
-            
+
             if (serviceContext != null) {
 
                 // what are we suppose to do in the client side
                 // how the client side handlers are deployed ??? this is a hack and no client
side handlers
-                chain.addPhases(serviceContext.getPhases(EngineConfiguration.OUTFLOW));
+                chain.addPhases(
+                    serviceContext.getPhases(EngineConfiguration.OUTFLOW));
             } else {
                 if (context.isServerSide() && !context.isProcessingFault()) {
                     throw new AxisFault("At the Send there must be a Service Object set at
the Server Side");
@@ -80,7 +83,12 @@
             }
 
             // Add the phases that are are at Global scope
-            chain.addPhases(context.getEngineContext().getPhases(EngineConfiguration.OUTFLOW));
+            chain.addPhases(
+                context.getEngineContext().getPhases(
+                    EngineConfiguration.OUTFLOW));
+            Phase addressingPhase = new SimplePhase("addressing");
+            addressingPhase.addHandler(new AddressingOutHandler());
+            chain.addPhase(addressingPhase);
 
             // Receiving is always a matter of running the transport handlers first
             AxisTransportIn transport = context.getTransportIn();
@@ -125,9 +133,13 @@
             AxisTransportIn transport = context.getTransportIn();
             if (transport != null) {
                 log.info("Using the transport" + transport.getName());
-                chain.addPhases(transport.getPhases(EngineConfiguration.INFLOW));
+                chain.addPhases(
+                    transport.getPhases(EngineConfiguration.INFLOW));
             }
-
+            
+            Phase addressingPhase = new SimplePhase("addressing");
+            addressingPhase.addHandler(new AddressingInHandler());
+            chain.addPhase(addressingPhase);
             //add the Global flow
             chain.addPhases(engContext.getPhases(EngineConfiguration.INFLOW));
 
@@ -140,13 +152,15 @@
             if (context.isServerSide()) {
                 //This chain is the default Service diaptacher, the users may opt to overide
this by 
                 //adding an Handlers to the DispatchPhase. 
-                AddressingBasedDispatcher dispatcher = new AddressingBasedDispatcher();
+                AddressingBasedDispatcher dispatcher =
+                    new AddressingBasedDispatcher();
                 dispatchPhase.addHandler(dispatcher);
 
             }
 
             //Service handlers are added to ExecutionChain by this Handler
-            ServiceHandlersChainBuilder handlerChainBuilder = new ServiceHandlersChainBuilder();
+            ServiceHandlersChainBuilder handlerChainBuilder =
+                new ServiceHandlersChainBuilder();
             dispatchPhase.addHandler(handlerChainBuilder);
             chain.addPhase(dispatchPhase);
 
@@ -156,9 +170,12 @@
             if (context.isServerSide()) {
                 // add invoke Phase
                 MessageReceiver reciver =
-                    context.getServiceContext().getServiceConfig().getMessageReceiver();
+                    context
+                        .getServiceContext()
+                        .getServiceConfig()
+                        .getMessageReceiver();
                 reciver.recieve(context);
-             }
+            }
 
             log.info("ending the out flow");
         } catch (Throwable e) {
@@ -175,7 +192,8 @@
      * @param e
      * @throws AxisFault
      */
-    public void handleFault(MessageContext context, Throwable e) throws AxisFault {
+    public void handleFault(MessageContext context, Throwable e)
+        throws AxisFault {
         boolean serverSide = context.isServerSide();
         log.error("Error Ocurred", e);
         if (serverSide && !context.isProcessingFault()) {
@@ -191,20 +209,23 @@
                     context.getTransportOut());
             faultContext.setProcessingFault(true);
             faultContext.setServerSide(true);
-            SOAPEnvelope envelope = OMFactory.newInstance().getDefaultEnvelope();
+            SOAPEnvelope envelope =
+                OMFactory.newInstance().getDefaultEnvelope();
 
             // TODO do we need to set old Headers back?
             SOAPBody body = envelope.getBody();
             body.addFault(new AxisFault(e.getMessage(), e));
             faultContext.setEnvelope(envelope);
-   
+
             ExecutionChain chain = faultContext.getExecutionChain();
-            
+
             ServiceContext serviceContext = context.getServiceContext();
-            if(serviceContext != null){
-                chain.addPhases(serviceContext.getPhases(EngineConfiguration.FAULT_IN_FLOW));
+            if (serviceContext != null) {
+                chain.addPhases(
+                    serviceContext.getPhases(
+                        EngineConfiguration.FAULT_IN_FLOW));
             }
-            
+
             chain.invoke(faultContext);
             // send the error
             TransportSender sender = context.getTransportOut().getSender();
@@ -228,7 +249,7 @@
      * @param obj the object to be stored
      * @return the storage key
      */
-    public Object store(EngineContext context,Object obj){
+    public Object store(EngineContext context, Object obj) {
         return context.getStorage().put(obj);
     }
 
@@ -239,7 +260,7 @@
      * @param key
      * @return
      */
-    public Object retrieve(EngineContext context,Object key){
+    public Object retrieve(EngineContext context, Object key) {
         return context.getStorage().get(key);
     }
 
@@ -249,7 +270,7 @@
      * @param key
      * @return  the object removed
      */
-    public Object remove(EngineContext context,Object key){
+    public Object remove(EngineContext context, Object key) {
         return context.getStorage().remove(key);
     }
 
@@ -258,7 +279,7 @@
      * @param context
      * @return
      */
-    public boolean clearStorage(EngineContext context){
+    public boolean clearStorage(EngineContext context) {
         return context.getStorage().clean();
     }
 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/MessageSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/MessageSender.java?rev=164019&r1=164018&r2=164019&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/MessageSender.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/MessageSender.java
Thu Apr 21 02:47:27 2005
@@ -20,6 +20,7 @@
 
 import org.apache.axis.addressing.om.MessageInformationHeadersCollection;
 import org.apache.axis.context.EngineContext;
+import org.apache.axis.context.MEPContext;
 import org.apache.axis.context.MessageContext;
 
 /**
@@ -28,12 +29,12 @@
 public class MessageSender {
     private EngineContext engineContext;
     private MessageInformationHeadersCollection messageInfoHeaders;
-    
+    private MEPContext mepContext;
     
     
     public MessageSender(EngineContext engineContext){
         this.engineContext = engineContext;
-    }
+    }              
     
     public MessageSender(InputStream in){
         //TODO create the Engine Context

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingInHandler.java?rev=164019&r1=164018&r2=164019&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingInHandler.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingInHandler.java
Thu Apr 21 02:47:27 2005
@@ -1,5 +1,6 @@
 package org.apache.axis.handlers.addressing;
 
+import java.util.ArrayList;
 import java.util.Iterator;
 
 import javax.xml.namespace.QName;
@@ -13,7 +14,6 @@
 import org.apache.axis.handlers.AbstractHandler;
 import org.apache.axis.om.OMAttribute;
 import org.apache.axis.om.OMElement;
-import org.apache.axis.om.OMNamespace;
 import org.apache.axis.om.SOAPHeader;
 import org.apache.axis.om.SOAPHeaderBlock;
 import org.apache.commons.logging.Log;
@@ -45,44 +45,48 @@
     public void invoke(MessageContext msgContext) throws AxisFault {
         logger.debug("Starting Addressing IN Handler .........");
         SOAPHeader header = msgContext.getEnvelope().getHeader();
-        OMNamespace addressingNamespace = header.findInScopeNamespace(AddressingConstants.WSA_NAMESPACE,
"");
-        if (addressingNamespace != null) {
-            extractAddressingInformationFromHeaders(header, msgContext.getMessageInformationHeaders());
+        ArrayList addressingHeaders = header.getHeaderBolcksWithNSURI(AddressingConstants.WSA_NAMESPACE);
+        if (addressingHeaders != null) {
+            extractAddressingInformationFromHeaders(header, msgContext.getMessageInformationHeaders(),addressingHeaders);
         } else {
             // no addressing headers present
             logger.debug("No Addressing Headers present in the IN message. Addressing In
Handler does nothing.");
         }
     }
 
-    protected MessageInformationHeadersCollection extractAddressingInformationFromHeaders(SOAPHeader
header, MessageInformationHeadersCollection messageInformationHeadersCollection) {
+    protected MessageInformationHeadersCollection extractAddressingInformationFromHeaders(SOAPHeader
header, MessageInformationHeadersCollection messageInformationHeadersCollection,ArrayList
addressingHeaders) {
         if(messageInformationHeadersCollection == null){
              messageInformationHeadersCollection = new MessageInformationHeadersCollection();
         }
 
-        Iterator addressingHeaders = header.getChildrenWithName(new QName(AddressingConstants.WSA_NAMESPACE,
""));
-        while (addressingHeaders.hasNext()) {
-            SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) addressingHeaders.next();
+        Iterator addressingHeadersIt = addressingHeaders.iterator();
+        while (addressingHeadersIt.hasNext()) {
+            SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) addressingHeadersIt.next();
             EndpointReference epr = null;
             if (AddressingConstants.WSA_TO.equals(soapHeaderBlock.getLocalName())) {
-                if(messageInformationHeadersCollection.getTo() == null){
+                epr = messageInformationHeadersCollection.getTo();
+                if(epr == null){
                     epr = new EndpointReference(AddressingConstants.WSA_TO, "");
                     messageInformationHeadersCollection.setTo(epr);
                 }
                 extractEPRInformation(soapHeaderBlock, epr);
             } else if (AddressingConstants.WSA_FROM.equals(soapHeaderBlock.getLocalName()))
{
-                if(messageInformationHeadersCollection.getFrom() == null){
+                epr = messageInformationHeadersCollection.getFrom();
+                if(epr == null){
                     epr = new EndpointReference(AddressingConstants.WSA_FROM, "");
                     messageInformationHeadersCollection.setFrom(epr);
                 }
                 extractEPRInformation(soapHeaderBlock, epr);
             } else if (AddressingConstants.WSA_REPLY_TO.equals(soapHeaderBlock.getLocalName()))
{
-                if(messageInformationHeadersCollection.getReplyTo() == null){
+                epr = messageInformationHeadersCollection.getReplyTo();
+                if( epr == null){
                     epr = new EndpointReference(AddressingConstants.WSA_REPLY_TO, "");
                     messageInformationHeadersCollection.setReplyTo(epr);
                 }
                 extractEPRInformation(soapHeaderBlock, epr);
             } else if (AddressingConstants.WSA_FAULT_TO.equals(soapHeaderBlock.getLocalName()))
{
-                if(messageInformationHeadersCollection.getFaultTo() == null){
+                epr = messageInformationHeadersCollection.getFaultTo();
+                if( epr == null){
                     epr = new EndpointReference(AddressingConstants.WSA_FAULT_TO, "");
                     messageInformationHeadersCollection.setTo(epr);
                 }

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingOutHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingOutHandler.java?rev=164019&r1=164018&r2=164019&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingOutHandler.java
(original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/handlers/addressing/AddressingOutHandler.java
Thu Apr 21 02:47:27 2005
@@ -35,72 +35,122 @@
  * the License.
  * <p/>
  */
-public class AddressingOutHandler extends AbstractHandler implements AddressingConstants{
+public class AddressingOutHandler
+    extends AbstractHandler
+    implements AddressingConstants {
     /**
      * Eran Chinthaka (chinthaka@apache.org)
      */
-    OMNamespace addressingNamespace = OMFactory.newInstance().createOMNamespace(WSA_NAMESPACE,
"wsa");
+    OMNamespace addressingNamespace =
+        OMFactory.newInstance().createOMNamespace(WSA_NAMESPACE, "wsa");
     public void invoke(MessageContext msgContext) throws AxisFault {
-        MessageInformationHeadersCollection messageInformationHeaders = msgContext.getMessageInformationHeaders();
+        MessageInformationHeadersCollection messageInformationHeaders =
+            msgContext.getMessageInformationHeaders();
         SOAPHeader soapHeader = msgContext.getEnvelope().getHeader();
 
         EndpointReference epr = messageInformationHeaders.getTo();
-        addToSOAPHeader(epr, AddressingConstants.WSA_TO, soapHeader);
+        if (epr != null) {
+            addToSOAPHeader(epr, AddressingConstants.WSA_TO, soapHeader);
+        }
+
+        String action = messageInformationHeaders.getAction();
+        if (action != null) {
+            processStringInfo(action, WSA_ACTION, soapHeader);
+        }
+
         epr = messageInformationHeaders.getReplyTo();
-        addToSOAPHeader(epr, AddressingConstants.WSA_REPLY_TO, soapHeader);
+        if (epr != null) {//optional
+            addToSOAPHeader(epr, AddressingConstants.WSA_REPLY_TO, soapHeader);
+        }
         epr = messageInformationHeaders.getFrom();
-        addToSOAPHeader(epr, AddressingConstants.WSA_FROM, soapHeader);
+        if (epr != null) {//optional
+            addToSOAPHeader(epr, AddressingConstants.WSA_FROM, soapHeader);
+        }
         epr = messageInformationHeaders.getFaultTo();
-        addToSOAPHeader(epr, AddressingConstants.WSA_FAULT_TO, soapHeader);
+        if (epr != null) {//optional
+            addToSOAPHeader(epr, AddressingConstants.WSA_FAULT_TO, soapHeader);
+        }
 
         String messageID = messageInformationHeaders.getMessageId();
-        processStringInfo(messageID, WSA_MESSAGE_ID, soapHeader);
-
-        String action = messageInformationHeaders.getAction();
-        processStringInfo(action, WSA_ACTION, soapHeader);
+        if (messageID != null) {//optional
+            processStringInfo(messageID, WSA_MESSAGE_ID, soapHeader);
+        }
 
         RelatesTo relatesTo = messageInformationHeaders.getRelatesTo();
-        OMElement relatesToHeader = processStringInfo(relatesTo.getAddress(), WSA_RELATES_TO,
soapHeader);
-        if(relatesToHeader != null && !"".equals(relatesTo.getRelationshipType())){
-            relatesToHeader.insertAttribute(WSA_RELATES_TO_RELATIONSHIP_TYPE, relatesTo.getRelationshipType(),
addressingNamespace);
+        if (relatesTo != null) { //optional
+            OMElement relatesToHeader =
+                processStringInfo(
+                    relatesTo.getAddress(),
+                    WSA_RELATES_TO,
+                    soapHeader);
+            if (relatesToHeader != null
+                && !"".equals(relatesTo.getRelationshipType())) {
+                relatesToHeader.insertAttribute(
+                    WSA_RELATES_TO_RELATIONSHIP_TYPE,
+                    relatesTo.getRelationshipType(),
+                    addressingNamespace);
+            }
+            soapHeader.addChild(relatesToHeader);
         }
-        soapHeader.addChild(relatesToHeader);
-
     }
 
-    private OMElement processStringInfo(String value, String type, SOAPHeader soapHeader)
{
-        if(!"".equals(value) && value != null){
-            SOAPHeaderBlock soapHeaderBlock = soapHeader.addHeaderBlock(type, addressingNamespace);
+    private OMElement processStringInfo(
+        String value,
+        String type,
+        SOAPHeader soapHeader) {
+        if (!"".equals(value) && value != null) {
+            SOAPHeaderBlock soapHeaderBlock =
+                soapHeader.addHeaderBlock(type, addressingNamespace);
             soapHeaderBlock.addChild(OMFactory.newInstance().createText(value));
             return soapHeaderBlock;
         }
         return null;
     }
 
-    protected void addToSOAPHeader(EndpointReference epr, String type, SOAPHeader soapHeader)
{
-        if(epr == null){
+    protected void addToSOAPHeader(
+        EndpointReference epr,
+        String type,
+        SOAPHeader soapHeader) {
+        if (epr == null) {
             return;
         }
         String address = epr.getAddress();
-        if(!"".equals(address) && address != null){
-            SOAPHeaderBlock soapHeaderBlock = soapHeader.addHeaderBlock(type, addressingNamespace);
-            OMElement addressElement = OMFactory.newInstance().createOMElement(EPR_ADDRESS,
addressingNamespace);
+        if (!"".equals(address) && address != null) {
+            SOAPHeaderBlock soapHeaderBlock =
+                soapHeader.addHeaderBlock(type, addressingNamespace);
+            OMElement addressElement =
+                OMFactory.newInstance().createOMElement(
+                    EPR_ADDRESS,
+                    addressingNamespace);
             soapHeaderBlock.addChild(addressElement);
             addressElement.setValue(address);
 
         }
 
         QName portType = epr.getPortType();
-        if(portType != null){
-            SOAPHeaderBlock soapHeaderBlock = soapHeader.addHeaderBlock(EPR_PORT_TYPE, addressingNamespace);
-            soapHeaderBlock.addChild(OMFactory.newInstance().createText(portType.getPrefix()
+ ":" + portType.getLocalPart()));
+        if (portType != null) {
+            SOAPHeaderBlock soapHeaderBlock =
+                soapHeader.addHeaderBlock(EPR_PORT_TYPE, addressingNamespace);
+            soapHeaderBlock.addChild(
+                OMFactory.newInstance().createText(
+                    portType.getPrefix() + ":" + portType.getLocalPart()));
         }
 
         ServiceName serviceName = epr.getServiceName();
-        if(serviceName != null){
-           SOAPHeaderBlock soapHeaderBlock = soapHeader.addHeaderBlock(EPR_SERVICE_NAME,
addressingNamespace);
-            soapHeaderBlock.insertAttribute(EPR_SERVICE_NAME_PORT_NAME, serviceName.getPortName(),
addressingNamespace);
-            soapHeaderBlock.addChild(OMFactory.newInstance().createText(serviceName.getName().getPrefix()
+ ":" + serviceName.getName().getLocalPart()));
+        if (serviceName != null) {
+            SOAPHeaderBlock soapHeaderBlock =
+                soapHeader.addHeaderBlock(
+                    EPR_SERVICE_NAME,
+                    addressingNamespace);
+            soapHeaderBlock.insertAttribute(
+                EPR_SERVICE_NAME_PORT_NAME,
+                serviceName.getPortName(),
+                addressingNamespace);
+            soapHeaderBlock.addChild(
+                OMFactory.newInstance().createText(
+                    serviceName.getName().getPrefix()
+                        + ":"
+                        + serviceName.getName().getLocalPart()));
         }
 
         AnyContentType referenceParameters = epr.getReferenceParameters();
@@ -111,13 +161,16 @@
 
     }
 
-    private void processAnyContentType(AnyContentType referenceParameters, SOAPHeader soapHeader)
{
-        if(referenceParameters != null ){
+    private void processAnyContentType(
+        AnyContentType referenceParameters,
+        SOAPHeader soapHeader) {
+        if (referenceParameters != null) {
             Iterator iterator = referenceParameters.getKeys();
             while (iterator.hasNext()) {
                 QName key = (QName) iterator.next();
                 String value = referenceParameters.getReferenceValue(key);
-                OMElement omElement = OMFactory.newInstance().createOMElement(key, soapHeader);
+                OMElement omElement =
+                    OMFactory.newInstance().createOMElement(key, soapHeader);
                 soapHeader.addChild(omElement);
                 omElement.addChild(OMFactory.newInstance().createText(value));
             }

Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis/handlers/addressing/AddressingInHandlerTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/handlers/addressing/AddressingInHandlerTest.java?rev=164019&r1=164018&r2=164019&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/handlers/addressing/AddressingInHandlerTest.java
(original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/handlers/addressing/AddressingInHandlerTest.java
Thu Apr 21 02:47:27 2005
@@ -2,9 +2,11 @@
 
 import org.apache.axis.AbstractTestCase;
 import org.apache.axis.addressing.om.MessageInformationHeadersCollection;
+import org.apache.axis.addressing.AddressingConstants;
 import org.apache.axis.addressing.EndpointReference;
 import org.apache.axis.handlers.util.TestUtil;
 import org.apache.axis.om.SOAPEnvelope;
+import org.apache.axis.om.SOAPHeader;
 import org.apache.axis.om.impl.llom.builder.StAXSOAPModelBuilder;
 
 /**
@@ -52,8 +54,10 @@
     public void testExtractAddressingInformationFromHeaders() {
         try {
             StAXSOAPModelBuilder omBuilder = testUtil.getOMBuilder(testFileName);
+            
+            SOAPHeader header = ((SOAPEnvelope) omBuilder.getDocumentElement()).getHeader();
             MessageInformationHeadersCollection messageInformationHeadersCollection =
-                    inHandler.extractAddressingInformationFromHeaders(((SOAPEnvelope) omBuilder.getDocumentElement()).getHeader(),
null);
+                    inHandler.extractAddressingInformationFromHeaders(header, null,header.getHeaderBolcksWithNSURI(AddressingConstants.WSA_NAMESPACE));
 
             if(messageInformationHeadersCollection == null){
                 fail("Addressing Information Headers have not been retrieved properly");

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java?rev=164019&r1=164018&r2=164019&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java
(original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/EchoRawXMLTest.java
Thu Apr 21 02:47:27 2005
@@ -44,9 +44,10 @@
 import org.apache.commons.logging.LogFactory;
 
 public class EchoRawXMLTest extends TestCase {
+    private EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO,
"http://127.0.0.1:" + UtilServer.TESTING_PORT + "/axis/services/EchoXMLService");
     private Log log = LogFactory.getLog(getClass());
-    private QName serviceName = new QName("", "EchoXMLService");
-    private QName operationName = new QName("http://localhost/my", "echoOMElement");
+    private QName serviceName = new QName("", targetEPR.getAddress());
+    private QName operationName = new QName("echoOMElement");
     private QName transportName = new QName("http://localhost/my", "NullTransport");
 
     private EngineConfiguration engineRegistry;
@@ -91,9 +92,10 @@
         reqEnv.getBody().addChild(method);
 
         org.apache.axis.clientapi.Call call = new org.apache.axis.clientapi.Call();
-        EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO, "http://127.0.0.1:"
+ UtilServer.TESTING_PORT + "/axis/services/EchoXMLService");
+        
         call.setTransport(Constants.TRANSPORT_HTTP);
         call.setTo(targetEPR);
+        call.setAction(operationName.getLocalPart());
         SOAPEnvelope resEnv = call.sendReceiveSync(reqEnv);
 
         resEnv.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out),
true);
@@ -113,7 +115,7 @@
         reqEnv.getBody().addChild(method);
 
         org.apache.axis.clientapi.Call call = new org.apache.axis.clientapi.Call();
-        EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO, "http://127.0.0.1:"
+ UtilServer.TESTING_PORT + "/axis/services/EchoXMLService");
+
         call.setTo(targetEPR);
         call.setListenerTransport("http", false);
 

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/HandlerFailureTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/HandlerFailureTest.java?rev=164019&r1=164018&r2=164019&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/HandlerFailureTest.java
(original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/HandlerFailureTest.java
Thu Apr 21 02:47:27 2005
@@ -45,8 +45,8 @@
 
 public class HandlerFailureTest extends TestCase {
     private Log log = LogFactory.getLog(getClass());
-    private QName serviceName = new QName("", "EchoXMLService");
-    private QName operationName = new QName("http://localhost/my", "echoOMElement");
+    private QName serviceName = new QName("", "http://127.0.0.1:5556/axis/services/EchoXMLService");
+    private QName operationName = new QName("echoOMElement");
 
 
     private MessageContext mc;
@@ -147,6 +147,7 @@
             EndpointReference targetEPR = new EndpointReference(AddressingConstants.WSA_TO,
"http://127.0.0.1:" + (UtilServer.TESTING_PORT) + "/axis/services/EchoXMLService");
             call.setTransport(Constants.TRANSPORT_HTTP);
             call.setTo(targetEPR);
+            call.setAction(operationName.getLocalPart());
             SOAPEnvelope resEnv = call.sendReceiveSync(reqEnv);
 
 

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/SOAPHeader.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/SOAPHeader.java?rev=164019&r1=164018&r2=164019&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/SOAPHeader.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/SOAPHeader.java Thu Apr
21 02:47:27 2005
@@ -15,6 +15,7 @@
  */
 package org.apache.axis.om;
 
+import java.util.ArrayList;
 import java.util.Iterator;
 
 /**
@@ -110,4 +111,11 @@
      *         <code>SOAPHeader</code>
      */
     public abstract Iterator extractAllHeaderBlocks();
+    
+    /**
+     * Return all the Headers that has the Namespace URI to given NS URI 
+     * @param nsURI
+     * @return
+     */
+    public ArrayList getHeaderBolcksWithNSURI(String nsURI);
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/SOAPHeaderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/SOAPHeaderImpl.java?rev=164019&r1=164018&r2=164019&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/SOAPHeaderImpl.java
(original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/SOAPHeaderImpl.java
Thu Apr 21 02:47:27 2005
@@ -15,18 +15,20 @@
  */
 package org.apache.axis.om.impl.llom;
 
-import org.apache.axis.om.OMConstants;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis.om.OMElement;
 import org.apache.axis.om.OMException;
 import org.apache.axis.om.OMNamespace;
 import org.apache.axis.om.OMXMLParserWrapper;
 import org.apache.axis.om.SOAPEnvelope;
 import org.apache.axis.om.SOAPHeader;
 import org.apache.axis.om.SOAPHeaderBlock;
-import org.apache.axis.om.impl.llom.traverse.OMChildrenWithSpecificAttributeIterator;
 import org.apache.axis.om.impl.llom.soap11.SOAP11Constants;
-
-import javax.xml.namespace.QName;
-import java.util.Iterator;
+import org.apache.axis.om.impl.llom.traverse.OMChildrenWithSpecificAttributeIterator;
 
 /**
  * Class SOAPHeaderImpl
@@ -50,10 +52,11 @@
      * @param builder
      */
     public SOAPHeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder) {
-        super(SOAPConstants.HEADER_LOCAL_NAME, (envelope == null)
-                        ? null
-                        : envelope.getNamespace(), envelope,
-                builder);
+        super(
+            SOAPConstants.HEADER_LOCAL_NAME,
+            (envelope == null) ? null : envelope.getNamespace(),
+            envelope,
+            builder);
     }
 
     /**
@@ -70,9 +73,9 @@
      * @throws OMException
      */
     public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns)
-            throws OMException {
-        SOAPHeaderBlock soapHeaderBlock = new SOAPHeaderBlockImpl(localName,
-                ns);
+        throws OMException {
+        SOAPHeaderBlock soapHeaderBlock =
+            new SOAPHeaderBlockImpl(localName, ns);
         this.addChild(soapHeaderBlock);
         soapHeaderBlock.setComplete(true);
         return soapHeaderBlock;
@@ -131,10 +134,12 @@
      */
     public Iterator extractHeaderBlocks(String actor) {
         return new OMChildrenWithSpecificAttributeIterator(
-                getFirstChild(),
-                new QName(
-                        SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAPConstants.ATTR_ACTOR),
-                actor, true);
+            getFirstChild(),
+            new QName(
+                SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+                SOAPConstants.ATTR_ACTOR),
+            actor,
+            true);
     }
 
     /**
@@ -151,10 +156,12 @@
      */
     public Iterator examineMustUnderstandHeaderBlocks(String actor) {
         return new OMChildrenWithSpecificAttributeIterator(
-                getFirstChild(),
-                new QName(
-                        SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAPConstants.ATTR_ACTOR),
-                actor, false);
+            getFirstChild(),
+            new QName(
+                SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+                SOAPConstants.ATTR_ACTOR),
+            actor,
+            false);
     }
 
     /**
@@ -181,6 +188,24 @@
      *         <code>SOAPHeader</code>
      */
     public Iterator extractAllHeaderBlocks() {
-        throw new UnsupportedOperationException();    // TODO implement this
+        throw new UnsupportedOperationException(); // TODO implement this
     }
+
+    public ArrayList getHeaderBolcksWithNSURI(String nsURI) {
+        ArrayList headers = null;
+        OMElement header = this.getFirstElement();
+        if (header != null) {
+            headers = new ArrayList();
+        }
+        while (header != null) {
+            if (nsURI.equals(header.getNamespaceName())) {
+                headers.add(header);
+            }
+            header = header.getNextSiblingElement();
+
+        }
+        return headers;
+
+    }
+
 }



Mime
View raw message