ws-wsrf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject svn commit: r233050 - in /webservices/wsrf/trunk: ./ src/java/org/apache/ws/addressing/ src/java/org/apache/ws/addressing/v2003_03/ src/java/org/apache/ws/addressing/v2004_03/ src/java/org/apache/ws/addressing/v2004_08/ src/java/org/apache/ws/addressin...
Date Tue, 16 Aug 2005 20:32:50 GMT
Author: ips
Date: Tue Aug 16 13:32:40 2005
New Revision: 233050

URL: http://svn.apache.org/viewcvs?rev=233050&view=rev
Log:
removed dep on Apache Addressing; began removing remnant Axis deps

Added:
    webservices/wsrf/trunk/src/java/org/apache/ws/addressing/AddressingUtils.java
    webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_03/
    webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_03/AddressingConstants.java
    webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_08/
      - copied from r233010, webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_08_10/
    webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_08/AddressingConstants.java
      - copied, changed from r233049, webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_08_10/AddressingConstants.java
Removed:
    webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_08_10/AddressingConstants.java
    webservices/wsrf/trunk/src/java/org/apache/ws/util/XmlUtils.java
    webservices/wsrf/trunk/src/test/org/apache/ws/resource/TestFixtureFactory.java
Modified:
    webservices/wsrf/trunk/RELEASE_STEPS.txt
    webservices/wsrf/trunk/project.xml
    webservices/wsrf/trunk/src/java/org/apache/ws/addressing/XmlBeansEndpointReference.java
    webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2003_03/AddressingConstants.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/i18n/Keys.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceContext.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/properties/v2004_06/impl/NamespaceVersionHolderImpl.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/properties/v2004_11/impl/NamespaceVersionHolderImpl.java
    webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/BeanFactory.java
    webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/JNDIUtils.java
    webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/NamingContext.java
    webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/ServiceResourceRef.java
    webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanJndiUtils.java

Modified: webservices/wsrf/trunk/RELEASE_STEPS.txt
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/RELEASE_STEPS.txt?rev=233050&r1=233049&r2=233050&view=diff
==============================================================================
--- webservices/wsrf/trunk/RELEASE_STEPS.txt (original)
+++ webservices/wsrf/trunk/RELEASE_STEPS.txt Tue Aug 16 13:32:40 2005
@@ -17,6 +17,10 @@
 - PGP-sign the dist zipfiles (bin and src)...the script sign-release.bat can be used for
this, but you will need to update it with your name.
 - Using WinSCP, copy dist zipfiles and asc, md5, and KEYS files to minotaur:/www/ws.apache.org/dist/<project>.
 - Send out release proposal VOTE email to dev list.
+
+POST-VOTE
+---------
+- Using WinSCP, copy dist zipfiles and asc, md5, and KEYS files to minotaur:/www/www.apache.org/dist/ws/<project>.
 - To create a branch for the release, SVN-copy contents of trunk/ to branches/X.Y/, e.g.:
   svn copy https://svn.apache.org/repos/asf/webservices/wsrf/trunk https://svn.apache.org/repos/asf/webservices/wsrf/branches/1.0
 

Modified: webservices/wsrf/trunk/project.xml
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/project.xml?rev=233050&r1=233049&r2=233050&view=diff
==============================================================================
--- webservices/wsrf/trunk/project.xml (original)
+++ webservices/wsrf/trunk/project.xml Tue Aug 16 13:32:40 2005
@@ -77,18 +77,6 @@
   <dependencies>
 
     <dependency>
-      <groupId>addressing</groupId>
-      <artifactId>addressing</artifactId>
-      <version>SNAPSHOT</version>
-      <url>http://ws.apache.org/ws-fx/addressing/</url>
-      <properties>
-        <license>ApacheLicense-2.0.txt</license>
-        <usage>Needed for handling WS-Addressing.</usage>
-        <war.bundle>true</war.bundle>
-      </properties>
-    </dependency>
-
-    <dependency>
       <groupId>ant</groupId>
       <artifactId>ant</artifactId>
       <version>1.6.2</version>

Added: webservices/wsrf/trunk/src/java/org/apache/ws/addressing/AddressingUtils.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/addressing/AddressingUtils.java?rev=233050&view=auto
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/addressing/AddressingUtils.java (added)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/addressing/AddressingUtils.java Tue Aug
16 13:32:40 2005
@@ -0,0 +1,107 @@
+/*=============================================================================*
+ *  Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed 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.ws.addressing;
+
+import org.apache.ws.util.NameUtils;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+/**
+ * A set of WS-Addressing-related utility methods.
+ */
+public abstract class AddressingUtils
+{
+
+    /**
+     * An array that contains the namespace URIs (as Strings) for the various versions of
WSA that we support. The URIs
+     * are indexed in the array in order of preference.
+     */
+    private static final String[] SUPPORTED_WSA_NSURIS = new String[]
+    {
+        org.apache.ws.addressing.v2004_08.AddressingConstants.NSURI_ADDRESSING_SCHEMA,
+        org.apache.ws.addressing.v2004_03.AddressingConstants.NSURI_ADDRESSING_SCHEMA,
+        org.apache.ws.addressing.v2003_03.AddressingConstants.NSURI_ADDRESSING_SCHEMA
+    };
+
+    /**
+     * @param soapHeader
+     * @param headerElemName
+     *
+     * @return
+     */
+    public static SOAPHeaderElement getHeaderElement( SOAPHeader soapHeader, QName headerElemName
)
+    {
+        if ( headerElemName == null )
+        {
+            throw new IllegalArgumentException( "Header element name must not be null." );
+        }
+        SOAPHeaderElement headerElem = null;
+        if ( soapHeader != null )
+        {
+            Iterator headerElemIter = soapHeader.examineAllHeaderElements();
+            while ( headerElemIter.hasNext() )
+            {
+                SOAPHeaderElement elem = (SOAPHeaderElement) headerElemIter.next();
+                if ( NameUtils.toQName( elem.getElementName() ).equals( headerElemName )
)
+                {
+                    headerElem = elem;
+                    break;
+                }
+            }
+        }
+        return headerElem;
+    }
+
+    /**
+     * Returns the WS-Addressing namespace URI for the specified SOAP header, or null if
the header is <code>null</code>
+     * or does not contain any WS-Addressing header elements.
+     *
+     * @param soapHeader a SOAP header
+     *
+     * @return
+     */
+    public static String getAddressingNamespaceURI( SOAPHeader soapHeader )
+    {
+        String wsaNsURI = null;
+        if ( soapHeader != null )
+        {
+            Iterator headerElemIter = soapHeader.examineAllHeaderElements();
+            while ( headerElemIter.hasNext() )
+            {
+                SOAPHeaderElement headerElem = (SOAPHeaderElement) headerElemIter.next();
+                Name headerElemName = headerElem.getElementName();
+                // NOTE: Action is the only message info header that is required by all versions
of WS-A
+                if ( "Action".equals( headerElemName.getLocalName() ) )
+                {
+                    for ( int i = 0; i < SUPPORTED_WSA_NSURIS.length; i++ )
+                    {
+                        if ( SUPPORTED_WSA_NSURIS[i].equals( headerElemName.getURI() ) )
+                        {
+                            wsaNsURI = SUPPORTED_WSA_NSURIS[i];
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+        return wsaNsURI;
+    }
+
+}

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/addressing/XmlBeansEndpointReference.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/addressing/XmlBeansEndpointReference.java?rev=233050&r1=233049&r2=233050&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/addressing/XmlBeansEndpointReference.java
(original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/addressing/XmlBeansEndpointReference.java
Tue Aug 16 13:32:40 2005
@@ -307,7 +307,7 @@
             m_xmlObjectEPR    = endpointReferenceType;
             epr               = endpointReferenceType;
          }
-         else if ( org.apache.ws.addressing.v2004_08_10.AddressingConstants.NSURI_ADDRESSING_SCHEMA.equals(
m_addressingVersionURI ) )
+         else if ( org.apache.ws.addressing.v2004_08.AddressingConstants.NSURI_ADDRESSING_SCHEMA.equals(
m_addressingVersionURI ) )
          {
             org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType endpointReferenceType
=
                build2004_08_EPR(  );
@@ -338,7 +338,7 @@
             EndpointReferenceType endpointReferenceType = build2003_03_EPR(  );
             epr = endpointReferenceType;
          }
-         else if ( org.apache.ws.addressing.v2004_08_10.AddressingConstants.NSURI_ADDRESSING_SCHEMA.equals(
namespace ) )
+         else if ( org.apache.ws.addressing.v2004_08.AddressingConstants.NSURI_ADDRESSING_SCHEMA.equals(
namespace ) )
          {
             org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType endpointReferenceType
=
                build2004_08_EPR(  );

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2003_03/AddressingConstants.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2003_03/AddressingConstants.java?rev=233050&r1=233049&r2=233050&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2003_03/AddressingConstants.java
(original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2003_03/AddressingConstants.java
Tue Aug 16 13:32:40 2005
@@ -15,9 +15,8 @@
  *=============================================================================*/
 package org.apache.ws.addressing.v2003_03;
 
-
 /**
- * WS-Addressing constants.
+ * WS-Addressing 2003/03 constants.
  */
 public interface AddressingConstants
 {

Added: webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_03/AddressingConstants.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_03/AddressingConstants.java?rev=233050&view=auto
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_03/AddressingConstants.java
(added)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_03/AddressingConstants.java
Tue Aug 16 13:32:40 2005
@@ -0,0 +1,34 @@
+/*=============================================================================*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed 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.ws.addressing.v2004_03;
+
+/**
+ * WS-Addressing 2004/03 constants.
+ */
+public interface AddressingConstants
+{
+   /** DOCUMENT_ME */
+   String NSURI_ADDRESSING_SCHEMA = "http://schemas.xmlsoap.org/ws/2004/03/addressing";
+
+   /** DOCUMENT_ME */
+   String NSPREFIX_ADDRESSING_SCHEMA = "wsa04";
+
+   /** DOCUMENT_ME */
+   String TO = "To";
+
+   /** DOCUMENT_ME */
+   String ACTION = "Action";
+}
\ No newline at end of file

Copied: webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_08/AddressingConstants.java
(from r233049, webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_08_10/AddressingConstants.java)
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_08/AddressingConstants.java?p2=webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_08/AddressingConstants.java&p1=webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_08_10/AddressingConstants.java&r1=233049&r2=233050&rev=233050&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_08_10/AddressingConstants.java
(original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/addressing/v2004_08/AddressingConstants.java
Tue Aug 16 13:32:40 2005
@@ -13,20 +13,17 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  *=============================================================================*/
-package org.apache.ws.addressing.v2004_08_10;
-
+package org.apache.ws.addressing.v2004_08;
 
 /**
- * @author Sal Campana
+ * WS-Addressing 2004/08 constants.
  */
 public interface AddressingConstants
 {
    /** DOCUMENT_ME */
    String NSURI_ADDRESSING_SCHEMA = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
 
-   /**
-    * DOCUMENT_ME
-    */
+   /** DOCUMENT_ME */
    String NSPREFIX_ADDRESSING_SCHEMA = "wsa";
 
    /** DOCUMENT_ME */

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java?rev=233050&r1=233049&r2=233050&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/handler/ResourceHandler.java Tue
Aug 16 13:32:40 2005
@@ -25,6 +25,7 @@
 import org.apache.ws.resource.i18n.Keys;
 import org.apache.ws.resource.i18n.MessagesImpl;
 import org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.util.NameUtils;
 import org.apache.ws.util.i18n.Messages;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
@@ -43,6 +44,8 @@
 import javax.xml.soap.SOAPEnvelope;
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -86,6 +89,11 @@
    /** DOCUMENT_ME */
    public static final String HANDLER_OPT_VALIDATE_REQUEST_XML = "validateRequestXml";
 
+   public static final String CONTEXT_PROP_WSA_NAMESPACE_URI = "wsa.namespace.uri";
+
+   public static final String CONTEXT_PROP_WSA_RESPONSE_ACTION = "wsa.response.action";
+   public static final String CONTEXT_PROP_WSA_RESPONSE_DESTINATION = "wsa.response.destination";
+
    static
    {
       ExceptionUtils.addCauseMethodName( "getLinkedCause" ); // for JAXRPCException
@@ -93,7 +101,7 @@
 
    private Map m_handlerOptions;
 
-   /**
+    /**
     * This handler acts as the pivot and does not process any SOAP header elements.
     *
     * @return the names of the SOAP header elements that this handler processes
@@ -186,24 +194,24 @@
       {
          handleException( e );
       }
-
       return false; // short-circuit any remaining Handlers in chain
    }
 
    /**
     * DOCUMENT_ME
     *
-    * @param messageContext DOCUMENT_ME
+    * @param msgContext DOCUMENT_ME
     *
     * @return DOCUMENT_ME
     */
-   public boolean handleResponse( MessageContext messageContext )
+   public boolean handleResponse( MessageContext msgContext )
    {
       try
       {
          LOG.debug( MSG.getMessage( Keys.HANDLING_RESPONSE ) );
-         SOAPEnvelope responseEnvelope  = getResponseEnvelope( (SOAPMessageContext) messageContext
);
-         List         responseBodyElems = (List) messageContext.getProperty( WSRF_RESPONSE_XMLOBJECT_LIST
);
+         SOAPEnvelope responseEnvelope  = getResponseEnvelope( (SOAPMessageContext) msgContext
);
+         addWsaHeaderElementsToResponse( msgContext, responseEnvelope );
+         List         responseBodyElems = (List) msgContext.getProperty( WSRF_RESPONSE_XMLOBJECT_LIST
);
          LOG.debug( MSG.getMessage( Keys.FOUND_RESP_ELEMS,
                                     Integer.toString( responseBodyElems.size(  ) ) ) );
          if ( responseBodyElems != null )
@@ -220,7 +228,6 @@
                }
             }
          }
-
          if ( LOG.isDebugEnabled(  ) )
          {
             LOG.debug( "Sending SOAP response: \n" + responseEnvelope );
@@ -230,11 +237,35 @@
       {
          handleException( e );
       }
-
       return false; // short-circuit any remaining Handlers in chain
    }
 
-   /**
+    private void addWsaHeaderElementsToResponse( MessageContext msgContext, SOAPEnvelope
responseEnvelope )
+            throws SOAPException
+    {
+        SOAPHeader header = responseEnvelope.getHeader();
+        if ( header == null )
+        {
+           header = responseEnvelope.addHeader();
+        }
+
+        String wsaAction = (String) msgContext.getProperty( CONTEXT_PROP_WSA_RESPONSE_ACTION
);
+        if ( wsaAction == null )
+        {
+           wsaAction = (String) msgContext.getProperty( CONTEXT_PROP_WSA_NAMESPACE_URI )
+ "/anonymous";
+        }
+        SOAPHeaderElement actionHeaderElem = header.addHeaderElement( NameUtils.createName(
"Action", "wsa", (String)msgContext.getProperty( CONTEXT_PROP_WSA_NAMESPACE_URI ) ) );
+        actionHeaderElem.setValue( wsaAction );
+        String wsaTo = (String) msgContext.getProperty( CONTEXT_PROP_WSA_RESPONSE_DESTINATION
);
+        if ( wsaTo == null )
+        {
+           wsaTo = (String) msgContext.getProperty( CONTEXT_PROP_WSA_NAMESPACE_URI ) + "/anonymous";
+        }
+        SOAPHeaderElement toHeaderElem = header.addHeaderElement( NameUtils.createName( "To",
"wsa", (String)msgContext.getProperty( CONTEXT_PROP_WSA_NAMESPACE_URI ) ) );
+        toHeaderElem.setValue( wsaTo );
+    }
+
+    /**
     * DOCUMENT_ME
     *
     * @param handlerInfo DOCUMENT_ME

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/i18n/Keys.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/i18n/Keys.java?rev=233050&r1=233049&r2=233050&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/i18n/Keys.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/i18n/Keys.java Tue Aug 16 13:32:40
2005
@@ -668,14 +668,29 @@
    String ERROR_ONLY_WSDLS = "ERROR_ONLY_WSDLS";
 
    /**
-    * @msg Retrieving the Action from the Addressing Headers.  Action is: {0}
+    * @msg Found WS-Addressing Action in SOAP request header - value: {0}
     */
-   String GET_ACTION_FROM_ADDR_HDR = "GET_ACTION_FROM_ADDR_HDR";
+   String FOUND_WSA_ACTION = "FOUND_WSA_ACTION";
 
    /**
     * @msg Received request with no WS-Addressing Action header.
     */
    String NO_WSA_ACTION = "NO_WSA_ACTION";
+
+    /**
+     * @msg Received request with WS-Addressing Action ({0}) that is not a valid URI.
+     */
+    String INVALID_WSA_ACTION = "INVALID_WSA_ACTION";
+
+   /**
+    * @msg Received request with no WS-Addressing To header.
+    */
+   String NO_WSA_TO = "NO_WSA_TO";
+
+    /**
+     * @msg Received request with WS-Addressing To ({0}) that is not a valid URI.
+     */
+    String INVALID_WSA_TO = "INVALID_WSA_TO";
 
    /**
     * @msg Received request with no WS-Addressing headers.

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceContext.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceContext.java?rev=233050&r1=233049&r2=233050&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceContext.java
(original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/AbstractResourceContext.java
Tue Aug 16 13:32:40 2005
@@ -15,29 +15,34 @@
  *=============================================================================*/
 package org.apache.ws.resource.impl;
 
-import org.apache.axis.message.addressing.Action;
-import org.apache.axis.message.addressing.AddressingHeaders;
-import org.apache.axis.message.addressing.util.AddressingUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.Soap1_1Constants;
+import org.apache.ws.addressing.AddressingUtils;
 import org.apache.ws.resource.JndiConstants;
 import org.apache.ws.resource.Resource;
 import org.apache.ws.resource.ResourceContext;
 import org.apache.ws.resource.ResourceContextException;
 import org.apache.ws.resource.ResourceException;
 import org.apache.ws.resource.ResourceHome;
+import org.apache.ws.resource.handler.ResourceHandler;
 import org.apache.ws.resource.faults.FaultException;
 import org.apache.ws.resource.i18n.Keys;
 import org.apache.ws.resource.i18n.MessagesImpl;
 import org.apache.ws.util.i18n.Messages;
+
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import javax.xml.rpc.handler.MessageContext;
 import javax.xml.rpc.handler.soap.SOAPMessageContext;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeaderElement;
 import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.namespace.QName;
 import java.net.MalformedURLException;
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.Collections;
 import java.util.HashMap;
@@ -64,7 +69,7 @@
    /**
     * Creates a new {@link AbstractResourceContext} object.
     *
-    * @param soapMsgContext DOCUMENT_ME
+    * @param soapMsgContext SOAP message context corresponding to a particular request
     */
    public AbstractResourceContext( SOAPMessageContext soapMsgContext )
    throws Exception
@@ -197,15 +202,7 @@
    {
       if ( action != null )
       {
-         AddressingHeaders responseAddrHeaders = AddressingUtils.getResponseHeaders( m_msgContext
);
-         try
-         {
-            responseAddrHeaders.setAction( action.toString(  ) );
-         }
-         catch ( Exception e )
-         {
-            throw new RuntimeException( "Failed to set wsa:Action for response.", e );
-         }
+          m_msgContext.setProperty( ResourceHandler.CONTEXT_PROP_WSA_RESPONSE_ACTION, action.toString()
);
       }
    }
 
@@ -220,11 +217,11 @@
    }
 
    /**
-    * Returns target m_serviceName associated with this context.
+    * Returns target service name associated with this context.
     *
     * @return the target m_serviceName that was set with {@link #setServiceName(String) setService()}.
If set to
-    *         <code>null</code> or not set at all, by default it returns the
target m_serviceName associated with the
-    *         underlying SOAP m_msg context.
+    *         <code>null</code> or not set at all, by default it returns the
target service name associated with the
+    *         underlying SOAP message context.
     */
    public String getServiceName(  )
    {
@@ -264,32 +261,34 @@
    }
 
    /**
-    * Returns the WS-Addressing Action Header
+    * Returns the value of the WS-Addressing Action header element.
     *
-    * @param msgContext SAAJ message context; may not be null
+    * @param msgContext the context for the current SOAP request; must not be null
     *
     * @return
     */
-   protected String getAddressingAction( MessageContext msgContext )
+   protected String getAddressingAction( SOAPMessageContext msgContext )
    {
-      AddressingHeaders addrHeaders =
-         (AddressingHeaders) msgContext.getProperty( org.apache.axis.message.addressing.Constants.ENV_ADDRESSING_REQUEST_HEADERS
);
-      if ( addrHeaders == null )
-      {
-         LOG.debug( MSG.getMessage( Keys.NO_WSA_HEADERS ) );
-         throw new FaultException( Soap1_1Constants.FAULT_CLIENT, "This endpoint requires
WS-Addressing headers." );
-      }
-
-      Action wsaAction = addrHeaders.getAction(  );
-      if ( wsaAction == null )
+       SOAPHeaderElement actionHeaderElem = AddressingUtils.getHeaderElement( getSOAPHeader(
msgContext ), new QName( getAddressingNamespaceURI( msgContext ), "Action" ) );
+       if ( actionHeaderElem == null )
       {
          LOG.debug( MSG.getMessage( Keys.NO_WSA_ACTION ) );
          throw new FaultException( Soap1_1Constants.FAULT_CLIENT,
-                                   "The WS-Addressing Action header is required by this endpoint."
);
+                                   "A WS-Addressing Action SOAP header element is required
by this endpoint." );
       }
-
-      LOG.debug( MSG.getMessage( Keys.GET_ACTION_FROM_ADDR_HDR, wsaAction ) );
-      return wsaAction.toString(  );
+       String action = actionHeaderElem.getValue();      
+       try
+       {
+           new URI( action );
+       }
+       catch ( URISyntaxException urise )
+       {
+           LOG.debug( MSG.getMessage( Keys.INVALID_WSA_ACTION, action ) );
+           throw new FaultException( Soap1_1Constants.FAULT_CLIENT,
+                                     "The WS-Addressing Action specified in the SOAP header
is not a valid URI." );
+       }
+       LOG.debug( MSG.getMessage( Keys.FOUND_WSA_ACTION, action ) );
+      return action;
    }
 
    /**
@@ -318,23 +317,32 @@
    /**
     * DOCUMENT_ME
     *
-    * @param msgContext SAAJ message context; may not be null
+    * @param msgContext the context for the current SOAP request; must not be null
     *
     * @return DOCUMENT_ME
     */
-   protected URL getServiceURL( MessageContext msgContext )
+   protected URL getServiceURL( SOAPMessageContext msgContext )
    {
-      AddressingHeaders wsaHeaders =
-         (AddressingHeaders) msgContext.getProperty( org.apache.axis.message.addressing.Constants.ENV_ADDRESSING_REQUEST_HEADERS
);
+      SOAPHeaderElement toHeaderElem = AddressingUtils.getHeaderElement( getSOAPHeader( msgContext
), new QName( getAddressingNamespaceURI( msgContext ), "To" ) );
+      String serviceURL;
+      if ( toHeaderElem != null )
+      {
+         serviceURL = toHeaderElem.getValue();
+      }
+      else
+      {
+         serviceURL = getAddressingNamespaceURI( msgContext ) + "/anonymous";
+      }
       try
       {
-         String serviceUrl = wsaHeaders.getTo(  ).toString(  );
-         LOG.debug( MSG.getMessage( Keys.GET_SERVICE_URL_FROM_ADDR_HDR, serviceUrl ) );
-         return new URL( serviceUrl );
+         LOG.debug( MSG.getMessage( Keys.GET_SERVICE_URL_FROM_ADDR_HDR, serviceURL ) );
+         return new URL( serviceURL );
       }
       catch ( MalformedURLException murle )
       {
-         throw new RuntimeException( "Value of wsa:To SOAP header element is not a valid
URL.", murle );
+          LOG.debug( MSG.getMessage( Keys.INVALID_WSA_TO, serviceURL ) );
+          throw new FaultException( Soap1_1Constants.FAULT_CLIENT,
+                                    "The WS-Addressing destination specified in the SOAP
header (i.e. wsa:To header element) is not a valid URI." );
       }
    }
 
@@ -346,16 +354,40 @@
       return s;
    }
 
-   private void extractFields( MessageContext msgContext )
+   private void extractFields( SOAPMessageContext msgContext )
    {
+      m_action         = getAddressingAction( msgContext );
       m_serviceURL     = getServiceURL( msgContext );
       m_serviceName    = getServiceName( msgContext );
       m_baseURL        = getBaseURL( m_serviceURL );
-      m_action         = getAddressingAction( msgContext );
       extractProperties( msgContext );
    }
 
-   private void extractProperties( MessageContext msgContext )
+    private String getAddressingNamespaceURI( SOAPMessageContext msgContext )
+    {
+
+        String wsaNsURI = (String) msgContext.getProperty( ResourceHandler.CONTEXT_PROP_WSA_NAMESPACE_URI
);
+        if ( wsaNsURI == null )
+        {
+            wsaNsURI = AddressingUtils.getAddressingNamespaceURI( getSOAPHeader( msgContext
) );
+            msgContext.setProperty( ResourceHandler.CONTEXT_PROP_WSA_NAMESPACE_URI, wsaNsURI
);
+        }
+        return wsaNsURI;
+    }
+
+    private SOAPHeader getSOAPHeader( SOAPMessageContext msgContext )
+    {
+        try
+        {
+            return msgContext.getMessage().getSOAPHeader();
+        }
+        catch ( SOAPException soape )
+        {
+            throw new RuntimeException( "Failed to extract header from SOAP message.", soape
);
+        }
+    }
+
+    private void extractProperties( MessageContext msgContext )
    {
       Iterator propertyNames = msgContext.getPropertyNames(  );
       while ( propertyNames.hasNext(  ) )

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/properties/v2004_06/impl/NamespaceVersionHolderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/properties/v2004_06/impl/NamespaceVersionHolderImpl.java?rev=233050&r1=233049&r2=233050&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/properties/v2004_06/impl/NamespaceVersionHolderImpl.java
(original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/properties/v2004_06/impl/NamespaceVersionHolderImpl.java
Tue Aug 16 13:32:40 2005
@@ -15,7 +15,7 @@
  *=============================================================================*/
 package org.apache.ws.resource.properties.v2004_06.impl;
 
-import org.apache.axis.message.addressing.Constants;
+import org.apache.ws.addressing.v2003_03.AddressingConstants;
 import org.apache.ws.resource.faults.v2004_06.FaultsConstants;
 import org.apache.ws.resource.lifetime.v2004_06.ResourceLifetimeConstants;
 import org.apache.ws.resource.metadataexchange.v2004_09.MetadataExchangeConstants;
@@ -24,7 +24,7 @@
 import org.apache.ws.resource.servicegroup.v2004_06.ServiceGroupConstants;
 
 /**
- * @author Sal Campana
+ * The set of namespace URIs associated with the 2004/06 draft of WSRF.
  */
 public class NamespaceVersionHolderImpl
    implements NamespaceVersionHolder
@@ -36,7 +36,7 @@
     */
    public String getAddressingNamespace(  )
    {
-      return Constants.NS_URI_ADDRESSING_2003_03;
+      return AddressingConstants.NSURI_ADDRESSING_SCHEMA;
    }
 
    /**

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/properties/v2004_11/impl/NamespaceVersionHolderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/properties/v2004_11/impl/NamespaceVersionHolderImpl.java?rev=233050&r1=233049&r2=233050&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/properties/v2004_11/impl/NamespaceVersionHolderImpl.java
(original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/properties/v2004_11/impl/NamespaceVersionHolderImpl.java
Tue Aug 16 13:32:40 2005
@@ -15,7 +15,7 @@
  *=============================================================================*/
 package org.apache.ws.resource.properties.v2004_11.impl;
 
-import org.apache.axis.message.addressing.Constants;
+import org.apache.ws.addressing.v2004_08.AddressingConstants;
 import org.apache.ws.resource.faults.v2004_11.FaultsConstants;
 import org.apache.ws.resource.lifetime.v2004_11.ResourceLifetimeConstants;
 import org.apache.ws.resource.metadataexchange.v2004_09.MetadataExchangeConstants;
@@ -24,7 +24,7 @@
 import org.apache.ws.resource.servicegroup.v2004_11.ServiceGroupConstants;
 
 /**
- * @author Sal Campana
+ * The set of namespace URIs associated with the 2004/11 draft of WSRF.
  */
 public class NamespaceVersionHolderImpl
    implements NamespaceVersionHolder
@@ -36,7 +36,7 @@
     */
    public String getAddressingNamespace(  )
    {
-      return Constants.NS_URI_ADDRESSING_2004_08;
+      return AddressingConstants.NSURI_ADDRESSING_SCHEMA;
    }
 
    /**

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/BeanFactory.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/BeanFactory.java?rev=233050&r1=233049&r2=233050&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/BeanFactory.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/BeanFactory.java Tue Aug 16 13:32:40
2005
@@ -17,11 +17,11 @@
 
 import org.apache.axis.AxisEngine;
 import org.apache.axis.MessageContext;
+
 import javax.naming.Context;
 import javax.naming.Name;
 import javax.naming.NamingException;
 import javax.security.auth.Subject;
-import java.security.PrivilegedExceptionAction;
 import java.util.Hashtable;
 
 /**
@@ -29,7 +29,7 @@
  *
  * @author Globus
  *
- * TODO (v1.1): remove Axis dependency from this class
+ * TODO (v1.1): remove Axis deps
  */
 public class BeanFactory
    extends BasicBeanFactory
@@ -142,39 +142,4 @@
       }
    }
 
-   private class GetInstanceAction
-      implements PrivilegedExceptionAction
-   {
-      private MessageContext msgCtx;
-      private Object         obj;
-      private Name           name;
-      private Context        nameCtx;
-      private Hashtable      environment;
-
-      private GetInstanceAction( MessageContext msgCtx,
-                                 Object         obj,
-                                 Name           name,
-                                 Context        nameCtx,
-                                 Hashtable      environment )
-      {
-         this.msgCtx         = msgCtx;
-         this.obj            = obj;
-         this.name           = name;
-         this.nameCtx        = nameCtx;
-         this.environment    = environment;
-      }
-
-      /**
-       * DOCUMENT_ME
-       *
-       * @return DOCUMENT_ME
-       *
-       * @throws Exception DOCUMENT_ME
-       */
-      public Object run(  )
-      throws Exception
-      {
-         return getInstance( this.msgCtx, this.obj, this.name, this.nameCtx, this.environment
);
-      }
-   }
 }

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/JNDIUtils.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/JNDIUtils.java?rev=233050&r1=233049&r2=233050&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/JNDIUtils.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/JNDIUtils.java Tue Aug 16 13:32:40
2005
@@ -40,6 +40,8 @@
 
 /**
  * A utility class containing methods for setting up the JNDI environment and performing
JNDI lookups.
+ * 
+ * TODO: remove Axis deps
  */
 public abstract class JNDIUtils
 {

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/NamingContext.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/NamingContext.java?rev=233050&r1=233049&r2=233050&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/NamingContext.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/NamingContext.java Tue Aug 16
13:32:40 2005
@@ -37,8 +37,7 @@
 /**
  * DOCUMENT_ME
  *
- * @author $author$
- * @version $Revision: 1.4 $
+ * TODO: remove Axis deps
  */
 public class NamingContext
 {

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/ServiceResourceRef.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/ServiceResourceRef.java?rev=233050&r1=233049&r2=233050&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/ServiceResourceRef.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/ServiceResourceRef.java Tue Aug
16 13:32:40 2005
@@ -20,8 +20,7 @@
 /**
  * DOCUMENT_ME
  *
- * @author $author$
- * @version $Revision: 1.3 $
+ * TODO: remove Axis deps
  */
 public class ServiceResourceRef
    extends org.apache.naming.ResourceRef

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanJndiUtils.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanJndiUtils.java?rev=233050&r1=233049&r2=233050&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanJndiUtils.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/jndi/XmlBeanJndiUtils.java Tue Aug
16 13:32:40 2005
@@ -18,7 +18,6 @@
 import org.apache.axis.components.logger.LogFactory;
 import org.apache.commons.logging.Log;
 import org.apache.ws.resource.JndiConstants;
-import org.apache.ws.util.XmlBeanUtils;
 import org.apache.ws.util.jndi.tools.ConfigContext;
 import org.apache.ws.util.jndi.tools.Environment;
 import org.apache.ws.util.jndi.tools.MetadataConfig;
@@ -36,11 +35,11 @@
 import org.apache.wsfx.wsrf.jndi.config.ServiceDocument;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
+
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingException;
-import javax.xml.namespace.QName;
 import java.io.File;
 import java.io.FileFilter;
 import java.io.FileInputStream;
@@ -58,6 +57,8 @@
  * setup of JNDI, it loads the JNDI config file and registers instances of services.
  *
  * @author Sal Campana
+ *
+ * TODO: remove Axis deps
  */
 public class XmlBeanJndiUtils
 {
@@ -639,8 +640,7 @@
       boolean isValid = requestXBean.validate( validateOptions );
       if ( !isValid )
       {
-         QName        bodyElemName = XmlBeanUtils.getName( requestXBean );
-         StringBuffer strBuf = new StringBuffer( "jndi-config.xml  is not valid as per its
schema: \n\n" );
+         StringBuffer strBuf = new StringBuffer( "jndi-config.xml is not valid as per its
schema: \n\n" );
          for ( int i = 0; i < errorList.size(  ); i++ )
          {
             strBuf.append( "\t\t" );



Mime
View raw message