axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r415792 [2/3] - in /webservices/axis2/trunk/java: etc/ modules/jaxws/ modules/jaxws/src/javax/xml/ws/ modules/jaxws/src/javax/xml/ws/spi/ modules/jaxws/src/org/ modules/jaxws/src/org/apache/ modules/jaxws/src/org/apache/axis2/ modules/jaxws...
Date Tue, 20 Jun 2006 20:26:19 GMT
Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/DOMSourceParameter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/DOMSourceParameter.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/DOMSourceParameter.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/DOMSourceParameter.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.param;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Result;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.ws.WebServiceException;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.w3c.dom.Document;
+
+public class DOMSourceParameter extends SourceParameter {
+
+    public DOMSourceParameter() {
+        //do nothing
+    }
+    
+    public DOMSourceParameter(DOMSource value){
+		this.value = value;
+	}
+	
+	/**
+     * This is a temporary implementation to get around a bug
+     * in the Woodstox parser.
+	 */
+    public XMLStreamReader getValueAsStreamReader() {
+        if (value != null) {
+            try {
+                //TODO: This is not the correct way to do this and we
+                //should be able to use the method implemetation from the super class.
+                //There is a bug in the Woodstox parser that causes the super's impl to
+                //hang.  We need this to be able to support DOMSource until we have a
+                //fix for that bug.
+                ByteArrayOutputStream out = new ByteArrayOutputStream();
+                Result result = new StreamResult(out);
+                Transformer transformer =  TransformerFactory.newInstance().newTransformer();
+                transformer.transform(value, result);
+                
+                ByteArrayInputStream bytes = new ByteArrayInputStream(out.toByteArray());
+                XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(bytes);
+                return reader;
+            } catch (Exception e) {
+                //TODO: Add proper error handling
+                e.printStackTrace();
+            }            
+        }
+        else {
+            throw new WebServiceException("Cannot create XMLStreamReader from null value");
+        }
+        
+        return null;
+    }
+    
+	public OMElement toOMElement() {
+		try{
+	        StAXOMBuilder builder =
+	            new StAXOMBuilder(OMAbstractFactory.getOMFactory(), getValueAsStreamReader()); 
+			return builder.getDocumentElement();
+		}catch(Exception e){
+			throw new WebServiceException(e.getMessage());
+		}		
+	}
+
+	public void fromOM(OMElement omElement) {
+		if(omElement != null){
+            try{
+                ByteArrayOutputStream output = new ByteArrayOutputStream();
+                omElement.serialize(output);
+                InputStream input = new ByteArrayInputStream(output.toByteArray());
+                DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+                DocumentBuilder domBuilder = domFactory.newDocumentBuilder();
+                
+                Document domTree = domBuilder.parse(input);
+                value = new DOMSource(domTree);
+            }catch(Exception e){
+                throw new WebServiceException(e.getMessage());
+            }
+		}
+	}
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/JAXBParameter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/JAXBParameter.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/JAXBParameter.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/JAXBParameter.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,158 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.param;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.soap.SOAPEnvelope;
+
+/**
+ * Parameter implementation for JAX-B objects. *
+ */
+public class JAXBParameter implements Parameter {
+	
+    private Object value;
+    private JAXBContext context;
+    private Marshaller marshaller;
+    private Unmarshaller unmarshaller;
+	
+    public JAXBParameter() {}
+    
+    public JAXBParameter(Object value){
+		this.value = value;
+	}
+	
+	public Object getValue() {
+		return value;
+	}
+
+	public void setValue(Object o) {
+		value = o;
+	}
+    
+    public JAXBContext getJAXBContext() {
+        return context;
+    }
+    
+    public void setJAXBContext(JAXBContext ctx) {
+        context = ctx;
+    }
+    
+    public XMLStreamReader getValueAsStreamReader() {
+        createMarshaller();
+        
+        try {
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            marshaller.marshal(value, baos);
+            
+            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+            XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(bais);
+            return reader;
+        } catch (Exception e) {
+            //TODO: Add proper error handling
+            e.printStackTrace();
+        }
+        
+        return null;
+    }
+
+	public OMElement toOMElement() {
+        try {
+            StAXOMBuilder builder = new StAXOMBuilder(
+                    OMAbstractFactory.getOMFactory(),
+                    getValueAsStreamReader());
+            OMElement documentElement = builder.getDocumentElement();
+            return documentElement;
+        } catch (Exception e) {
+            //TODO: Add proper error handling
+            e.printStackTrace();
+        }
+		       
+        return null;
+	}
+
+	public void fromOM(OMElement omElement) {
+		createUnmarshaller();
+        
+        try {
+            ByteArrayInputStream bais = new ByteArrayInputStream(omElement.toString().getBytes());
+            value = unmarshaller.unmarshal(bais);
+            
+        } catch (JAXBException e) {
+            e.printStackTrace();
+        }
+	}
+
+	public SOAPEnvelope toEnvelope(Mode mode,String soapVersionURI) {
+	    return ParameterUtils.toEnvelope(mode, soapVersionURI, this);
+	}
+
+	public void fromEnvelope(Mode mode, SOAPEnvelope env) {
+		ParameterUtils.fromEnvelope(mode, env, this);
+	}
+    
+    /*
+     * Setup the Marshaller for serialization
+     */
+    private void createMarshaller() {
+        if (context != null) {
+            try {
+                marshaller = context.createMarshaller();
+                marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
+                
+            } catch (JAXBException e) {
+                throw new WebServiceException("Error creating Marshaller from JAXBContext");
+            }
+        }
+        else {
+            throw new WebServiceException("Cannot create Marshaller from null JAXBContext");
+        }
+    }
+    
+    /*
+     * Setup the Unmarshaller for deserialization  
+     */
+    private void createUnmarshaller() {
+        if (unmarshaller != null)
+            return;
+        
+        if (context != null) {
+            try {
+                unmarshaller = context.createUnmarshaller();
+            } catch (JAXBException e) {
+                throw new WebServiceException("Error creating Unmarshaller from JAXBContext");
+            }
+        }
+        else {
+            throw new WebServiceException("Cannot create Unmarshaller from null JAXBContext");
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/Parameter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/Parameter.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/Parameter.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/Parameter.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.param;
+
+
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.ws.Service.Mode;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPEnvelope;
+
+public interface Parameter {
+    
+    /**
+     * Returns the value object that is being handled by this Parameter
+     * instance.
+     */
+    public Object getValue();
+    
+    /**
+     * Sets a value object data for the Parameter instance.
+     */
+    public void setValue(Object o);
+    
+    /**
+     * Does the parameter specific processing necessary to wrap the value with an
+     * XMLStreamReader, and returns the newly created reader.
+     * 
+     * @return - An XMLStreamReader that walks the data of the value object.
+     */
+    public XMLStreamReader getValueAsStreamReader();
+    
+    /**
+     * Returns an OMElement representation of the value object that the Parameter
+     * class holds.  If no value has been set, an Exception will be thrown.
+     * 
+     * @return - An OMElement representation
+     */
+    public OMElement toOMElement();
+    
+    /**
+     * Converts the OMElement passed in to the appropriate value type and holds the value
+     * object data within the Parameter instance.
+     */
+    public void fromOM(OMElement omElement);
+    
+    /**
+     * TODO: Need to re-think this one.  Parameter should be a standalone thing and not tied
+     * to a SOAPEnvelope.
+     * 
+     * @param mode
+     * @param soapVersionURI
+     * @return
+     */
+    public SOAPEnvelope toEnvelope(Mode mode, String soapVersionURI);
+    
+    /**
+     * TODO: Need to re-think this one.  Parameter should be a standalone thing and not tied
+     * to a SOAPEnvelope.
+     *  
+     * @param mode
+     * @param env
+     */
+    public void fromEnvelope(Mode mode, SOAPEnvelope env);
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/ParameterFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/ParameterFactory.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/ParameterFactory.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/ParameterFactory.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.param;
+
+import java.util.HashMap;
+
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class ParameterFactory {
+    
+    private static HashMap<Class, Class> supportedSourceTypes;
+    //private static final Log log = LogFactory.getLog(ParameterFactory.class);
+    
+    static {
+        supportedSourceTypes = new HashMap<Class, Class>();
+        supportedSourceTypes.put(StreamSource.class, StreamSourceParameter.class);
+        supportedSourceTypes.put(DOMSource.class, DOMSourceParameter.class);
+        supportedSourceTypes.put(SAXSource.class, SAXSourceParameter.class);
+        supportedSourceTypes.put(Source.class, StreamSourceParameter.class);
+    }
+    
+    /**
+     * Creates a Parameter instance based on the class type of the 
+     * object passed in and then uses that object instance as the content
+     * 
+     * @param o
+     * @return
+     */
+    public static Parameter createParameter(Object o) {
+        Class c = o.getClass();
+        
+        //if (log.isDebugEnabled()) {
+        //    log.debug("Creating Parameter from existing object of type [" + c.getName() + "]");
+        //}
+        System.out.println(">> Creating Parameter from existing object of type [" + c.getName() + "]");
+        if (o instanceof String) {
+            return new StringParameter((String) o);
+        }
+        else if(o instanceof SOAPMessage){
+        	return new SOAPMessageParameter((SOAPMessage) o);
+        }
+        else if(Source.class.isAssignableFrom(c)) {
+            Parameter p = getSourceParameter(o.getClass());
+            p.setValue(o);
+            return p;
+        }
+        else {
+            JAXBParameter p = new JAXBParameter();
+            p.setValue(o);
+            return p;
+        }
+    }
+    
+    /**
+     * Creates a Parameter instance based on the class type
+     * 
+     * @param c
+     * @return
+     */
+    public static Parameter createParameter(Class c) {
+        //if (log.isDebugEnabled()) {
+        //    log.debug("Creating Parameter Class type [" + c.getName() + "]");
+        //}
+        System.out.println("Creating Parameter Class type [" + c.getName() + "]");
+        if (c == String.class) {
+            return new StringParameter();
+        }
+        else if(c == SOAPMessage.class) {
+            return new SOAPMessageParameter();
+        }
+        else if(Source.class.isAssignableFrom(c)) {
+            Parameter p = getSourceParameter(c);
+            return p;
+        }
+        else {
+            return new JAXBParameter();
+        }
+    }
+    
+    private static Parameter getSourceParameter(Class c) {
+        Parameter p = null;
+        Class<Parameter> paramClass = supportedSourceTypes.get(c);
+        
+        if (paramClass != null) {
+            try {
+                p = paramClass.newInstance();
+                System.out.println(">> New " + p.getClass().getName() + " created");
+                //if (log.isDebugEnabled()) {
+                //    log.debug("New " + p.getClass().getName() + " created");
+                //}
+                
+                return p;
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        
+        return p;
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/ParameterUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/ParameterUtils.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/ParameterUtils.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/ParameterUtils.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.param;
+
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
+import org.apache.axis2.jaxws.util.SoapUtils;
+
+
+public class ParameterUtils {
+
+    /**
+     * This utility method can be used to convert a single Parameter object into a 
+     * SOAP envelope.  
+     * 
+     * If the MODE is MESSAGE, it assumes that the parameter content
+     * has a valid SOAP envelope inside of it, with &lt;Envelope&gt; as root node. If not 
+     * then it will throw a WebServiceException.
+     * 
+     * If the MODE is PAYLOAD, then it builds a SOAPEnvelope representation and then sets
+     * the param content as the first child of the &lt;Body&gt; element.
+     * 
+     * @param mode - A flag that determines the scope of the content
+     * @param soapVersionURI - A String with the correct version of the SOAP URI
+     * @param param - The actual Parameter instance to be acted upon
+     * @return
+     */
+    public static SOAPEnvelope toEnvelope(Mode mode, String soapVersionURI, Parameter param) {
+        SOAPFactory soapfactory =  SoapUtils.getSoapFactory(soapVersionURI);
+        SOAPEnvelope env = null;
+        try{
+            if(mode !=null && mode.equals(Mode.MESSAGE)){   
+                StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(param.getValueAsStreamReader(),
+                        soapfactory, soapVersionURI);
+                return builder.getSOAPEnvelope();
+            }
+            else{
+                env = soapfactory.getDefaultEnvelope();
+                env.getHeader().detach();
+                SOAPBody body = env.getBody();
+                body.addChild(param.toOMElement());
+            }
+        }catch(Exception e){
+            throw new WebServiceException(e.getMessage());
+        }
+       return env;
+    }
+
+    /**
+     * This utility method creates a Parameter instance based on the data
+     * provided in the SOAPEnvelope.
+     * 
+     * If the MODE is MESSAGE, the Parameter that gets created will contain
+     * the entire SOAP envelope in whatever form was specified (String, Source, etc.)
+     * 
+     * If the MODE is PAYLOAD, then the Parameter created will be based on the 
+     * contents of the SOAP body.
+     * 
+     * @param mode
+     * @param env
+     */
+    public static void fromEnvelope(Mode mode, SOAPEnvelope env, Parameter param) {
+        if(env == null){
+            //add validation code here
+        }
+        
+        if(mode == null || mode.equals(Mode.PAYLOAD)){
+            OMElement om = env.getBody();
+            param.fromOM(om.getFirstElement());
+        }
+        else if(mode.equals(Mode.MESSAGE)){
+            param.fromOM(env);
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/SAXSourceParameter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/SAXSourceParameter.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/SAXSourceParameter.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/SAXSourceParameter.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.param;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.transform.sax.SAXSource;
+
+import org.apache.axiom.om.OMElement;
+import org.xml.sax.InputSource;
+
+public class SAXSourceParameter extends SourceParameter {
+
+    public SAXSourceParameter() {
+        //do nothing
+    }
+    
+    public SAXSourceParameter(SAXSource value){
+		this.value = value;
+	}
+	
+    public void fromOM(OMElement omElement) {
+		if(omElement != null){
+            ByteArrayOutputStream output = new ByteArrayOutputStream();
+            try{
+                omElement.serialize(output);
+            }catch(XMLStreamException e){
+                e.printStackTrace();
+            }
+            InputStream input = new ByteArrayInputStream(output.toByteArray());
+            InputSource inputSrc = new InputSource(input);
+            
+            value = new SAXSource(inputSrc);
+        }
+		
+	}
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/SOAPMessageParameter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/SOAPMessageParameter.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/SOAPMessageParameter.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/SOAPMessageParameter.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.param;
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.soap.SOAPEnvelope;
+
+public class SOAPMessageParameter implements Parameter {
+	private SOAPMessage value;
+	
+	public SOAPMessageParameter() {
+        //do nothing
+    }
+    
+    public SOAPMessageParameter(SOAPMessage value){
+		this.value = value;
+	}
+	public Object getValue() {
+		return value;
+	}
+
+	public void setValue(Object o) {
+		value = (SOAPMessage)o;
+	}
+
+    //TODO: This needs to be replaced by Rich's work with the SAAJ<->OM Converter
+	public XMLStreamReader getValueAsStreamReader() {
+        XMLStreamReader reader = null;
+        try {
+            String SoapContent = value.getSOAPPart().getEnvelope().getValue();
+            reader = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(SoapContent.getBytes()));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return reader;
+    }
+    
+    public OMElement toOMElement() {
+		try{
+		    StAXOMBuilder builder =
+	            new StAXOMBuilder(OMAbstractFactory.getOMFactory(), getValueAsStreamReader()); 
+	        return builder.getDocumentElement();
+		}catch(Exception e){
+			throw new WebServiceException(e.getMessage());
+		}
+	}
+
+	public void fromOM(OMElement omElement) {
+		try{
+			MessageFactory msgFactory = MessageFactory.newInstance();
+			
+			//Read OMelement and create SOAPMessage data
+			String soapContent = omElement.toString();
+			
+			SOAPMessage message = msgFactory.createMessage(null, new ByteArrayInputStream(soapContent.getBytes()));
+			value = message;
+		}catch(Exception e){
+			throw new WebServiceException(e.getMessage());
+		}
+	}
+
+    public SOAPEnvelope toEnvelope(Mode mode, String soapVersionURI) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	public void fromEnvelope(Mode mode, SOAPEnvelope env) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/SourceParameter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/SourceParameter.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/SourceParameter.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/SourceParameter.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.param;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.soap.SOAPEnvelope;
+
+public abstract class SourceParameter implements Parameter {
+
+    protected Source value;
+    
+    public Object getValue() {
+        return value;
+    }
+
+    public void setValue(Object o) {
+        Class c = o.getClass();
+        if (!Source.class.isAssignableFrom(c)) {
+            throw new WebServiceException("Unsupported Source parameter type: " + c.getName());
+        }
+        
+        value = (Source) o;        
+    }
+    
+    public abstract void fromOM(OMElement omElement);
+    
+    public OMElement toOMElement() {
+        try {
+            XMLStreamReader parser = XMLInputFactory.newInstance()
+                    .createXMLStreamReader(value);
+
+            StAXOMBuilder builder = new StAXOMBuilder(OMAbstractFactory
+                    .getOMFactory(), parser);
+
+            return builder.getDocumentElement();
+        } catch (Exception e) {
+            throw new WebServiceException(e);
+        }       
+    }
+    
+    public XMLStreamReader getValueAsStreamReader() {
+        if (value != null) {
+            try {
+                XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(value);
+                return reader;
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        else {
+            throw new WebServiceException("Cannot create XMLStreamReader from null value");
+        }
+        
+        return null;
+    }
+
+    public void fromEnvelope(Mode mode, SOAPEnvelope env) {
+        ParameterUtils.fromEnvelope(mode, env, this);
+    }
+
+    public SOAPEnvelope toEnvelope(Mode mode, String soapVersionURI) {
+        return ParameterUtils.toEnvelope(mode, soapVersionURI, this);
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/StreamSourceParameter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/StreamSourceParameter.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/StreamSourceParameter.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/StreamSourceParameter.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.param;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.axiom.om.OMElement;
+
+
+public class StreamSourceParameter extends SourceParameter {
+	
+    public StreamSourceParameter() {
+        //do nothing
+    }
+    
+    public StreamSourceParameter(StreamSource value){
+		this.value = value;
+	}
+
+	public void fromOM(OMElement omElement) {
+		if(omElement != null){
+            //Convert OM to Byte Array and ByteArray to SourceStream.
+            ByteArrayOutputStream output = new ByteArrayOutputStream();
+            try {
+                omElement.serialize(output);
+            } catch(XMLStreamException e) {
+                e.printStackTrace();
+            }
+            InputStream input = new ByteArrayInputStream(output.toByteArray());
+            value = new StreamSource(input);
+		}
+	}
+	
+    /*
+    public SOAPEnvelope toEnvelope(Mode mode, String soapVersionURI) {
+		SOAPFactory soapfactory =  SoapUtils.getSoapFactory(soapVersionURI);
+    	SOAPEnvelope env = null;
+    	try{
+    		if(mode !=null && mode.equals(Mode.MESSAGE)){	
+    			XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(value);
+        		StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(reader, soapfactory, soapVersionURI);
+    			return builder.getSOAPEnvelope();
+    		}
+    		else{
+    			env = soapfactory.getDefaultEnvelope();
+    			env.getHeader().detach();
+    			SOAPBody body = env.getBody();
+    			body.addChild(toOMElement());
+    		}
+    	}catch(Exception e){
+    		throw new WebServiceException(e.getMessage());
+    	}
+    	return env;
+	}
+    */
+
+	/*
+    public void fromEnvelope(Mode mode, SOAPEnvelope env) {
+		if(env == null){
+			//add validation code here
+		}
+		
+		if(mode == null || mode.equals(Mode.PAYLOAD)){
+			OMElement om = env.getBody();
+			fromOM(om.getFirstElement());
+			System.out.println("Mode is payload");
+		}
+		else if(mode.equals(Mode.MESSAGE)){
+			System.out.println("Mode is message");
+			fromOM(env);
+		}
+	}
+    */
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/StringParameter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/StringParameter.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/StringParameter.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/param/StringParameter.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,154 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.param;
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
+import org.apache.axis2.jaxws.util.SoapUtils;
+
+
+/*
+ * The StringParameter is a simple implementation of the Parameter
+ * interface for binding XML strings.
+ */
+public class StringParameter implements Parameter {
+    
+    private String value;
+    
+    public StringParameter() {
+        //do nothing
+    }
+    
+    public StringParameter(String s) {
+        this.value = s;
+    }
+    
+    /**
+     * @see Parameter#getValue()
+     */
+    public Object getValue() { 
+        return value;
+    }
+    
+    /**
+     * @see Parameter#setValue(Object)
+     */
+    public void setValue(Object v) {
+        this.value = (String) v;
+    }
+    
+    /**
+     * @see Parameter#getValueAsStreamReader()
+     */
+    public XMLStreamReader getValueAsStreamReader() {
+        if (value != null) {
+            try {
+                XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(
+                        new ByteArrayInputStream(value.getBytes()));
+                return reader;
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        else {
+            throw new WebServiceException("Cannot create XMLStreamReader from null value");
+        }
+        
+        return null;
+    }
+    
+    /**
+     * @see Parameter#toOMElement()
+     */
+    public OMElement toOMElement() {
+        try {
+            StAXOMBuilder builder =
+                new StAXOMBuilder(OMAbstractFactory.getOMFactory(), getValueAsStreamReader()); 
+            
+            OMElement documentElement = builder.getDocumentElement();
+            return documentElement;
+        } catch (Exception e) {
+        	throw new WebServiceException(e.getMessage());
+        }
+        
+    }
+    
+    /**
+     * @see Parameter#fromOM(OMElement)
+     */
+    public void fromOM(OMElement documentElement){
+    	this.value = documentElement.toString();
+    }
+
+    public SOAPEnvelope toEnvelope(Mode mode, String soapVersionURI) {
+		// TODO Auto-generated method stub
+    	SOAPFactory soapfactory =  SoapUtils.getSoapFactory(soapVersionURI);
+    	SOAPEnvelope env = null;
+    	try{
+    		if(mode !=null && mode.equals(Mode.MESSAGE)){	
+    			/* I am assuming that if the mode is message then param has a soap xml with
+    			 * Envelope as root node. If not then I will throw a webservice exception.
+    			 */
+    			XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(value.getBytes()));
+        		StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(reader, soapfactory, soapVersionURI);
+    			return builder.getSOAPEnvelope();
+    		}
+    		else{
+    			/* I am assuming that param is a plain xml string.
+    			 * This code is return just to cater to dispatch sync call where we are using
+    			 * serviceClient.
+    			 */
+    			env = soapfactory.getDefaultEnvelope();
+    			env.getHeader().detach();
+    			SOAPBody body = env.getBody();
+    			body.addChild(toOMElement());
+    		}
+    	}catch(Exception e){
+    		throw new WebServiceException(e.getMessage());
+    	}
+       return env;
+	}
+
+	public void fromEnvelope(Mode mode, SOAPEnvelope env) {
+		// TODO Auto-generated method stub
+		if(env == null){
+			//add validation code here
+		}
+		
+		if(mode == null || mode.equals(Mode.PAYLOAD)){
+			OMElement om = env.getBody();
+			fromOM(om.getFirstElement());
+		}
+		else if(mode.equals(Mode.MESSAGE)){
+			fromOM(env);
+		}
+		
+	}
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,189 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.server;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Source;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service.Mode;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.jaxws.param.Parameter;
+import org.apache.axis2.jaxws.param.ParameterFactory;
+import org.apache.axis2.util.Utils;
+
+
+/**
+ * The JAXWSMessageReceiver is the entry point, from the server's perspective,
+ * to the JAX-WS code.  This will be called by the Axis Engine and is the end
+ * of the chain from an Axis2 perspective.
+ */
+public class JAXWSMessageReceiver implements MessageReceiver {
+
+    private static String PARAM_SERVICE_CLASS = "ServiceClass";
+    
+    private String className;
+    private Class implClass;
+    private Provider endpointInstance;
+    private Class providerType = null;
+    
+    /**
+     * We should have already determined which AxisService we're targetting at
+     * this point.  So now, just get the service implementation and invoke
+     * the appropriate method.
+     */
+    public void receive(MessageContext reqMsgContext) throws AxisFault {
+        // Let's go ahead and create the MessageContext for the response and add
+        // it to the list.
+        MessageContext rspMsgContext = Utils.createOutMessageContext(reqMsgContext);
+        reqMsgContext.getOperationContext().addMessageContext(rspMsgContext);
+        
+        // Get the name of the service impl that was stored as a parameter
+        // inside of the services.xml.
+        AxisService service = reqMsgContext.getAxisService();
+        org.apache.axis2.description.Parameter svcClassParam = service.getParameter(PARAM_SERVICE_CLASS);
+        
+        // Create an instance of the Provider class that will be dispatched to.        
+        try {
+            if (svcClassParam != null) { 
+                className = ((String) svcClassParam.getValue()).trim();
+                implClass = Class.forName(className, true, service.getClassLoader());
+                endpointInstance = getProviderInstance();
+            }
+            else {
+                throw new RuntimeException("No service class was found for this AxisService");
+            }
+            
+            Parameter param = extractParam(reqMsgContext);
+            if (endpointInstance != null) {
+            	Class paramType = getProviderType();
+            	
+            	Object input = paramType.cast(param.getValue());
+            	
+            	/*
+            	 String input = (String) param.getValue();
+            	 System.out.println(">> invoking Provider with param [" + input + "]");
+                */
+            	
+                // TODO : Params will not always be Strings.  Add more code to 
+                // handle different param types and different numbers of params (not for
+                // Provider but for other endpoints)
+            	// Added more code to ensure we are handling all param types. NVT
+                Object response = endpointInstance.invoke(input);
+                
+                Parameter rspParam = ParameterFactory.createParameter(response);
+                SOAPEnvelope rspEnvelope = rspParam.toEnvelope(Mode.PAYLOAD, null);
+                rspMsgContext.setEnvelope(rspEnvelope);
+            }
+            
+            // Create the AxisEngine for the reponse and send it.
+            AxisEngine engine = new AxisEngine(rspMsgContext.getConfigurationContext());
+            engine.send(rspMsgContext);
+        } catch (Exception e) {
+        	//TODO: This temp code for alpha till we add fault processing on client code.
+        	Exception ex = new Exception("Server Side Exception :" +e.getMessage());
+            throw AxisFault.makeFault(ex);
+        } 
+        //Lets extract jax-ws parameter that we can use to create the response message context. 
+        
+        
+    }
+    
+    /**
+     * Given a MessageContext, get the contents out and turn them into a Parameter
+     * instance based on what the Provider expects.
+     * 
+     * @param msgContext
+     * @return
+     */
+    private Parameter extractParam(MessageContext msgContext) throws Exception{
+        SOAPEnvelope env = msgContext.getEnvelope();
+        SOAPBody body = env.getBody();
+        OMElement om = body.getFirstElement();
+        //Using Provider implClass and getting the Invoke method's parameter type, this will be the jax-ws parameter.
+        Class<?> clazz = getProviderType();  
+        Parameter param = ParameterFactory.createParameter(clazz);
+        param.fromOM(om);        
+        return param;
+    }
+    
+    private Class<?> getProviderType()throws Exception{
+    	if(providerType != null){
+    		return providerType;
+    	}
+    	
+    	Type[] giTypes = implClass.getGenericInterfaces();
+    	for(Type giType : giTypes){
+    		ParameterizedType paramType = null;
+    		try{
+    			paramType = (ParameterizedType)giType;
+    		}catch(ClassCastException e){
+    			throw new Exception("Provider based SEI Class has to implement javax.xml.ws.Provider as javax.xml.ws.Provider<String>, javax.xml.ws.Provider<SOAPMessage>, javax.xml.ws.Provider<Source> or javax.xml.ws.Provider<JAXBContext>");
+    		}
+    		Class interfaceName = (Class)paramType.getRawType();
+    		if(interfaceName == javax.xml.ws.Provider.class){
+    			if(paramType.getActualTypeArguments().length > 1){
+    				throw new Exception("Provider cannot have more than one Generic Types defined as Per JAX-WS Specification");
+    			}
+    			providerType = (Class)paramType.getActualTypeArguments()[0];
+    		}
+    	}
+        return providerType;
+    }
+    
+    private Provider getProviderInstance()throws Exception{
+    	Provider provider = null;
+    	Class<?> clazz =getProviderType();
+    	if(!isValidProviderType(clazz)){
+    		//TODO This will change once deployment code it in place
+    		throw new Exception("Invalid Provider Implementation, Only String, Source, SOAPMessage and JAXBContext Supported by JAX-WS ");
+    	}
+    	if(clazz == String.class){
+    		return (Provider<String>) implClass.newInstance();
+    	}
+    	if(clazz == Source.class){
+    		return (Provider<Source>) implClass.newInstance();
+    	}
+    	if(clazz == SOAPMessage.class){
+    		return (Provider<SOAPMessage>) implClass.newInstance();
+    	}
+    	/* TODO: Wait till we get SUN RI binary for JAXB
+    	if(clazz == JAXContext.class){
+    		return (Provider<JAXBContext>)implClass.newInstance();
+    	}
+    	*/
+    	return provider;
+    	
+    }
+    
+    private boolean isValidProviderType(Class clazz){
+    	
+    	return clazz == String.class || clazz == SOAPMessage.class || clazz == Source.class;
+    	//TODO: clazz == JAXBContext.class
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/Provider.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.spi;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Endpoint;
+import javax.xml.ws.spi.ServiceDelegate;
+
+
+public class Provider extends javax.xml.ws.spi.Provider {
+
+    @Override
+    public Endpoint createAndPublishEndpoint(String s, Object obj) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Endpoint createEndpoint(String s, Object obj) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public ServiceDelegate createServiceDelegate(URL url, QName qname, Class clazz){
+        return new org.apache.axis2.jaxws.spi.ServiceDelegate(url, qname, clazz);
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,310 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.spi;
+
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+
+import javax.wsdl.WSDLException;
+import javax.xml.bind.JAXBContext;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+import javax.xml.ws.handler.HandlerResolver;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.apache.axis2.jaxws.ClientMediator;
+import org.apache.axis2.jaxws.JAXWSClientContext;
+import org.apache.axis2.jaxws.handler.PortData;
+import org.apache.axis2.jaxws.handler.PortInfoImpl;
+import org.apache.axis2.jaxws.util.WSDL4JWrapper;
+import org.apache.axis2.jaxws.util.WSDLWrapper;
+
+public class ServiceDelegate extends javax.xml.ws.spi.ServiceDelegate {
+	private Executor executor;
+    private Map<QName, org.apache.axis2.jaxws.handler.PortData> ports;
+    private QName serviceQname;
+    private WSDLWrapper wsdl = null;
+    private URL wsdlLocation;
+    private ClientMediator mediator = null;
+    
+    public ServiceDelegate(URL url, QName qname, Class clazz) throws WebServiceException{
+    	super();
+    	this.wsdlLocation = url;
+    	this.serviceQname = qname;
+    	ports = new Hashtable<QName, PortData>();
+    	mediator = new ClientMediator();
+    	if(!isValidServiceName()){
+    		throw new WebServiceException("Invalid Service QName, Service Name cannot be null or empty");
+    	}
+    	
+    	if(isValidWSDLLocation()){
+    		try{
+    			setWSDLWrapper();
+    		}catch(WSDLException e){
+    			throw new WebServiceException(e.getMessage());
+    		}
+    		if(!isServiceDefined(serviceQname)){
+    			throw new WebServiceException("Service " +qname+ " not defined in WSDL");
+    			
+    		}
+    		readPorts();
+        }
+    }
+     
+    public void addPort(QName portName, String bindingId, String endpointAddress) throws WebServiceException{
+        // TODO Auto-generated method stub
+    	if(portName == null ){
+    		throw new WebServiceException("Invalid port, port cannot be null");
+    	}
+    	if("".equals(portName)){
+    		throw new WebServiceException("Invalid port name");
+    	}
+    	
+    	if(bindingId!=null && !bindingId.equals(SOAPBinding.SOAP11HTTP_BINDING)){
+    		throw new UnsupportedOperationException("Only SOAP11HTTP_BINDING supported at this time.");
+    	}
+    	if(!ports.containsKey(portName)){	
+    		PortData port = new PortInfoImpl(serviceQname, portName, bindingId, endpointAddress);
+    		ports.put(portName, port);
+    	}
+    	else{
+    		//TODO: Can same port have two different set of SOAPAddress
+    		/*PortInfoImpl port =(PortInfoImpl) ports.get(portName);
+    		port.setBindingID(bindingId);
+    		port.setEndPointAddress(endpointAddress);
+    		*/
+    		
+    		throw new WebServiceException("Port is already added");
+    	}
+    }
+    private <T> JAXWSClientContext<T> createClientContext(PortData portData, Class<T> clazz, Mode mode){
+    	JAXWSClientContext<T> clientContext = new JAXWSClientContext<T>();
+    	clientContext.setPort(portData);
+    	clientContext.setClazz(clazz);
+    	clientContext.setServiceMode(mode);
+    	clientContext.setWsdlContext(wsdl);
+    	try{
+    		clientContext.setWsdlContext(getWSDLWrapper());
+		}catch(WSDLException e){
+    		throw new WebServiceException(e.getMessage());
+    	}
+    	clientContext.setExecutor(this.getExecutor());	
+    	return clientContext;
+    }
+
+    public <T> Dispatch<T> createDispatch(QName qname, Class<T> clazz, Mode mode) throws WebServiceException {
+    	if(qname == null){
+    		throw new WebServiceException("Failed to create Dispatch port cannot be null.");
+    	}
+    	
+    	if(!isPortValid(qname)){
+    		throw new WebServiceException("Failed to create Dispatch, Port "+qname+" not found, add port to Service before calling dispatch.");
+    	}
+    	PortData portData = (PortData)ports.get(qname);
+    	if(portData == null){
+    		//Internal error 
+    	}
+    	
+    	addBinding(portData.getBindingID());
+    	
+    	JAXWSClientContext<T> clientContext = createClientContext(portData, clazz, mode);
+    	Dispatch<T> dispatch = mediator.createDispatch(clientContext);
+    	
+    	return dispatch;
+        
+    }
+    
+    public Dispatch<java.lang.Object> createDispatch(QName qname, JAXBContext context, Mode mode) {
+        if (qname == null) {
+            throw new WebServiceException("Failed to create Dispatch port cannot be null.");
+        }
+        
+        if (!isPortValid(qname)) {
+            throw new WebServiceException("Failed to create Dispatch, Port "+qname+" not found, add port to Service before calling dispatch.");
+        }
+        
+        PortData portData = (PortData) ports.get(qname);
+        
+        addBinding(portData.getBindingID());
+        
+        JAXWSClientContext clientCtx = createClientContext(portData, Object.class, mode);
+        clientCtx.setJAXBContext(context);
+        
+        Dispatch<Object> dispatch = mediator.createDispatch(clientCtx);
+        return dispatch;
+    }
+    
+    private Executor getDefaultExecutor(){
+    	return Executors.newFixedThreadPool(3);
+    }
+
+    public Executor getExecutor() {
+       if(this.executor == null){
+    	   this.executor = getDefaultExecutor();
+       }
+       
+        return this.executor;
+    }
+
+    public HandlerResolver getHandlerResolver() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public <T> T getPort(Class<T> sei) {
+        // TODO Auto-generated method stub
+    	if(sei == null){
+    		return null;
+    	}
+    	JAXWSClientContext<T> clientContext = new JAXWSClientContext<T>();
+    	//Set all the required properties for JAXWSClientContext.
+    	
+    	return mediator.createProxy(clientContext);
+    	
+    	
+    	/* TODO move this code to ClientMediators CreateProxy() 
+    	Class[] seiClazz = new Class[]{sei};
+    	Object proxyClass = Proxy.newProxyInstance(sei.getClassLoader(), seiClazz, proxyHandler);
+    	createAxisService();
+    	proxyHandler.setAxisService(axisService);
+    	proxyHandler.setServiceClient(serviceClient);
+    	*/
+    }
+     
+    @Override
+    public <T> T getPort(QName qname, Class<T> sei) {
+        // TODO Auto-generated method stub
+    	if(sei == null){
+    		return null;
+    	}
+    	
+    	JAXWSClientContext<T> clientContext = new JAXWSClientContext<T>();
+    	//Set all the required properties for JAXWSClientContext.
+    	
+    	return mediator.createProxy(clientContext);
+    	/*TODO move this code to ClientMediators CreateProxy() 
+    	this.portQname = qname;
+    	Proxies proxyHandler = new Proxies();
+    	Class[] seiClazz = new Class[]{sei};
+    	Object proxyClass = Proxy.newProxyInstance(sei.getClassLoader(), seiClazz, proxyHandler);
+    	createAxisService();
+    	proxyHandler.setAxisService(axisService);
+    	proxyHandler.setServiceClient(serviceClient);
+    	return sei.cast(proxyClass);
+    	*/
+      
+    }
+    
+    @Override
+    public Iterator<QName> getPorts() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+    
+    public QName getServiceName() {
+        // TODO Auto-generated method stub
+        return serviceQname;
+    }
+    
+    public URL getWSDLDocumentLocation() {
+        // TODO Auto-generated method stub
+        return wsdlLocation;
+    }
+    
+    private boolean isPortValid(QName portName){
+    	return ports!=null && ports.size() >0 && ports.containsKey(portName);
+    }
+
+    private boolean isValidServiceName(){
+    	return serviceQname != null && !"".equals(serviceQname.toString().trim());	
+    }
+
+    private boolean isValidWSDLLocation(){
+    	return wsdlLocation != null && !"".equals(wsdlLocation.toString().trim());
+    }
+    
+    private void readPorts(){
+    	String[] portNames = wsdl.getPorts(serviceQname);
+    	String targetNamespace = wsdl.getTargetNamespace();
+    	for(String portName: portNames){
+    		QName portQname = new QName(targetNamespace, portName);
+    		String address = wsdl.getSOAPAddress(serviceQname, portQname);
+    		//get Binding ID from WSDL and add it here.
+    		PortData portInfo = new PortInfoImpl(serviceQname, portQname, null, address);
+    		ports.put(portQname, portInfo);
+    	}
+    }
+    
+    public void setExecutor(Executor executor) {
+        // TODO Auto-generated method stub
+        this.executor = executor;
+        if(executor == null){
+        	this.executor = getDefaultExecutor();
+        	
+        }
+    }
+    
+    public void setHandlerResolver(HandlerResolver handlerresolver) {
+        // TODO Auto-generated method stub 
+    }
+    
+    private void setWSDLWrapper()throws WSDLException{
+	    if(isValidWSDLLocation()){
+			wsdl = new WSDL4JWrapper(wsdlLocation);
+		} 
+    }
+    
+    private WSDLWrapper getWSDLWrapper()throws WSDLException{
+    	if(this.wsdl!=null){
+    		return this.wsdl;
+    	}
+    	setWSDLWrapper();
+        
+    	return wsdl;
+    }
+    
+    private boolean isServiceDefined(QName serviceName){
+    	return wsdl.getService(serviceName)!=null;
+    }
+    
+    private void addBinding(String bindingId){
+//    	TODO: before creating binding do I have to do something with Handlers ... how is Binding related to Handler, this mistry sucks!!!
+        if(bindingId != null){
+	        //TODO: create all the bindings here
+	        if(bindingId.equals(SOAPBinding.SOAP11HTTP_BINDING)){
+	        	//instantiate soap11 binding implementation here and call setBinding in BindingProvider
+	        }
+	        
+	        if(bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING)){
+	        	//instantiate soap11 binding implementation here and call setBinding in BindingProvider
+	        }
+	        
+	        if(bindingId.equals(HTTPBinding.HTTP_BINDING)){
+	        	//instantiate http binding implementation here and call setBinding in BindingProvider
+	        }
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/AxisReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/AxisReceiver.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/AxisReceiver.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/AxisReceiver.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.util;
+
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.async.AsyncResult;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.jaxws.param.Parameter;
+
+
+public class AxisReceiver implements MessageReceiver {
+	private AsyncResult result = null;
+	private SOAPEnvelope envelope = null;
+	private Parameter param = null;
+	
+	boolean complete = false;
+	public AxisReceiver(Parameter param){
+		this.param = param;
+	}
+
+	public void receive(MessageContext messageCtx) throws AxisFault {  
+        result = new AsyncResult(messageCtx);
+        envelope = result.getResponseEnvelope();
+        this.complete = true;
+        System.out.println("Receiver Called");      
+        
+    }
+	
+	public boolean isdone(){
+		return complete;
+	}
+	
+	public AsyncResult getResponseResult(){
+		return result;
+	}
+	
+	public SOAPEnvelope getResponseEnvelope(){
+		return envelope;
+	}
+	
+	public Object getObject(){
+		param.fromOM(getElement());
+		return param.getValue();
+	}
+	
+	public Object getObject(Parameter param){
+		param.fromOM(getElement());
+		return param.getValue();
+	}
+	
+	private OMElement getElement(){
+    	XMLStreamReader parser = envelope.getXMLStreamReader();
+    	StAXOMBuilder builder =
+            new StAXOMBuilder(OMAbstractFactory.getOMFactory(), parser); 
+        return builder.getDocumentElement();
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/Constants.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/Constants.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/Constants.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.util;
+
+import javax.xml.namespace.QName;
+
+public class Constants {
+    public static final String URI_WSDL_SOAP11 = "http://schemas.xmlsoap.org/wsdl/soap/";
+    public static final String URI_WSDL_SOAP12 = "http://schemas.xmlsoap.org/wsdl/soap12/";
+    public static final String URI_WSDL_SOAP11_BODY = "http://schemas.xmlsoap.org/wsdl/soap/";
+    public static final String URI_WSDL_SOAP12_BODY ="http://schemas.xmlsoap.org/wsdl/soap12/";
+    public static final String URI_WSDL_SOAP11_HEADER = "http://schemas.xmlsoap.org/wsdl/soap/";
+    public static final String URI_WSDL_SOAP12_HEADER = "http://schemas.xmlsoap.org/wsdl/soap12/";
+    public static final String URI_WSDL_SOAP11_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/";
+    public static final String URI_WSDL_SOAP12_BINDING ="http://schemas.xmlsoap.org/wsdl/soap12/";
+
+    public static final String POLICY = "http://schemas.xmlsoap.org/ws/2004/09/policy";
+    public static final String POLICY_REFERENCE = "http://schemas.xmlsoap.org/ws/2004/09/policy";
+    
+    public static final String SCHEMA = "http://www.w3.org/2001/XMLSchema";
+    
+    public static final String AXIS2_REPO_PATH = "com.ibm.websphere.webservices.axis2.repo.path";
+    public static final String AXIS2_CONFIG_PATH = "com.ibm.websphere.webservices.axis2.config.path";
+    public static final String USE_ASYNC_MEP = "com.ibm.websphere.webservices.use.async.mep";
+    
+    public static final String QOS_WSADDRESSING_ENABLE = "com.ibm.websphere.webservices.qos.wsaddressing.enable";
+    public static final String QOS_WSRM_ENABLE = "com.ibm.websphere.webservices.qos.wsrm.enable";
+    
+    public static final QName QNAME_WSADDRESSING_MODULE = new QName("", "addressing");
+    public static final QName QNAME_WSRM_MODULE = new QName("", "sandesha2");
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/SimpleServer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/SimpleServer.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/SimpleServer.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/SimpleServer.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.util;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+
+
+
+public class SimpleServer {
+
+    private static SimpleHTTPServer server;
+    private String repositoryDir;
+    private int port = 8080;
+    
+	public void init() {
+        repositoryDir = System.getProperty("build.repository");
+        System.out.println(">> repositoryDir = " + repositoryDir);
+        
+        String axis2xml = System.getProperty("axis2.config");
+        System.out.println(">> axis2.xml     = " + axis2xml);
+        
+        try {
+            ConfigurationContext config = ConfigurationContextFactory.createConfigurationContextFromFileSystem(
+                    repositoryDir, axis2xml);
+            server = new SimpleHTTPServer(config, port);
+        } catch (AxisFault e) {
+            e.printStackTrace();
+        }
+    }
+    
+    public void start() {
+        System.out.println("------------ starting server ---------------");
+        init();
+        if (server != null) {
+            try {
+                server.start();
+            } catch (AxisFault e) {
+                e.printStackTrace();
+            }
+        }
+        System.out.println("------------------ done --------------------");
+    }
+    
+    public void stop() {
+        System.out.println("------------ stopping server ---------------");
+        if (server != null) {
+            server.stop();
+        }
+        System.out.println("------------------ done --------------------");
+    }
+    
+    public static void main(String[] args) throws Exception {
+        org.apache.log4j.BasicConfigurator.configure();
+        SimpleServer server = new SimpleServer();
+        server.start();
+	}
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/SoapUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/SoapUtils.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/SoapUtils.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/SoapUtils.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.util;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+
+public class SoapUtils {
+	
+	
+	public static OMElement getOMElement(SOAPEnvelope response){
+    	XMLStreamReader parser = response.getXMLStreamReader();
+    	
+    	StAXOMBuilder builder =
+            new StAXOMBuilder(OMAbstractFactory.getOMFactory(), parser); 
+        
+        return builder.getDocumentElement();
+    	
+    }
+	
+	public static SOAPFactory getSoapFactory(String soapVersionURI){
+        if("http://www.w3.org/2003/05/soap-envelope".equals(soapVersionURI))
+            return OMAbstractFactory.getSOAP12Factory();
+        else
+            return OMAbstractFactory.getSOAP11Factory();
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,275 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.util;
+
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+
+
+public class WSDL4JWrapper implements WSDLWrapper {
+    
+	private Definition wsdlDefinition = null;
+	private URL wsdlURL;
+	
+    public WSDL4JWrapper(URL wsdlURL)throws WSDLException{
+		super();
+		this.wsdlURL = wsdlURL;
+		WSDLFactory factory = WSDLFactory.newInstance();
+		WSDLReader reader = factory.newWSDLReader();
+		wsdlDefinition = reader.readWSDL(wsdlURL.toString());
+		
+	}
+	//TODO: Perform validations for each method to check for null parameters on QName.
+	
+	public Definition getDefinition(){
+		return wsdlDefinition;
+	}
+
+	
+	public Binding getFirstPortBinding(QName serviceQname) {
+		// TODO Auto-generated method stub
+		Service service = getService(serviceQname);
+		if(service == null){
+			return null;
+		}
+		Map map = getService(serviceQname).getPorts();
+		if(map == null || map.isEmpty() ){
+    		return null;
+    	}
+    	for(Object listObject : map.values()){
+    		Port wsdlPort = (Port)listObject;
+    		return wsdlPort.getBinding();
+    		
+    	}
+    	return null;
+		
+	}
+	
+	public String getOperationName(QName serviceQname, QName portQname){
+		Port port = getPort(serviceQname, portQname);
+		Binding binding = port.getBinding();
+		if(binding==null){
+			return null;
+		}
+		
+		List operations = binding.getBindingOperations();
+		for(Object opObj : operations){
+			BindingOperation operation = (BindingOperation)opObj;
+			return operation.getName();
+		}
+		return null;
+	}
+
+	private Port getPort(QName serviceQname, QName eprQname){
+		Service service = getService(serviceQname);
+		if(service == null){
+			return null;
+		}
+		return service.getPort(eprQname.getLocalPart());
+		
+	}
+	
+	public  ArrayList getPortBinding(QName serviceQname) {
+		// TODO Auto-generated method stub
+		Map map = this.getService(serviceQname).getPorts();
+    	if(map == null || map.isEmpty() ){
+    		return null;
+    	}
+    	ArrayList<Binding> portBindings = new ArrayList<Binding>();
+    	for(Object listObject : map.values()){
+    		Port wsdlPort = (Port)listObject;
+    		Binding binding = wsdlPort.getBinding();
+    		if(binding !=null){
+    			portBindings.add(binding);
+    		}
+    	
+    	}
+    	return portBindings;
+		
+	}
+
+	public String getPortBinding(QName serviceQname, QName portQname){
+		Port port = getPort(serviceQname, portQname);
+		if(port == null){
+			return null;
+		}
+		Binding binding = port.getBinding();
+		return binding.getQName().getLocalPart();
+	}
+	
+	public String[] getPorts(QName serviceQname){
+		String[] portNames = null;
+		Service service = this.getService(serviceQname);
+		if(service == null){
+			return null;
+		}
+		Map map = service.getPorts();
+		if(map == null || map.isEmpty()){
+			return null;
+		}
+		portNames = new String[map.values().size()];
+		Iterator iter = map.values().iterator();
+		for(int i=0; iter.hasNext(); i++){
+			Port wsdlPort = (Port)iter.next();
+			if(wsdlPort!=null){
+				portNames[i] = wsdlPort.getName();
+			}
+		}
+		return portNames;
+	}
+	
+	public Service getService(QName serviceQname) {
+		// TODO Auto-generated method stub
+		if(serviceQname == null){
+			return null;
+		}
+		return wsdlDefinition.getService(serviceQname);
+		
+	}
+	
+	public String getSOAPAction(QName serviceQname) {
+		// TODO Auto-generated method stub
+		Binding binding = getFirstPortBinding(serviceQname);
+		if(binding==null){
+			return null;
+		}
+		List operations = binding.getBindingOperations();
+		for(Object opObj : operations){
+			BindingOperation operation = (BindingOperation)opObj;
+			List exElements =operation.getExtensibilityElements();
+			for(Object elObj:exElements){
+				ExtensibilityElement exElement = (ExtensibilityElement)elObj;
+				if(isSoapOperation(exElement)){
+					SOAPOperation soapOperation = (SOAPOperation)exElement;
+					return soapOperation.getSoapActionURI();
+				}
+			}
+		}
+		return null;
+	}
+	
+	public String getSOAPAction(QName serviceQname, QName portQname) {
+		// TODO Auto-generated method stub
+		Port port = getPort(serviceQname, portQname);
+		if(port == null){
+			return null;
+		}
+		Binding binding = port.getBinding();
+		if(binding==null){
+			return null;
+		}
+		List operations = binding.getBindingOperations();
+		for(Object opObj : operations){
+			BindingOperation operation = (BindingOperation)opObj;
+			List exElements =operation.getExtensibilityElements();
+			for(Object elObj:exElements){
+				ExtensibilityElement exElement = (ExtensibilityElement)elObj;
+				if(isSoapOperation(exElement)){
+					SOAPOperation soapOperation = (SOAPOperation)exElement;
+						return soapOperation.getSoapActionURI();
+				}
+			}
+		}
+		return null;
+	}
+
+	public String getSOAPAction(QName serviceQname, QName portQname, QName operationQname) {
+		Port port = getPort(serviceQname, portQname);
+		if(port == null){
+			return null;
+		}
+		Binding binding = port.getBinding();
+		if(binding==null){
+			return null;
+		}
+		List operations = binding.getBindingOperations();
+		if(operations == null){
+			return null;
+		}
+		BindingOperation operation = null;
+		for(Object opObj : operations){
+			operation = (BindingOperation)opObj;
+		}
+		List exElements =operation.getExtensibilityElements();
+		for(Object elObj:exElements){
+			ExtensibilityElement exElement = (ExtensibilityElement)elObj;
+			if(isSoapOperation(exElement)){
+				SOAPOperation soapOperation = (SOAPOperation)exElement;
+				if(soapOperation.getElementType().equals(operationQname)){
+					return soapOperation.getSoapActionURI();
+				}
+			}
+		}
+		
+		return null;
+	}
+	public String getSOAPAddress(QName serviceQname, QName eprQname) {
+		// TODO Auto-generated method stub
+		List list =getPort(serviceQname, eprQname).getExtensibilityElements();
+		for(Object obj : list){
+			ExtensibilityElement element = (ExtensibilityElement)obj;
+			if(isSoapAddress(element)){
+				SOAPAddress address = (SOAPAddress)element;
+				return address.getLocationURI();
+			}
+		}
+		
+		return null;
+	}
+	
+	
+	
+	public URL getWSLDLocation() {
+		// TODO Auto-generated method stub
+		return this.wsdlURL;
+	}
+	private boolean isSoapAddress(ExtensibilityElement exElement){
+		return WSDLWrapper.SOAP_11_ADDRESS.equals(exElement.getElementType()); 
+		//TODO: Add soap12 support later
+		//|| WSDLWrapper.SOAP_12_ADDRESS.equals(exElement.getElementType());
+	}
+	
+	private boolean isSoapOperation(ExtensibilityElement exElement){
+		return WSDLWrapper.SOAP_11_OPERATION.equals(exElement.getElementType()); 
+		//TODO: Add Soap12 support later
+		// || WSDLWrapper.SOAP_12_OPERATION.equals(exElement.getElementType());
+	}
+	public String getTargetNamespace() {
+		// TODO Auto-generated method stub
+		return wsdlDefinition.getTargetNamespace();
+	}
+	
+}

Added: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDLWrapper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDLWrapper.java?rev=415792&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDLWrapper.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/util/WSDLWrapper.java Tue Jun 20 13:26:16 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.jaxws.util;
+
+
+import java.net.URL;
+import java.util.ArrayList;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+
+public interface WSDLWrapper {
+    public static final QName POLICY = new QName(Constants.POLICY, "Policy");
+    public static final QName POLICY_REFERENCE = new QName(Constants.POLICY_REFERENCE, "PolicyReference");
+    public static final QName SCHEMA = new QName(Constants.SCHEMA, "schema");
+    public static final QName SOAP_11_ADDRESS = new QName(Constants.URI_WSDL_SOAP11, "address");
+    public static final QName SOAP_11_BINDING = new QName(Constants.URI_WSDL_SOAP11_BINDING, "binding");
+    public static final QName SOAP_11_BODY = new QName(Constants.URI_WSDL_SOAP11_BODY, "body");
+    public static final QName SOAP_11_HEADER = new QName(Constants.URI_WSDL_SOAP11_HEADER, "header");
+    public static final QName SOAP_11_OPERATION = new QName(Constants.URI_WSDL_SOAP11, "operation");
+    public static final QName SOAP_12_ADDRESS = new QName(Constants.URI_WSDL_SOAP12, "address");
+    public static final QName SOAP_12_BINDING = new QName(Constants.URI_WSDL_SOAP12_BINDING, "binding");
+    public static final QName SOAP_12_BODY = new QName(Constants.URI_WSDL_SOAP12_BODY, "body");
+    public static final QName SOAP_12_HEADER = new QName(Constants.URI_WSDL_SOAP12_HEADER, "header");
+    public static final QName SOAP_12_OPERATION = new QName(Constants.URI_WSDL_SOAP11, "operation");
+    
+	public Object getFirstPortBinding(QName serviceQname);
+	public String getOperationName(QName serviceQname, QName portQname);
+	public ArrayList getPortBinding(QName serviceQname);
+	public String getPortBinding(QName serviceQname, QName portQname);
+	public String[] getPorts(QName serviceQname);
+	public Object getService(QName serviceQname);
+	public String getSOAPAction(QName serviceQname);
+	public String getSOAPAction(QName serviceQname, QName portQname);
+	public String getSOAPAction(QName serviceQname, QName portQName, QName operationQname);
+	public String getSOAPAddress(QName serviceQname, QName portQname);
+	public URL getWSLDLocation();
+	public String getTargetNamespace();
+	public Definition getDefinition();
+}



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