You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2005/12/04 18:47:15 UTC

svn commit: r353878 - in /webservices/axis2/trunk/archive/java/scratch/sanka/src: ./ META-INF/ module/ module/META-INF/ module/org/ module/org/apache/ module/org/apache/axis2/ module/org/apache/axis2/metadata/ service/ service/META-INF/ service/org/ se...

Author: sanka
Date: Sun Dec  4 09:46:58 2005
New Revision: 353878

URL: http://svn.apache.org/viewcvs?rev=353878&view=rev
Log:
adding codebase of MetadataExchange module and MetadataExchange service for axis2

Added:
    webservices/axis2/trunk/archive/java/scratch/sanka/src/
    webservices/axis2/trunk/archive/java/scratch/sanka/src/META-INF/
    webservices/axis2/trunk/archive/java/scratch/sanka/src/META-INF/module.xml
    webservices/axis2/trunk/archive/java/scratch/sanka/src/META-INF/services.xml
    webservices/axis2/trunk/archive/java/scratch/sanka/src/module/
    webservices/axis2/trunk/archive/java/scratch/sanka/src/module/META-INF/
    webservices/axis2/trunk/archive/java/scratch/sanka/src/module/META-INF/module.xml
    webservices/axis2/trunk/archive/java/scratch/sanka/src/module/org/
    webservices/axis2/trunk/archive/java/scratch/sanka/src/module/org/apache/
    webservices/axis2/trunk/archive/java/scratch/sanka/src/module/org/apache/axis2/
    webservices/axis2/trunk/archive/java/scratch/sanka/src/module/org/apache/axis2/metadata/
    webservices/axis2/trunk/archive/java/scratch/sanka/src/module/org/apache/axis2/metadata/MetadataExchangeHandler.java
    webservices/axis2/trunk/archive/java/scratch/sanka/src/module/org/apache/axis2/metadata/MetadataExchangeModule.java
    webservices/axis2/trunk/archive/java/scratch/sanka/src/service/
    webservices/axis2/trunk/archive/java/scratch/sanka/src/service/META-INF/
    webservices/axis2/trunk/archive/java/scratch/sanka/src/service/META-INF/services.xml
    webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/
    webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/
    webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/
    webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/
    webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/Constants.java
    webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetaData.java
    webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataExchangeMessageReceiver.java
    webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataExchangeSkeleton.java
    webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataSection.java
    webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataUtil.java
    webservices/axis2/trunk/archive/java/scratch/sanka/src/test/
    webservices/axis2/trunk/archive/java/scratch/sanka/src/test/MetadataClient.java
    webservices/axis2/trunk/archive/java/scratch/sanka/src/test/MetadataServer.java

Added: webservices/axis2/trunk/archive/java/scratch/sanka/src/META-INF/module.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/sanka/src/META-INF/module.xml?rev=353878&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/sanka/src/META-INF/module.xml (added)
+++ webservices/axis2/trunk/archive/java/scratch/sanka/src/META-INF/module.xml Sun Dec  4 09:46:58 2005
@@ -0,0 +1,7 @@
+<module name="MetadataExchangeModule" class="com.wso2.tungsten.mex.MetadataExchangeModule">
+	<inflow>
+		<handler name="MetadataExchangeHandler" class="com.wso2.tungsten.mex.MetadataExchangeHandler">
+			<order phase="PreDispatch" phaseLast="true"/>
+        </handler>
+    </inflow>
+</module>
\ No newline at end of file

Added: webservices/axis2/trunk/archive/java/scratch/sanka/src/META-INF/services.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/sanka/src/META-INF/services.xml?rev=353878&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/sanka/src/META-INF/services.xml (added)
+++ webservices/axis2/trunk/archive/java/scratch/sanka/src/META-INF/services.xml Sun Dec  4 09:46:58 2005
@@ -0,0 +1,9 @@
+<service name="MEXService">
+    <description>
+        Provide services to obtain metadata for a specified service
+    </description>
+    <parameter name="ServiceClass" locked="false">com.wos2.tungsten.mex.MEXService</parameter>
+    <operation name="getMetaData">
+        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+    </operation>
+ </service>
\ No newline at end of file

Added: webservices/axis2/trunk/archive/java/scratch/sanka/src/module/META-INF/module.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/sanka/src/module/META-INF/module.xml?rev=353878&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/sanka/src/module/META-INF/module.xml (added)
+++ webservices/axis2/trunk/archive/java/scratch/sanka/src/module/META-INF/module.xml Sun Dec  4 09:46:58 2005
@@ -0,0 +1,7 @@
+<module name="MetadataExchangeModule" class="org.apache.axis2.metadata.MetadataExchangeModule">
+	<inflow>
+		<handler name="MetadataExchangeHandler" class="org.apache.axis2.metadata.MetadataExchangeHandler">
+			<order phase="PreDispatch" phaseLast="true"/>
+        </handler>
+    </inflow>
+</module>
\ No newline at end of file

Added: webservices/axis2/trunk/archive/java/scratch/sanka/src/module/org/apache/axis2/metadata/MetadataExchangeHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/sanka/src/module/org/apache/axis2/metadata/MetadataExchangeHandler.java?rev=353878&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/sanka/src/module/org/apache/axis2/metadata/MetadataExchangeHandler.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/sanka/src/module/org/apache/axis2/metadata/MetadataExchangeHandler.java Sun Dec  4 09:46:58 2005
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004,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.axis2.metadata;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.engine.Handler;
+import org.apache.axis2.handlers.AbstractHandler;
+
+/**
+ * @author Sanka Samaranayake (sanka@apache.org)
+ */
+public class MetadataExchangeHandler extends AbstractHandler implements Handler {
+    
+    public void invoke(MessageContext msgContext) throws AxisFault {
+        if (msgContext.getWSAAction() != null
+                && msgContext.getWSAAction().equals(
+                        "http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata/Request")) {
+            EndpointReference endpointReference = msgContext.getTo();
+            msgContext
+                    .setProperty("TargetEndpointReference", endpointReference);
+
+            String address = endpointReference.getAddress();
+            address = address.substring(0, address.lastIndexOf('/') + 1)
+                    + "MetadataExchange";
+
+            msgContext.setTo(new EndpointReference(address));
+        }
+    }
+
+}

Added: webservices/axis2/trunk/archive/java/scratch/sanka/src/module/org/apache/axis2/metadata/MetadataExchangeModule.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/sanka/src/module/org/apache/axis2/metadata/MetadataExchangeModule.java?rev=353878&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/sanka/src/module/org/apache/axis2/metadata/MetadataExchangeModule.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/sanka/src/module/org/apache/axis2/metadata/MetadataExchangeModule.java Sun Dec  4 09:46:58 2005
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2004,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.axis2.metadata;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.modules.Module;
+
+/**
+ * @author Sanka Samaranayake (sanka@apache.org)
+ */
+public class MetadataExchangeModule implements Module {
+
+    public void init(AxisConfiguration axisSystem) throws AxisFault {
+    }
+
+    public void shutdown(AxisConfiguration axisSystem) throws AxisFault {
+    }
+}

Added: webservices/axis2/trunk/archive/java/scratch/sanka/src/service/META-INF/services.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/sanka/src/service/META-INF/services.xml?rev=353878&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/sanka/src/service/META-INF/services.xml (added)
+++ webservices/axis2/trunk/archive/java/scratch/sanka/src/service/META-INF/services.xml Sun Dec  4 09:46:58 2005
@@ -0,0 +1,13 @@
+<!--Auto generated Axis Service XML-->
+<service name="MetadataExchange">
+<parameter locked="false" name="ServiceClass">org.apache.axis2.metadata.MetadataExchangeSkeleton</parameter>
+<!--Mounting the method Get-->
+<operation name="Get">
+<messageReceiver class="org.apache.axis2.metadata.MetadataExchangeMessageReceiver"/>
+</operation>
+<!--Mounting the method GetMetadata-->
+<operation name="GetMetadata">
+<parameter name="wsamapping" locked="xsd:false">http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata/Request</parameter>
+<messageReceiver class="org.apache.axis2.metadata.MetadataExchangeMessageReceiver"/>
+</operation>
+</service>

Added: webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/Constants.java?rev=353878&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/Constants.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/Constants.java Sun Dec  4 09:46:58 2005
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2004,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.axis2.metadata;
+
+/**
+ * @author Sanka Samaranayake (sanka@apache.org)
+ */
+public interface Constants {
+    
+    public final static String WSX_NAMESPACE_URI = "http://schemas.xmlsoap.org/ws/2004/09/mex";
+
+    public final static String WSX_DIALECT = "Dialect";
+
+    public final static String WSX_IDENTIFIER = "Identifier";
+    
+    public final static String WSX_METADATA = "Metadata";
+
+    public final static String WSX_METADATE_SECTION = "MetadataSection";
+
+    public final static String WSX_GETMETADATA = "GetMetadata";
+
+    public final static String WSX_PREFIX = "wsx";
+
+    public final static String DIALECT_URI_POLICY = "http://schemas.xmlsoap.org/ws/2004/09/policy";
+
+    public final static String DIALECT_URI_WSDL = "http://schemas.xmlsoap.org/wsdl/";;
+
+    public final static String DIALECT_URI_SCHEMA = "http://www.w3.org/2001/XMLSchema";
+}

Added: webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetaData.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetaData.java?rev=353878&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetaData.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetaData.java Sun Dec  4 09:46:58 2005
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2004,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.axis2.metadata;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+
+/**
+ * @author Sanka Samaranayake (sanka@apache.org)
+ */
+public class MetaData {
+    List sections = new ArrayList();
+
+    public List getSections() {
+        return sections;
+    }
+
+    public void addSection(MetadataSection section) {
+        sections.add(section);
+    }
+
+    public void setSections(List sections) {
+        this.sections = sections;
+    }
+
+    public OMElement getAsOMElement() {
+        OMFactory factory = OMAbstractFactory.getOMFactory();
+        OMElement metadataElement = factory.createOMElement(
+                Constants.WSX_METADATA, Constants.WSX_NAMESPACE_URI,
+                Constants.WSX_PREFIX);
+
+        Iterator iterator = getSections().iterator();
+        MetadataSection metadataSection;
+
+        while (iterator.hasNext()) {
+            metadataSection = (MetadataSection) iterator.next();
+            metadataElement.addChild(metadataSection.getAsOMElement());
+        }
+
+        return metadataElement;
+
+    }
+}

Added: webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataExchangeMessageReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataExchangeMessageReceiver.java?rev=353878&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataExchangeMessageReceiver.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataExchangeMessageReceiver.java Sun Dec  4 09:46:58 2005
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2004,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.axis2.metadata;
+import org.apache.axis2.receivers.RawXMLINOutMessageReceiver;
+
+/**
+ * @author Sanka Samaranayake (sanka@apache.org)
+ */
+public class MetadataExchangeMessageReceiver extends RawXMLINOutMessageReceiver {
+
+}

Added: webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataExchangeSkeleton.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataExchangeSkeleton.java?rev=353878&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataExchangeSkeleton.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataExchangeSkeleton.java Sun Dec  4 09:46:58 2005
@@ -0,0 +1,99 @@
+/**
+ * MetadataExchangeSkeleton.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: #axisVersion# #today#
+ */
+package org.apache.axis2.metadata;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.om.OMElement;
+
+/**
+ * MetadataExchangeSkeleton java skeleton for the axisService
+ */
+public class MetadataExchangeSkeleton {
+
+    private MessageContext messageContext;
+
+    public void init(MessageContext messageContext) {
+        this.messageContext = messageContext;
+    }
+
+    /**
+     * Auto generated method signature
+     * 
+     *  
+     */
+    public org.apache.axis2.om.OMElement Get() {
+        //Todo fill this with the necessary business logic
+        return null;
+    }
+
+    /**
+     * Auto generated method signature
+     * 
+     * @param param2
+     *  
+     */
+    public org.apache.axis2.om.OMElement GetMetadata(
+            org.apache.axis2.om.OMElement param2) throws AxisFault {
+        EndpointReference endpointReference = (EndpointReference) messageContext
+                .getProperty("TargetEndpointReference");
+
+        messageContext.setTo(endpointReference);
+
+        AxisConfiguration axisConfig = messageContext.getConfigurationContext()
+                .getAxisConfiguration();
+
+        String address = endpointReference.getAddress();
+        String serviceName = address.substring(address.lastIndexOf('/') + 1);
+        AxisService service = axisConfig.getService(serviceName);
+
+        if (!param2.getQName().equals(
+                new QName(Constants.WSX_NAMESPACE_URI,
+                        Constants.WSX_GETMETADATA))) {
+            
+            throw new RuntimeException("GetMetadata element must be present");
+        }
+
+        OMElement dialect = param2.getFirstChildWithName(new QName(
+                Constants.WSX_NAMESPACE_URI, Constants.WSX_DIALECT));
+
+        MetaData metaData = new MetaData();
+
+        if (dialect != null) {
+
+            OMElement identifier = param2.getFirstChildWithName(new QName(
+                    Constants.WSX_NAMESPACE_URI, Constants.WSX_IDENTIFIER));
+
+            MetadataSection section;
+
+            if (identifier != null) {
+                section = MetadataUtil.getMetadataSection(dialect.getText(),
+                        identifier.getText(), service);
+
+            } else {
+                section = MetadataUtil.getMetadataSection(dialect.getText(),
+                        service);
+            }
+
+            if (section != null && section.getElement() != null) {
+                metaData.addSection(section);
+            }
+
+        } else {
+
+            metaData.setSections(MetadataUtil.getAllMetadataSections(service));
+        }
+
+        return metaData.getAsOMElement();
+    }
+
+}

Added: webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataSection.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataSection.java?rev=353878&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataSection.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataSection.java Sun Dec  4 09:46:58 2005
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2004,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.axis2.metadata;
+
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMAttribute;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+
+/**
+ * @author Sanka Samaranayake (sanka@apache.org)
+ */
+public class MetadataSection {
+    String dialect = null;
+
+    String identifier = null;
+
+    OMElement value = null;
+    
+    public String getDialect() {
+        return dialect;
+    }
+    
+    public void setDialect(String dialect) {
+        this.dialect = dialect;
+    }
+    
+    public String getIdentifier() {
+        return identifier;
+    }
+    
+    public void setIdentifier(String identifier) {
+        this.identifier = identifier;
+    }
+
+    public OMElement getElement() {
+        return value;
+    }
+    
+    public void setElement(OMElement value) {
+        this.value = value;
+    }
+    
+    public OMElement getAsOMElement() {
+        OMFactory factory = OMAbstractFactory.getOMFactory();
+        OMElement metadataSectionElement = factory.createOMElement(Constants.WSX_METADATE_SECTION, Constants.WSX_NAMESPACE_URI, Constants.WSX_PREFIX);
+        
+        OMNamespace namespace = factory.createOMNamespace(Constants.WSX_NAMESPACE_URI, Constants.WSX_PREFIX);
+        OMAttribute dialectAttribute = factory.createOMAttribute(Constants.WSX_IDENTIFIER, namespace, getDialect());
+        metadataSectionElement.addAttribute(dialectAttribute);
+        
+        if (getIdentifier() != null) {
+            OMAttribute identifierAttri = factory.createOMAttribute(Constants.WSX_IDENTIFIER, namespace, getIdentifier());
+            metadataSectionElement.addAttribute(identifierAttri);
+        }
+        
+        if (getElement() != null) {
+            metadataSectionElement.addChild(getElement());
+        }
+        
+        return metadataSectionElement;
+    }
+}

Added: webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataUtil.java?rev=353878&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataUtil.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/sanka/src/service/org/apache/axis2/metadata/MetadataUtil.java Sun Dec  4 09:46:58 2005
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004,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.axis2.metadata;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Definition;
+
+import org.apache.axis2.description.AxisService;
+import org.apache.wsdl.WSDLDescription;
+
+/**
+ * @author Sanka Samaranayake (sanka@apache.org)
+ */
+public class MetadataUtil {
+   
+    public static MetadataSection getMetadataSection(String dialect,
+            AxisService service) {
+        return getMetadataSection(dialect, null, service);
+    }
+
+    public static MetadataSection getMetadataSection(String dialect,
+            String identifier, AxisService service) {
+        
+        MetadataSection section = new MetadataSection();
+        section.setDialect(dialect);
+        
+        if (identifier != null) {
+            section.setIdentifier(identifier);
+            
+            // at the moment we do not recongnize any identifiers .. :(
+            return section;            
+        }
+        
+        Definition description = service.getWSDLDefinition();
+
+        if (dialect.equals(Constants.DIALECT_URI_POLICY)) {
+            // TODO service.getPolicy(); ...
+            
+            
+            
+
+        } else if (dialect.equals(Constants.DIALECT_URI_WSDL)) {
+            // TODO service.getWSDL(); ...
+
+        } else if (dialect.equals(Constants.DIALECT_URI_SCHEMA)) {
+            // TODO service.getSchema
+
+        }
+        return section;
+    }
+
+    public static List getAllMetadataSections(AxisService service) {
+        ArrayList list =  new ArrayList();
+        
+        
+        
+        throw new UnsupportedOperationException();
+    }
+}

Added: webservices/axis2/trunk/archive/java/scratch/sanka/src/test/MetadataClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/sanka/src/test/MetadataClient.java?rev=353878&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/sanka/src/test/MetadataClient.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/sanka/src/test/MetadataClient.java Sun Dec  4 09:46:58 2005
@@ -0,0 +1,93 @@
+import java.io.FileInputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Call;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMFactory;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory;
+import org.apache.axis2.soap.SOAPBody;
+import org.apache.axis2.soap.SOAPEnvelope;
+
+/*
+ * Copyright 2004,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.
+ */
+
+/**
+ * @author Sanka Samaranayake (sanka@apache.org)
+ */
+public class MetadataClient {
+
+    public static void main(String[] args) {
+        try {
+
+            Call call = new Call();
+            Options options = new Options();
+            options.setTo(new EndpointReference(
+                    "http://localhost:6060/axis2/services/PingService"));
+            options.setAction("http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata/Request");
+            call.setClientOptions(options);
+   
+            SOAPEnvelope env = OMAbstractFactory.getSOAP11Factory()
+                    .getDefaultEnvelope();
+            SOAPBody body = env.getBody();
+
+            FileInputStream is = new FileInputStream(
+                    "/home/sanka/policy-docs/mexMsg.xml");
+            OMXMLParserWrapper wrapper = OMXMLBuilderFactory
+                    .createStAXOMBuilder(OMAbstractFactory.getOMFactory(),
+                            XMLInputFactory.newInstance()
+                                    .createXMLStreamReader(is));
+
+            body.addChild(wrapper.getDocumentElement());
+            
+            //            
+            //        PingPortStub stub = new PingPortStub(null,
+            // "http://localhost:8080/axis2/services/PingService");
+            //        
+//                    stub.setWsaAction("http://schemas.xmlsoap.org/ws/2004/09/mex/GetMetadata/Request");
+            //        stub.se
+            //        OMElement result = stub.Ping(getPingOMElement());
+            OMElement result = call.invokeBlocking("Ping", env);
+//            OMElement result = call.invokeBlocking("Ping", getPingOMElement());
+
+            result.serialize(XMLOutputFactory.newInstance()
+                    .createXMLStreamWriter(System.out));
+
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+
+    }
+
+    public static OMElement getPingOMElement() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace omNs = fac.createOMNamespace(
+                "http://example1.org/example1", "example1");
+        OMElement method = fac.createOMElement("Ping", omNs);
+        OMElement value = fac.createOMElement("Text", omNs);
+        value.addChild(fac.createText(value, "Axis2 Ping String "));
+        method.addChild(value);
+
+        return method;
+    }
+
+}

Added: webservices/axis2/trunk/archive/java/scratch/sanka/src/test/MetadataServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/archive/java/scratch/sanka/src/test/MetadataServer.java?rev=353878&view=auto
==============================================================================
--- webservices/axis2/trunk/archive/java/scratch/sanka/src/test/MetadataServer.java (added)
+++ webservices/axis2/trunk/archive/java/scratch/sanka/src/test/MetadataServer.java Sun Dec  4 09:46:58 2005
@@ -0,0 +1,31 @@
+
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+
+/*
+ * Copyright 2004,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.
+ */
+
+/**
+ * @author Sanka Samaranayake (sanka@apache.org)
+ */
+public class MetadataServer {
+
+    public static void main(String[] args) throws Exception {
+        SimpleHTTPServer server = new SimpleHTTPServer(
+                "/home/sanka/jakarta-tomcat-4.1.30/webapps/axis2/WEB-INF", 8080);
+        server.start();
+        System.out.println("MetadataServer is up and running ..");
+    }
+}