axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kei...@apache.org
Subject svn commit: r479563 - in /webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description: AxisBinding.java AxisBindingMessage.java AxisBindingOperation.java AxisService.java WSDL20ToAxisServiceBuilder.java WSDL2Constants.java
Date Mon, 27 Nov 2006 09:56:23 GMT
Author: keithc
Date: Mon Nov 27 01:56:22 2006
New Revision: 479563

URL: http://svn.apache.org/viewvc?view=rev&rev=479563
Log:
Modified WSDL20ToAxisServiceBuilder.java to populate the correct classes depending on bindings

Modified:
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
    webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisBinding.java?view=diff&rev=479563&r1=479562&r2=479563
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
(original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
Mon Nov 27 01:56:22 2006
@@ -27,14 +27,25 @@
 
 public class AxisBinding extends AxisDescription{
 
-    private String name;
+    private QName name;
 
     private String type;
 
     private Map options;
 
+    private Map faults;
+
+    public AxisBindingMessage getFault(String name) {
+        return (AxisBindingMessage)faults.get(name);
+    }
+
+    public void addFault(AxisBindingMessage fault) {
+        this.faults.put(fault.getName(),fault);
+    }
+
     public AxisBinding() {
         options = new HashMap();
+        faults = new HashMap();
     }
 
 
@@ -55,11 +66,11 @@
         return null;
     }
 
-    public String getName() {
+    public QName getName() {
         return name;
     }
 
-    public void setName(String name) {
+    public void setName(QName name) {
         this.name = name;
     }
 

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java?view=diff&rev=479563&r1=479562&r2=479563
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
(original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
Mon Nov 27 01:56:22 2006
@@ -27,11 +27,21 @@
 
 public class AxisBindingMessage extends AxisDescription{
 
+    private String name;
+
     private String direction;
 
     private Map options;
 
     private AxisMessage axisMessage;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
 
     public AxisMessage getAxisMessage() {
         return axisMessage;

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java?view=diff&rev=479563&r1=479562&r2=479563
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java
(original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java
Mon Nov 27 01:56:22 2006
@@ -29,6 +29,26 @@
 
     private AxisOperation axisOperation;
 
+    private QName name;
+
+    private Map faults;
+
+    public AxisBindingMessage getFault(String name) {
+        return (AxisBindingMessage)faults.get(name);
+    }
+
+    public void addFault(AxisBindingMessage fault) {
+        this.faults.put(fault.getName(),fault);
+    }
+
+    public QName getName() {
+        return name;
+    }
+
+    public void setName(QName name) {
+        this.name = name;
+    }
+
     public AxisOperation getAxisOperation() {
         return axisOperation;
     }
@@ -41,6 +61,7 @@
 
     public AxisBindingOperation() {
         options = new HashMap();
+        faults = new HashMap();
     }
 
 

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=479563&r1=479562&r2=479563
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisService.java
(original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/AxisService.java
Mon Nov 27 01:56:22 2006
@@ -72,6 +72,8 @@
  */
 public class AxisService extends AxisDescription {
 
+    private Map endpoitMap = new HashMap();
+
     private Map messageNameToOperationsMap = new HashMap();
 
     private int nsCount = 0;
@@ -189,6 +191,14 @@
     private String bindingName;
     // name of the port type used : use in codegeneration
     private String portTypeName;
+
+    public AxisEndpoint getEndpoit(String key) {
+        return (AxisEndpoint)endpoitMap.get(key);
+    }
+
+    public void addEndpoit(String key,AxisEndpoint axisEndpoint) {
+        this.endpoitMap.put(key,axisEndpoint);
+    }
 
     public String getWSAddressingFlag() {
         return wsaddressingFlag;

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java?view=diff&rev=479563&r1=479562&r2=479563
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
(original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
Mon Nov 27 01:56:22 2006
@@ -8,6 +8,7 @@
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.woden.*;
 import org.apache.woden.internal.DOMWSDLFactory;
+import org.apache.woden.internal.wsdl20.extensions.soap.SOAPBindingExtensionsImpl;
 import org.apache.woden.schema.Schema;
 import org.apache.woden.types.NCName;
 import org.apache.woden.wsdl20.*;
@@ -15,11 +16,8 @@
 import org.apache.woden.wsdl20.enumeration.MessageLabel;
 import org.apache.woden.wsdl20.extensions.ExtensionElement;
 import org.apache.woden.wsdl20.extensions.UnknownExtensionElement;
-import org.apache.woden.wsdl20.extensions.soap.SOAPBindingMessageReferenceExtensions;
-import org.apache.woden.wsdl20.extensions.soap.SOAPBindingOperationExtensions;
-import org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlock;
+import org.apache.woden.wsdl20.extensions.soap.*;
 import org.apache.woden.wsdl20.xml.*;
-import org.apache.woden.xml.XMLAttr;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.utils.NamespaceMap;
 import org.w3c.dom.Document;
@@ -70,6 +68,10 @@
     private boolean setupComplete = false;
     private Service wsdlService;
 
+//    As bindings are processed add it to this array so that we dont process the same binding
twice
+    private Map processedBindings;
+
+
     public WSDL20ToAxisServiceBuilder(InputStream in, QName serviceName,
                                       String interfaceName) {
         this.in = in;
@@ -161,8 +163,8 @@
 
                     // WSDL 2.0 spec requires that even the built-in schema should be returned
                     // once asked for schema definitions. But for data binding purposes we
can ignore that
-                    if (schemaDefinition != null && !Constants.URI_2001_SCHEMA_XSD.equals(schemaDefinition.getTargetNamespace()))
-                    {
+                    if (schemaDefinition != null && !Constants.URI_2001_SCHEMA_XSD
+                            .equals(schemaDefinition.getTargetNamespace())) {
                         axisService.addSchema(schemaDefinition);
                     }
                 }
@@ -170,24 +172,31 @@
 
             processService();
 
-            Endpoint [] endpoints = wsdlService.getEndpoints();
-
-            for (int i = 0; i < endpoints.length; i++)
-            {
-                processEndpoint(endpoints[i]);
-            }
+//            Binding binding = findBinding();
 
+//            processBinding(binding);
 
+            return axisService;
+        } catch (Exception e) {
+            throw new AxisFault(e);
+        }
+    }
 
-            Binding binding = findBinding();
+    private void processEndpoints() throws AxisFault {
+        Endpoint [] endpoints = wsdlService.getEndpoints();
 
+        if (endpoints == null) {
+            throw new AxisFault("No endpoints found in the WSDL");
+        }
 
-            processBinding(binding);
+        processedBindings = new HashMap();
 
-            return axisService;
-        } catch (Exception e) {
-            throw new AxisFault(e);
+        for (int i = 0; i < endpoints.length; i++) {
+            axisService
+                    .addEndpoit(endpoints[i].getName().toString(), processEndpoint(endpoints[i]));
         }
+
+
     }
 
     private void processService() throws AxisFault {
@@ -197,14 +206,26 @@
             throw new AxisFault("No wsdlService found in the WSDL");
         }
 
-        if (serviceName != null) {
-            wsdlService = services[0];
-        }
+        wsdlService = services[0];
+
+        processInterface(wsdlService.getInterface());
+
+        processEndpoints();
+
     }
 
-    private void processEndpoint(Endpoint endpoint){
+    private AxisEndpoint processEndpoint(Endpoint endpoint) throws AxisFault {
 
+        AxisEndpoint axisEndpoint = new AxisEndpoint();
+        axisEndpoint.setName(endpoint.getName().toString());
+        if (processedBindings.containsKey(endpoint.getBinding().getName())) {
+            axisEndpoint.setBinding(
+                    (AxisBinding) processedBindings.get(endpoint.getBinding().getName()));
+        } else {
+            axisEndpoint.setBinding(processBinding(endpoint.getBinding()));
+        }
 
+        return axisEndpoint;
 
     }
 
@@ -270,105 +291,265 @@
         }
     }
 
-    private void processBinding(Binding binding)
-            throws Exception {
-        if (binding != null) {
+    private AxisBinding processBinding(Binding binding)
+            throws AxisFault {
 
-            Interface serviceInterface;
 
-            if (wsdlService != null) {
-                serviceInterface = wsdlService.getInterface();
-            } else {
-                // we don't need this as wsdlService can not be null. But keeping for early
stages
-                serviceInterface = binding.getInterface();
-            }
+        Interface serviceInterface;
 
-            determineSOAPVersion(binding);
+        AxisBinding axisBinding = new AxisBinding();
 
-            processInterface(serviceInterface);
+        axisBinding.setType(binding.getType().toString());
 
-            BindingOperation[] bindingOperations = binding.getBindingOperations();
-            for (int i = 0; i < bindingOperations.length; i++) {
-                BindingOperation bindingOperation = bindingOperations[i];
+        axisBinding.setName(binding.getName());
 
-                AxisOperation operation = axisService.getOperation(bindingOperation.getInterfaceOperation().getName());
+        if (binding.getType().toString().equals(WSDL2Constants.URI_WSDL2_SOAP)) {
+            processSoapBindingExtention(binding, axisBinding);
+        } else {
+            //ToDo implement other bindings
+        }
 
-                BindingMessageReference[] bindingMessageReferences = bindingOperation.getBindingMessageReferences();
-                for (int j = 0; j < bindingMessageReferences.length; j++) {
-                    BindingMessageReference bindingMessageReference = bindingMessageReferences[j];
+        // We should process the interface based on the service not on a binding
 
-                    NCName messageLabel = bindingMessageReference.getInterfaceMessageReference().getMessageLabel();
-                    AxisMessage message = operation.getMessage(messageLabel.toString());
+//            if (wsdlService != null) {
+//                            serviceInterface = wsdlService.getInterface();
+//                        } else {
+//                            // we don't need this as wsdlService can not be null. But keeping
for early stages
+//                            serviceInterface = binding.getInterface();
+//                        }
+//
+//
+//
+//            processInterface(serviceInterface);
 
 
-                    SOAPBindingMessageReferenceExtensions soapHeaderExt = (SOAPBindingMessageReferenceExtensions)
bindingMessageReference.getComponentExtensionsForNamespace(new URI(WSDL2Constants.URI_WSDL2_SOAP));
+        processedBindings.put(binding.getName(), axisBinding);
+        return axisBinding;
+    }
 
-                    if (soapHeaderExt != null) {
-                        SOAPHeaderBlock[] soapHeaders = soapHeaderExt.getSoapHeaders();
+    private void processSoapBindingExtention(Binding binding, AxisBinding axisBinding)
+            throws AxisFault {
 
-                        for (int k = 0; k < soapHeaders.length; k++) {
-                            SOAPHeaderBlock soapHeader = soapHeaders[j];
+        // Capture all the binding specific properties
 
-                            ElementDeclaration elementDeclaration = soapHeader.getElementDeclaration();
+        SOAPBindingExtensionsImpl soapBindingExtensions = null;
+        try {
+            soapBindingExtensions = (SOAPBindingExtensionsImpl) binding
+                    .getComponentExtensionsForNamespace(new URI(WSDL2Constants.URI_WSDL2_SOAP));
+        } catch (URISyntaxException e) {
+            throw new AxisFault("Soap Binding Extention not found");
+        }
 
-                            if (elementDeclaration != null) {
-                                QName name = elementDeclaration.getName();
-                                SOAPHeaderMessage soapHeaderMessage = new SOAPHeaderMessage(name);
-                                soapHeaderMessage.setRequired(soapHeader.isRequired().booleanValue());
-                                message.addSoapHeader(soapHeaderMessage);
-                            }
-                        }
-                    }
+        String soapVersion;
 
-                }
+        if ((soapVersion = soapBindingExtensions.getSoapVersion()) != null)
 
+            if (soapVersion.equals(WSDL2Constants.SOAP_VERSION_1_1)) {
 
-                SOAPBindingOperationExtensions soapBindingExtension = ((SOAPBindingOperationExtensions)
-                        bindingOperation.getComponentExtensionsForNamespace(new URI(WSDL2Constants.URI_WSDL2_SOAP)));
-                String soapAction = soapBindingExtension.getSoapAction().toString();
+                // Might have to remove this as its a binding specific property
+                axisService.setSoapNsUri(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+                axisBinding.setProperty(WSDL2Constants.ATTR_WSOAP_VERSION,
+                        WSDL2Constants.SOAP_VERSION_1_1);
+            } else {
+                // Might have to remove this as its a binding specific property
+                axisService.setSoapNsUri(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+                axisBinding.setProperty(WSDL2Constants.ATTR_WSOAP_VERSION,
+                        WSDL2Constants.SOAP_VERSION_1_2);
+            }
+
+        URI soapUnderlyingProtocol = soapBindingExtensions.getSoapUnderlyingProtocol();
+        if (soapUnderlyingProtocol != null) {
+            axisBinding.setProperty(WSDL2Constants.ATTR_WSOAP_PROTOCOL,
+                    soapUnderlyingProtocol.toString());
+        }
+        URI soapMepDefault = soapBindingExtensions.getSoapMepDefault();
+        if (soapMepDefault != null)
+        {
+        axisBinding.setProperty(WSDL2Constants.ATTR_WSOAP_MEP,
+                soapMepDefault.toString());
+        }
+        axisBinding.setProperty(WSDL2Constants.ATTR_WHTTP_TRANSFER_CODING,
+                soapBindingExtensions.getHttpTransferCodingDefault());
+        axisBinding.setProperty(WSDL2Constants.ATTR_WSOAP_MODULE,
+                soapBindingExtensions.getSoapModules());
+
+        // Capture all the fault specific properties
+
+        BindingFault[] bindingFaults = binding.getBindingFaults();
+        for (int i = 0; i < bindingFaults.length; i++) {
+            BindingFault bindingFault = bindingFaults[i];
+            InterfaceFault interfaceFault = bindingFault.getInterfaceFault();
+
+            AxisBindingMessage axisBindingFault = new AxisBindingMessage();
+            axisBindingFault.setName(interfaceFault.getName().getLocalPart());
+            axisBindingFault.setParent(axisBinding);
+
+            SOAPBindingFaultExtensions soapBindingFaultExtensions = null;
+
+            try {
+                soapBindingFaultExtensions = (SOAPBindingFaultExtensions) bindingFault
+                        .getComponentExtensionsForNamespace(new URI(WSDL2Constants.URI_WSDL2_SOAP));
+            } catch (URISyntaxException e) {
+                throw new AxisFault("Soap Binding Extention not found");
+            }
+
+            axisBindingFault.setProperty(WSDL2Constants.ATTR_WHTTP_HEADER,
+                    soapBindingFaultExtensions.getHttpHeaders());
+            axisBindingFault.setProperty(WSDL2Constants.ATTR_WHTTP_TRANSFER_CODING,
+                    soapBindingFaultExtensions.getHttpTransferCoding());
+            axisBindingFault.setProperty(WSDL2Constants.ATTR_WSOAP_CODE,
+                    soapBindingFaultExtensions.getSoapFaultCode());
+            axisBindingFault.setProperty(WSDL2Constants.ATTR_WSOAP_SUBCODES,
+                    soapBindingFaultExtensions.getSoapFaultSubcodes());
+            axisBindingFault.setProperty(WSDL2Constants.ATTR_WSOAP_HEADER,
+                    soapBindingFaultExtensions.getSoapHeaders());
+            axisBindingFault.setProperty(WSDL2Constants.ATTR_WSOAP_MODULE,
+                    soapBindingFaultExtensions.getSoapModules());
+
+            axisBinding.addFault(axisBindingFault);
+
+        }
+
+        // Capture all the binding operation specific properties
+
+        BindingOperation[] bindingOperations = binding.getBindingOperations();
+        for (int i = 0; i < bindingOperations.length; i++) {
+            BindingOperation bindingOperation = bindingOperations[i];
+
+            AxisBindingOperation axisBindingOperation = new AxisBindingOperation();
+            AxisOperation axisOperation =
+                    axisService.getOperation(bindingOperation.getInterfaceOperation().getName());
+
+            axisBindingOperation.setAxisOperation(axisOperation);
+            axisBindingOperation.setParent(axisBinding);
+            axisBindingOperation.setName(axisOperation.getName());
+
+            SOAPBindingOperationExtensions soapBindingOperationExtensions = null;
+            try {
+                soapBindingOperationExtensions = ((SOAPBindingOperationExtensions)
+                        bindingOperation.getComponentExtensionsForNamespace(
+                                new URI(WSDL2Constants.URI_WSDL2_SOAP)));
+            } catch (URISyntaxException e) {
+                throw new AxisFault("Soap Binding Extention not found");
+            }
 
-                operation.setSoapAction(soapAction == null ? "" : soapAction);
+            URI soapAction = soapBindingOperationExtensions.getSoapAction();
+            if (soapAction != null)
+            {
+            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WSOAP_ACTION,
+                    soapAction.toString());
             }
-        }
-    }
+            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WSOAP_MODULE,
+                    soapBindingOperationExtensions.getSoapModules());
+            URI soapMep = soapBindingOperationExtensions.getSoapMep();
+            if (soapMep != null)
+            {
+            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WSOAP_MEP,
+                    soapMep.toString());
+            }
+            URI httpLocation = soapBindingOperationExtensions.getHttpLocation();
+            if (httpLocation != null)
+            {
+            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_LOCATION,
+                    httpLocation.toString());
+            }
+            axisBindingOperation.setProperty(WSDL2Constants.ATTR_WHTTP_TRANSFER_CODING,
+                    soapBindingOperationExtensions.getHttpTransferCodingDefault());
 
-    /**
-     * This method has a flaw in it which needs to be fixed.
-     * IIUC, the protocol URI should match with the soap version attribute. But I need to
confirm this.
-     * Basically the question is wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP
and
-     * version wsoap:version="1.1" are valid combinations or not. (Refer page 37 and 38 of
WSDL primer)
-     * <p/>
-     * UntiL I fixed it, just checking the version attribute.
-     *
-     * @param binding
-     * @throws URISyntaxException
-     */
-    private void determineSOAPVersion(Binding binding) throws URISyntaxException {
-        BindingElement bindingElement = binding.toElement();
 
-        boolean soapNSFound = false;
-        XMLAttr[] wsoapAttributes = bindingElement.getExtensionAttributesForNamespace(new
URI(WSDL2Constants.URI_WSDL2_SOAP));
 
-        for (int i = 0; i < wsoapAttributes.length; i++) {
-            XMLAttr wsoapAttribute = wsoapAttributes[i];
-            if (wsoapAttribute.getAttributeType().getLocalPart().equals(WSDL2Constants.ATTR_VERSION))
-            {
-                String soapVersion = wsoapAttribute.toExternalForm();
-                if ("1.1".equals(soapVersion)) {
-                    axisService.setSoapNsUri(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-                    soapNSFound = true;
+
+            BindingMessageReference[] bindingMessageReferences =
+                    bindingOperation.getBindingMessageReferences();
+            for (int j = 0; j < bindingMessageReferences.length; j++) {
+                BindingMessageReference bindingMessageReference = bindingMessageReferences[j];
+
+                AxisBindingMessage axisBindingMessage = new AxisBindingMessage();
+                axisBindingMessage.setParent(axisBindingOperation);
+
+                AxisMessage axisMessage = axisOperation.getMessage(bindingMessageReference
+                        .getInterfaceMessageReference().getMessageLabel().toString());
+
+                axisBindingMessage.setAxisMessage(axisMessage);
+                axisBindingMessage.setName(axisMessage.getName());
+                axisBindingMessage.setDirection(axisMessage.getDirection());
+
+
+                SOAPBindingMessageReferenceExtensions soapBindingMessageReferenceExtensions
= null;
+                try {
+                    soapBindingMessageReferenceExtensions =
+                            (SOAPBindingMessageReferenceExtensions) bindingMessageReference
+                                    .getComponentExtensionsForNamespace(
+                                            new URI(WSDL2Constants.URI_WSDL2_SOAP));
+                } catch (URISyntaxException e) {
+                    throw new AxisFault("Soap Binding Extention not found");
                 }
+
+                axisBindingMessage.setProperty(WSDL2Constants.ATTR_WHTTP_HEADER,
+                        soapBindingMessageReferenceExtensions.getHttpHeaders());
+                axisBindingMessage.setProperty(WSDL2Constants.ATTR_WHTTP_TRANSFER_CODING,
+                        soapBindingMessageReferenceExtensions.getHttpTransferCoding());
+                axisBindingMessage.setProperty(WSDL2Constants.ATTR_WSOAP_HEADER,
+                        soapBindingMessageReferenceExtensions.getSoapHeaders());
+                axisBindingMessage.setProperty(WSDL2Constants.ATTR_WSOAP_MODULE,
+                        soapBindingMessageReferenceExtensions.getSoapModules());
+
+//                    SOAPHeaderBlock[] soapHeaders = soapHeaderExt.getSoapHeaders();
+//
+//                        for (int k = 0; k < soapHeaders.length; k++) {
+//                            SOAPHeaderBlock soapHeader = soapHeaders[j];
+//
+//                            ElementDeclaration elementDeclaration = soapHeader.getElementDeclaration();
+//
+//                            if (elementDeclaration != null) {
+//                                QName name = elementDeclaration.getName();
+//                                SOAPHeaderMessage soapHeaderMessage = new SOAPHeaderMessage(name);
+//                                soapHeaderMessage.setRequired(soapHeader.isRequired().booleanValue());
+//                                message.addSoapHeader(soapHeaderMessage);
+//                            }
+//                        }
+
+                axisBindingOperation.addChild(axisBindingMessage.getName(),axisBindingMessage);
+
+
             }
-        }
 
-        if (!soapNSFound) {
-            axisService.setSoapNsUri(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
-        }
+            BindingFaultReference [] bindingFaultReferences =
+                    bindingOperation.getBindingFaultReferences();
+            for (int j = 0; j < bindingFaultReferences.length; j++) {
+                BindingFaultReference bindingFaultReference = bindingFaultReferences[j];
+
+                AxisBindingMessage axisBindingMessageFault = new AxisBindingMessage();
+                axisBindingMessageFault.setParent(axisBindingOperation);
+//                    AxisMessage axisFaultMessage = axisOperation.getMessage()
+                axisBindingMessageFault.setName(bindingFaultReference.getInterfaceFaultReference()
+                        .getInterfaceFault().getName().getLocalPart());
+
+                SOAPBindingFaultReferenceExtensions soapBindingFaultReferenceExtensions =
null;
+                try {
+                    soapBindingFaultReferenceExtensions =
+                            (SOAPBindingFaultReferenceExtensions) bindingFaultReference
+                                    .getComponentExtensionsForNamespace(
+                                            new URI(WSDL2Constants.URI_WSDL2_SOAP));
+                } catch (URISyntaxException e) {
+                    throw new AxisFault("Soap Binding Extention not found");
+                }
 
+                axisBindingMessageFault.setProperty(WSDL2Constants.ATTR_WSOAP_MODULE,
+                        soapBindingFaultReferenceExtensions.getSoapModules());
+
+                axisBindingOperation.addFault(axisBindingMessageFault);
+
+            }
+
+            axisBinding.addChild(axisBindingOperation.getName(),axisBindingOperation);
+
+
+        }
     }
 
     private void processInterface(Interface serviceInterface)
-            throws Exception {
+            throws AxisFault {
 
         // TODO @author Chathura copy the policy elements
         // copyExtensionAttributes(wsdl4jPortType.getExtensionAttributes(),
@@ -377,8 +558,7 @@
         InterfaceOperation[] interfaceOperations = serviceInterface
                 .getInterfaceOperations();
         for (int i = 0; i < interfaceOperations.length; i++) {
-            axisService.addOperation(populateOperations(interfaceOperations[i],
-                    description));
+            axisService.addOperation(populateOperations(interfaceOperations[i]));
         }
 
         Interface[] extendedInterfaces = serviceInterface.getExtendedInterfaces();
@@ -389,8 +569,7 @@
 
     }
 
-    private AxisOperation populateOperations(InterfaceOperation operation,
-                                             Description description) throws Exception {
+    private AxisOperation populateOperations(InterfaceOperation operation) throws AxisFault
{
         QName opName = operation.getName();
         // Copy Name Attribute
         AxisOperation axisOperation = axisService.getOperation(opName);
@@ -414,16 +593,20 @@
                 // Its an input message
 
                 if (isServerSide) {
-                    createAxisMessage(axisOperation, messageReference, WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+                    createAxisMessage(axisOperation, messageReference,
+                            WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                 } else {
-                    createAxisMessage(axisOperation, messageReference, WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+                    createAxisMessage(axisOperation, messageReference,
+                            WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                 }
             } else if (messageReference.getMessageLabel().equals(
                     MessageLabel.OUT)) {
                 if (isServerSide) {
-                    createAxisMessage(axisOperation, messageReference, WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+                    createAxisMessage(axisOperation, messageReference,
+                            WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                 } else {
-                    createAxisMessage(axisOperation, messageReference, WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+                    createAxisMessage(axisOperation, messageReference,
+                            WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                 }
             }
 
@@ -450,7 +633,9 @@
         return axisOperation;
     }
 
-    private void createAxisMessage(AxisOperation axisOperation, InterfaceMessageReference
messageReference, String messageLabel) throws Exception {
+    private void createAxisMessage(AxisOperation axisOperation,
+                                   InterfaceMessageReference messageReference, String messageLabel)
+            throws AxisFault {
         AxisMessage message = axisOperation
                 .getMessage(messageLabel);
 
@@ -467,7 +652,8 @@
             // TODO : Need to improve this
 //           elementQName = new QName("None");
         } else {
-            throw new Exception("Sorry we do not support " + messageContentModelName + ".
We do only support #any, #none and #element as message content models.");
+            throw new AxisFault("Sorry we do not support " + messageContentModelName +
+                    ". We do only support #any, #none and #element as message content models.");
         }
 
         message.setElementQName(elementQName);
@@ -476,7 +662,8 @@
 
         // populate this map so that this can be used in SOAPBody based dispatching
         if (elementQName != null) {
-            axisService.addmessageNameToOperationMapping(elementQName.getLocalPart(), axisOperation);
+            axisService
+                    .addmessageNameToOperationMapping(elementQName.getLocalPart(), axisOperation);
         }
     }
 
@@ -489,7 +676,8 @@
      * @param originOfExtensibilityElements
      */
     private void copyExtensibleElements(ExtensionElement[] extensionElement,
-                                        DescriptionElement descriptionElement, AxisDescription
description,
+                                        DescriptionElement descriptionElement,
+                                        AxisDescription description,
                                         String originOfExtensibilityElements) {
         for (int i = 0; i < extensionElement.length; i++) {
             ExtensionElement element = extensionElement[i];
@@ -585,7 +773,6 @@
     }
 
 
-
     private Binding findBinding() throws AxisFault {
         Service[] services = description.getServices();
         wsdlService = null;
@@ -713,7 +900,8 @@
                     .getInterfaceMessageReferenceElements();
 
             for (int i = 0; i < interfaceMessageReferenceElements.length; i++) {
-                InterfaceMessageReferenceElement interfaceMessageReferenceElement = interfaceMessageReferenceElements[i];
+                InterfaceMessageReferenceElement interfaceMessageReferenceElement =
+                        interfaceMessageReferenceElements[i];
                 String direction = interfaceMessageReferenceElement
                         .getDirection().toString();
                 messagesMap.put(interfaceMessageReferenceElement
@@ -731,7 +919,8 @@
                     .getInterfaceFaultReferenceElements();
 
             for (int i = 0; i < interfaceFaultReferenceElements.length; i++) {
-                InterfaceFaultReferenceElement interfaceFaultReferenceElement = interfaceFaultReferenceElements[i];
+                InterfaceFaultReferenceElement interfaceFaultReferenceElement =
+                        interfaceFaultReferenceElements[i];
                 String direction = interfaceFaultReferenceElement
                         .getDirection().toString();
                 messagesMap.put(interfaceFaultReferenceElement.getRef(),

Modified: webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java?view=diff&rev=479563&r1=479562&r2=479563
==============================================================================
--- webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java
(original)
+++ webservices/axis2/branches/java/WSDL_2_0/modules/kernel/src/org/apache/axis2/description/WSDL2Constants.java
Mon Nov 27 01:56:22 2006
@@ -49,8 +49,23 @@
     
     String URI_HTTP_SOAP12 = "http://www.w3.org/2003/05/soap/bindings/HTTP";
     String URI_HTTP_SOAP11 = "http://www.w3.org/2006/01/soap11/bindings/HTTP";
-    String ATTR_PROTOCOL = "protocol";
-    String ATTR_VERSION = "version";
+
+    String ATTR_WSOAP_PROTOCOL = "wsoap:protocol";
+    String ATTR_WSOAP_VERSION = "wsoap:version";
+    String ATTR_WSOAP_CODE = "wsoap:code";
+    String ATTR_WSOAP_MEP = "wsoap:mep";
+    String ATTR_WSOAP_MODULE = "wsoap:module";
+    String ATTR_WSOAP_SUBCODES = "wsoap:subcodes";
+    String ATTR_WSOAP_HEADER = "wsoap:header";
+    String ATTR_WSOAP_ACTION = "wsoap:action";
+
+    String ATTR_WHTTP_TRANSFER_CODING = "whttp:transferCoding";
+    String ATTR_WHTTP_LOCATION = "whttp:location";
+    String ATTR_WHTTP_HEADER = "whttp:header";
+
+    String SOAP_VERSION_1_1 = "1.1";
+    String SOAP_VERSION_1_2 = "1.2";
+
 
     String MESSAGE_LABEL_IN = "In";
     String MESSAGE_LABEL_OUT = "Out";



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