ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davidills...@apache.org
Subject svn commit: r610024 - in /webservices/axis2/trunk/java/modules: addressing/src/org/apache/axis2/handlers/addressing/ kernel/src/org/apache/axis2/addressing/ kernel/src/org/apache/axis2/deployment/ kernel/src/org/apache/axis2/description/
Date Tue, 08 Jan 2008 15:37:27 GMT
Author: davidillsley
Date: Tue Jan  8 07:37:24 2008
New Revision: 610024

URL: http://svn.apache.org/viewvc?rev=610024&view=rev
Log:
AXIS2-2873

(re?)introduce support for wsa:EndpointReferences embedded in wsdl11 port elements.

Also some cleanup of the 'WSAddressing flag' work I did ages ago that should never have introduced
methods on AxisService.

Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java?rev=610024&r1=610023&r2=610024&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
Tue Jan  8 07:37:24 2008
@@ -38,6 +38,8 @@
 import org.apache.axis2.addressing.i18n.AddressingMessages;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisEndpoint;
+import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.HandlerDescription;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.handlers.AbstractHandler;
@@ -379,7 +381,7 @@
                     }
                     createSOAPHeaderBlock(address, WSA_TO, epr.getAddressAttributes());
                 }
-                processToEPRReferenceInformation(epr.getAllReferenceParameters(), header);
+                processToEPRReferenceInformation(epr.getAllReferenceParameters());
             }
         }
 
@@ -449,22 +451,44 @@
          * @param parent               is the element to which the referenceparameters should
be
          *                             attached
          */
-        private void processToEPRReferenceInformation(Map referenceInformation, OMElement
parent) {
-            if (referenceInformation != null && parent != null) {
+        private void processToEPRReferenceInformation(Map referenceInformation) {
+            if (referenceInformation != null) {
                 if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
                     log.trace("processToEPRReferenceInformation: " + referenceInformation);
                 }
                 Iterator iterator = referenceInformation.values().iterator();
                 while (iterator.hasNext()) {
                     OMElement omElement = (OMElement)iterator.next();
-                    OMElement newElement = ElementHelper.importOMElement(omElement, parent.getOMFactory());
+                    OMElement newElement = ElementHelper.importOMElement(omElement, header.getOMFactory());
                     if (isFinalAddressingNamespace) {
                         newElement.addAttribute(Final.WSA_IS_REFERENCE_PARAMETER_ATTRIBUTE,
                                                Final.WSA_TYPE_ATTRIBUTE_VALUE,
                                                addressingNamespaceObject);
                     }
-                    parent.addChild(newElement);
+                    header.addChild(newElement);
                 }
+            }
+            // Now add reference parameters we found in the WSDL (if any)
+            AxisService service = messageContext.getAxisService();
+            AxisEndpoint endpoint = service.getEndpoint(service.getEndpointName());
+            if(endpoint != null){
+            	ArrayList referenceparameters = (ArrayList) endpoint.getParameterValue(REFERENCE_PARAMETER_PARAMETER);
+            	if (LoggingControl.debugLoggingAllowed && log.isTraceEnabled()) {
+                    log.trace("processToEPRReferenceInformation: Reference Parameters from
WSDL:" + referenceparameters);
+                }
+            	if(referenceparameters!=null){
+            		Iterator iterator = referenceparameters.iterator();
+                    while (iterator.hasNext()) {
+                        OMElement omElement = (OMElement)iterator.next();
+                        OMElement newElement = ElementHelper.importOMElement(omElement, header.getOMFactory());
+                        if (isFinalAddressingNamespace) {
+                            newElement.addAttribute(Final.WSA_IS_REFERENCE_PARAMETER_ATTRIBUTE,
+                                                   Final.WSA_TYPE_ATTRIBUTE_VALUE,
+                                                   addressingNamespaceObject);
+                        }
+                        header.addChild(newElement);
+                    }
+            	}
             }
         }
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java?rev=610024&r1=610023&r2=610024&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java
Tue Jan  8 07:37:24 2008
@@ -55,6 +55,7 @@
     // ====================== Addressing Requirement Levels ==================
     // These are used to represent the requirement level on WS-Addressing indicated
     // in a services.xml or a WSDL file.
+    static final String ADDRESSING_REQUIREMENT_PARAMETER = "addressingRequirementParameter";
     // ADDRESSING_UNSPECIFIED is the equivalent of no UsingAddressing flag in a
     // WSDL file and the default of the WSAddressingRequred attribute in service.xml
     static final String ADDRESSING_UNSPECIFIED = "unspecified";
@@ -104,6 +105,12 @@
     static final String DISABLE_OUTBOUND_ADDRESSING_VALIDATION =
             "disableAddressingOutboundValidation";
 
+    /**
+     * This parameter is used to attach OMElement ReferenceParameters found in an EPR embedded
in a
+     * WSDL to an AxisEndpoint object.
+     */
+    static final String REFERENCE_PARAMETER_PARAMETER = "referenceParameters";
+    
     static final String WSAM_INVOCATION_PATTERN_PARAMETER_NAME = "wsamInvocationPattern";
     static final String WSAM_INVOCATION_PATTERN_SYNCHRONOUS = "synchronous";
     static final String WSAM_INVOCATION_PATTERN_ASYNCHRONOUS = "asynchronous";
@@ -173,6 +180,7 @@
         static final QName WSAW_USING_ADDRESSING =
                 new QName(WSAW_NAMESPACE, USING_ADDRESSING);
         static final QName WSAW_ANONYMOUS = new QName(WSAW_NAMESPACE, USING_ADDRESSING);
+        static final QName WSA_ENDPOINT_REFERENCE = new QName(WSA_NAMESPACE,"EndpointReference");
 
         final QName QNAME_WSA_TO = new QName(WSA_NAMESPACE, WSA_TO);
         final QName QNAME_WSA_FROM = new QName(WSA_NAMESPACE, WSA_FROM);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java?rev=610024&r1=610023&r2=610024&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingHelper.java
Tue Jan  8 07:37:24 2008
@@ -22,6 +22,7 @@
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.util.LoggingControl;
 import org.apache.axis2.util.Utils;
@@ -86,7 +87,7 @@
         // there are some information  that the fault thrower wants to pass to the fault
path.
         // Means that the fault is a ws-addressing one hence use the ws-addressing fault
action.
         Object faultInfoForHeaders =
-                messageContext.getProperty(Constants.FAULT_INFORMATION_FOR_HEADERS);
+                messageContext.getLocalProperty(Constants.FAULT_INFORMATION_FOR_HEADERS);
         // if the exception is due to a problem in the faultTo header itself, we can not
use those
         // fault informatio to send the error. Try to send using replyTo, leave it to transport
         boolean doNotSendFaultUsingFaultTo = false;
@@ -101,6 +102,25 @@
         return !doNotSendFaultUsingFaultTo;
     }
 
+    public static String getAddressingRequirementParemeterValue(AxisService axisService){
+    	String value = "";
+        if (axisService != null) {
+            value = Utils.getParameterValue(
+            		axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER));
+            if(value !=null){
+            	value = value.trim();
+            }
+            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+                log.debug("getAddressingRequirementParemeterValue: value: '" + value + "'");
+            }
+        }
+
+        if (value == null || "".equals(value)) {
+            value = AddressingConstants.ADDRESSING_UNSPECIFIED;
+        }
+        return value;
+    }
+    
     /**
      * Extract the parameter representing the Anonymous flag from the AxisOperation
      * and return the String value. Return the default of "optional" if not specified.
@@ -116,7 +136,7 @@
             	value = value.trim();
             }
             if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
-                log.debug("getAnonymousParameterValue: value: '" + value + "'");
+                log.debug("getInvocationPatternParameterValue: value: '" + value + "'");
             }
         }
 
@@ -184,4 +204,55 @@
             }
         }
     }
+
+	public static void setAddressingRequirementParemeterValue(AxisService axisService, String
value) {
+		if (value == null) {
+            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+                log.debug("getAddressingRequirementParemeterValue: value passed in is null.
return");
+            }
+            return;
+        }
+
+        Parameter param =
+                axisService.getParameter(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+        // If an existing parameter exists
+        if (param != null) {
+            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+                log.debug("setAddressingRequirementParemeterValue: Parameter already exists");
+            }
+            // and is not locked
+            if (!param.isLocked()) {
+                if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+                    log.debug("setAddressingRequirementParemeterValue: Parameter not locked.
Setting value: " +
+                            value);
+                }
+                // set the value
+                param.setValue(value);
+            }
+        } else {
+            // otherwise, if no Parameter exists
+            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+                log.debug("setAddressingRequirementParemeterValue: Parameter does not exist");
+            }
+            // Create new Parameter with correct name/value
+            param = new Parameter();
+            param.setName(AddressingConstants.ADDRESSING_REQUIREMENT_PARAMETER);
+            param.setValue(value);
+            try {
+                if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+                    log.debug("setAddressingRequirementParemeterValue: Adding parameter with
value: " + value);
+                }
+                // and add it to the AxisOperation object
+                axisService.addParameter(param);
+            } catch (AxisFault af) {
+                // This should not happen. AxisFault is only ever thrown when a locked Parameter
+                // of the same name already exists and this should be dealt with by the outer
+                // if statement.
+                if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled()) {
+                    log.debug(
+                            "setAddressingRequirementParemeterValue: addParameter failed:
" + af.getMessage());
+                }
+            }
+        }
+	}
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java?rev=610024&r1=610023&r2=610024&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
Tue Jan  8 07:37:24 2008
@@ -23,6 +23,7 @@
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingHelper;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.dataretrieval.DRConstants;
 import org.apache.axis2.deployment.util.PhasesInfo;
@@ -154,7 +155,7 @@
                     service_element.getAttribute(new QName(ATTRIBUTE_WSADDRESSING));
             if (addressingRequiredatt != null) {
                 String addressingRequiredString = addressingRequiredatt.getAttributeValue();
-                service.setWSAddressingFlag(addressingRequiredString);
+                AddressingHelper.setAddressingRequirementParemeterValue(service, addressingRequiredString);
             }
 
             //Setting service target namespace if any

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?rev=610024&r1=610023&r2=610024&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
Tue Jan  8 07:37:24 2008
@@ -20,11 +20,47 @@
 
 package org.apache.axis2.description;
 
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.net.SocketException;
+import java.net.URL;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.Types;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.http.HTTPAddress;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap12.SOAP12Address;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.wsdl.xml.WSDLWriter;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
-import org.apache.axis2.description.java2wsdl.*;
-import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AddressingHelper;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.context.MessageContext;
@@ -37,10 +73,15 @@
 import org.apache.axis2.dataretrieval.LocatorType;
 import org.apache.axis2.dataretrieval.OutputForm;
 import org.apache.axis2.dataretrieval.WSDLSupplier;
+import org.apache.axis2.deployment.DeploymentConstants;
+import org.apache.axis2.deployment.util.ExcludeInfo;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.deployment.util.Utils;
-import org.apache.axis2.deployment.util.ExcludeInfo;
-import org.apache.axis2.deployment.DeploymentConstants;
+import org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator;
+import org.apache.axis2.description.java2wsdl.DocLitBareSchemaGenerator;
+import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
+import org.apache.axis2.description.java2wsdl.SchemaGenerator;
+import org.apache.axis2.description.java2wsdl.TypeTable;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.DefaultObjectSupplier;
 import org.apache.axis2.engine.MessageReceiver;
@@ -51,8 +92,8 @@
 import org.apache.axis2.transport.TransportListener;
 import org.apache.axis2.transport.http.server.HttpUtils;
 import org.apache.axis2.util.Loader;
-import org.apache.axis2.util.XMLUtils;
 import org.apache.axis2.util.XMLPrettyPrinter;
+import org.apache.axis2.util.XMLUtils;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -64,25 +105,13 @@
 import org.apache.ws.commons.schema.utils.NamespaceMap;
 import org.apache.ws.commons.schema.utils.NamespacePrefixList;
 import org.codehaus.jam.JMethod;
-import org.w3c.dom.*;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 import org.xml.sax.SAXException;
 
-import javax.wsdl.*;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.schema.Schema;
-import javax.wsdl.extensions.soap12.SOAP12Address;
-import javax.wsdl.extensions.http.HTTPAddress;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.wsdl.xml.WSDLWriter;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.*;
-import java.net.SocketException;
-import java.net.URL;
-import java.security.PrivilegedAction;
-import java.util.*;
-
 /**
  * Class AxisService
  */
@@ -230,9 +259,6 @@
     private String endpointName;
     private String endpointURL;
 
-    // Flag representing whether WS-Addressing is required to use this service.
-    // Reflects the wsaw:UsingAddressing wsdl extension element
-    private String wsaddressingFlag = AddressingConstants.ADDRESSING_UNSPECIFIED;
     private boolean clientSide = false;
 
     //To keep a ref to ObjectSupplier instance
@@ -276,15 +302,18 @@
         this.endpointMap.put(key, axisEndpoint);
     }
 
+    /**
+     * @deprecated Use AddressingHelper.getAddressingRequirementParemeterValue
+     */
     public String getWSAddressingFlag() {
-        return wsaddressingFlag;
+        return AddressingHelper.getAddressingRequirementParemeterValue(this);
     }
 
+    /**
+     * @deprecated Use AddressingHelper.setAddressingRequirementParemeterValue
+     */
     public void setWSAddressingFlag(String ar) {
-        wsaddressingFlag = ar;
-        if (wsaddressingFlag == null) {
-            wsaddressingFlag = AddressingConstants.ADDRESSING_UNSPECIFIED;
-        }
+    	AddressingHelper.setAddressingRequirementParemeterValue(this, ar);
     }
 
     public boolean isSchemaLocationsAdjusted() {
@@ -1381,8 +1410,15 @@
             return null;
         }
 
-        AxisOperation operation = (AxisOperation) getChild(new QName(soapAction));
-
+        AxisOperation operation = null;
+        Iterator children = getChildren();
+        while(children.hasNext() && (operation == null)){
+        	AxisOperation op = (AxisOperation)children.next();
+        	if(op.getName().getLocalPart().equals(soapAction)){
+        		operation = op;
+        	}
+        }
+        
         if (operation != null) {
         	if(log.isDebugEnabled()){
         		log.debug("getOperationBySOAPAction: Operation ("+operation+","+operation.getName()+")
for soapAction: "+soapAction+" found as child.");

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java?rev=610024&r1=610023&r2=610024&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
Tue Jan  8 07:37:24 2008
@@ -7,6 +7,7 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AddressingHelper;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.namespace.Constants;
 import org.apache.axis2.util.ExternalPolicySerializer;
@@ -585,13 +586,13 @@
 
         // Add WS-Addressing UsingAddressing element if appropriate
         // SHOULD be on the binding element per the specification
-        if (axisService.getWSAddressingFlag().equals(
+        if (AddressingHelper.getAddressingRequirementParemeterValue(axisService).equals(
                 AddressingConstants.ADDRESSING_OPTIONAL)) {
             WSDLSerializationUtil.addExtensionElement(fac, binding,
                                 AddressingConstants.USING_ADDRESSING,
                                 DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
                     wsaw);
-        } else if (axisService.getWSAddressingFlag().equals(
+        } else if (AddressingHelper.getAddressingRequirementParemeterValue(axisService).equals(
                 AddressingConstants.ADDRESSING_REQUIRED)) {
             WSDLSerializationUtil.addExtensionElement(fac, binding,
                                 AddressingConstants.USING_ADDRESSING,
@@ -717,13 +718,13 @@
 
         // Add WS-Addressing UsingAddressing element if appropriate
         // SHOULD be on the binding element per the specification
-        if (axisService.getWSAddressingFlag().equals(
+        if (AddressingHelper.getAddressingRequirementParemeterValue(axisService).equals(
                 AddressingConstants.ADDRESSING_OPTIONAL)) {
             WSDLSerializationUtil.addExtensionElement(fac, binding,
                                 AddressingConstants.USING_ADDRESSING,
                                 DEFAULT_WSDL_NAMESPACE_PREFIX + ":required", "true",
                     wsaw);
-        } else if (axisService.getWSAddressingFlag().equals(
+        } else if (AddressingHelper.getAddressingRequirementParemeterValue(axisService).equals(
                 AddressingConstants.ADDRESSING_REQUIRED)) {
             WSDLSerializationUtil.addExtensionElement(fac, binding,
                                 AddressingConstants.USING_ADDRESSING,

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=610024&r1=610023&r2=610024&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
Tue Jan  8 07:37:24 2008
@@ -19,10 +19,18 @@
 package org.apache.axis2.description;
 
 import com.ibm.wsdl.util.xml.DOM2Writer;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.util.StAXUtils;
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AddressingHelper;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.EndpointReferenceHelper;
 import org.apache.axis2.addressing.wsdl.WSDL11ActionHelper;
 import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.transport.http.util.RESTUtil;
@@ -87,6 +95,19 @@
 import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
 import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.*;
@@ -494,7 +515,7 @@
 
         copyExtensibleElements(wsdl4jPort.getExtensibilityElements(), wsdl4jDefinition,
                                axisEndpoint, BINDING);
-
+        processEmbeddedEPR(wsdl4jPort.getExtensibilityElements(), axisEndpoint);
         addDocumentation(axisEndpoint, wsdl4jPort.getDocumentationElement());
         if (processedBindings.containsKey(wsdl4jBinding.getQName())) {
             axisEndpoint.setBinding(
@@ -513,10 +534,31 @@
                     isSetMessageQNames);
             processedBindings.put(wsdl4jBinding.getQName(), axisBinding);
         }
+    }
 
+    private void processEmbeddedEPR(List extensibilityElements, AxisEndpoint axisEndpoint)
{
+    	Iterator eelts = extensibilityElements.iterator();
+    	while(eelts.hasNext()){
+    		ExtensibilityElement ee = (ExtensibilityElement)eelts.next();
+    		if(AddressingConstants.Final.WSA_ENDPOINT_REFERENCE.equals(ee.getElementType())){
+    			try {
+    				Element elt = ((UnknownExtensibilityElement)ee).getElement();
+    				OMElement eprOMElement = XMLUtils.toOM(elt);
+    				EndpointReference epr = EndpointReferenceHelper.fromOM(eprOMElement);
+    				Map referenceParameters = epr.getAllReferenceParameters();
+    				if(referenceParameters != null){
+    					axisEndpoint.addParameter(AddressingConstants.REFERENCE_PARAMETER_PARAMETER, new
ArrayList(referenceParameters.values()));
+    				}
+    			} catch (Exception e) {
+    				if(log.isDebugEnabled()){
+    					log.debug("Exception encountered processing embedded wsa:EndpointReference", e);
+    				}
+    			}
+    		}
+    	}
     }
 
-    private void populatePortType(PortType wsdl4jPortType,
+	private void populatePortType(PortType wsdl4jPortType,
                                   Definition portTypeWSDL) throws AxisFault {
         List wsdl4jOperations = wsdl4jPortType.getOperations();
 
@@ -2126,11 +2168,9 @@
                     if (originOfExtensibilityElements.equals(PORT)
                         || originOfExtensibilityElements.equals(BINDING)) {
                         if (Boolean.TRUE.equals(unknown.getRequired())) {
-                            axisService
-                                    .setWSAddressingFlag(AddressingConstants.ADDRESSING_REQUIRED);
+                        	AddressingHelper.setAddressingRequirementParemeterValue(axisService,
AddressingConstants.ADDRESSING_REQUIRED);
                         } else {
-                            axisService
-                                    .setWSAddressingFlag(AddressingConstants.ADDRESSING_OPTIONAL);
+                        	AddressingHelper.setAddressingRequirementParemeterValue(axisService,
AddressingConstants.ADDRESSING_OPTIONAL);
                         }
                     }
 



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


Mime
View raw message