axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ven...@apache.org
Subject svn commit: r179794 [2/2] - in /webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj: src/javax/xml/ src/org/apache/ src/org/apache/axis/ src/org/apache/axis/saaj/ src/org/apache/axis/util/ test/org/ test/org/apache/ test/org/apache/axis/ test/org/apache/axis/saaj/
Date Fri, 03 Jun 2005 14:08:13 GMT
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPEnvelopeImpl.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPEnvelopeImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPEnvelopeImpl.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,190 @@
+/*
+ * Created on Mar 16, 2005
+ *
+ */
+package org.apache.axis.saaj;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+
+import org.apache.axis.soap.SOAPFactory;
+import org.apache.axis.om.OMAbstractFactory;
+
+
+/**
+ * Class SOAPEnvelopeImpl
+ * 
+ * @author Jayachandra
+ * jayachandra@gmail.com
+ */
+public class SOAPEnvelopeImpl extends SOAPElementImpl implements SOAPEnvelope {
+
+	/**
+	 * Field soSOAPEnvelope
+	 * A data member of OM's SOAPEnvelopeImpl which would be used for delegation of any work to underlying OM.
+	 */
+	private org.apache.axis.soap.SOAPEnvelope omSOAPEnvelope;
+	
+	/**
+	 * Constructor SOAPEnvelopeImpl
+	 */
+	public SOAPEnvelopeImpl(){
+		//super(omEnv);
+		SOAPFactory fac = OMAbstractFactory.getDefaultSOAPFactory();
+		omNode = omElement =omSOAPEnvelope = fac.getDefaultEnvelope();
+	}
+	
+	public SOAPEnvelopeImpl(org.apache.axis.soap.SOAPEnvelope omEnvelope){
+		super(omEnvelope);
+		this.omSOAPEnvelope = omEnvelope;
+	}
+	
+	/**
+	 * method getOMEnvelope
+	 * @return
+	 */
+	public org.apache.axis.soap.SOAPEnvelope getOMEnvelope(){
+		return omSOAPEnvelope;
+	}
+	
+
+	/**
+	 * method createName
+	 * @param localName
+	 * @param prefix
+	 * @param uri
+	 * @return
+	 * @throws SOAPException
+	 * @see javax.xml.soap.SOAPEnvelope#createName(java.lang.String, java.lang.String, java.lang.String)
+	 */
+	public Name createName(String localName, String prefix, String uri)
+			throws SOAPException {
+		try {
+			return new PrefixedQName(uri,localName, prefix);
+		}catch (Exception e)
+		{
+			throw new SOAPException(e);
+		}
+	}
+
+	/**
+	 * method createName
+	 * 
+	 * @param localName
+	 * @return
+	 * @throws SOAPException
+	 * @see javax.xml.soap.SOAPEnvelope#createName(java.lang.String)
+	 */
+	public Name createName(String localName) throws SOAPException {
+		try {
+			return new PrefixedQName(null, localName, null);
+		}catch (Exception e)
+		{
+			throw new SOAPException(e);
+		}
+	}
+
+	/**
+	 * method getHeader
+	 * 
+	 * @return
+	 * @throws SOAPException
+	 * @see javax.xml.soap.SOAPEnvelope#getHeader()
+	 */
+	public SOAPHeader getHeader() throws SOAPException {
+
+		org.apache.axis.soap.SOAPHeader omSOAPHeader;
+		try
+		{
+			omSOAPHeader = (org.apache.axis.soap.SOAPHeader) omSOAPEnvelope.getHeader();
+		}catch (Exception e)
+		{
+			throw new SOAPException(e);
+		}
+		if(omSOAPHeader != null)
+			return  new SOAPHeaderImpl(omSOAPHeader);
+		else
+			return null;
+	}
+
+	/**
+	 * method getBody
+	 * 
+	 * @return
+	 * @throws SOAPException
+	 * @see javax.xml.soap.SOAPEnvelope#getBody()
+	 */
+	public SOAPBody getBody() throws SOAPException {
+
+		org.apache.axis.soap.SOAPBody omSOAPBody = null;
+		try
+		{
+			omSOAPBody = omSOAPEnvelope.getBody();
+		} catch (Exception e)
+		{
+			//throw new SOAPException(e);
+		}
+		if(omSOAPBody != null)
+			return (new SOAPBodyImpl(omSOAPBody));
+		else
+			return null;
+	}
+
+	/**
+	 * method addHeader
+	 * 
+	 * @return
+	 * @throws SOAPException
+	 * @see javax.xml.soap.SOAPEnvelope#addHeader()
+	 */
+	public SOAPHeader addHeader() throws SOAPException {
+		/*
+		 * Our objective is to set the omSOAPHeader of the omSOAPEnvelope if not already present
+		 */
+		try {
+			org.apache.axis.soap.SOAPHeader header = omSOAPEnvelope.getHeader();
+			if (header == null) {
+				SOAPFactory soapFactory = OMAbstractFactory.getDefaultSOAPFactory();
+				header = soapFactory.createSOAPHeader(omSOAPEnvelope);
+				omSOAPEnvelope.addChild(header);
+				return (new SOAPHeaderImpl(header));
+			} else {
+				throw new SOAPException("Header already present, can't set body again without deleting the existing header");
+			}
+		}catch (Exception e)
+		{
+			throw new SOAPException(e);
+		}
+	}
+
+	/**
+	 * method addBody
+	 * 
+	 * @return
+	 * @throws SOAPException
+	 * @see javax.xml.soap.SOAPEnvelope#addBody()
+	 */
+	public SOAPBody addBody() throws SOAPException {
+		/*
+		 * Our objective is to set the omSOAPBody of the omSOAPEnvelope if not already present
+		 */
+		try {
+			org.apache.axis.soap.SOAPBody body = omSOAPEnvelope.getBody();
+			if (body == null) {
+				SOAPFactory soapFactory = OMAbstractFactory.getDefaultSOAPFactory();
+				body = soapFactory.createSOAPBody(omSOAPEnvelope);
+				omSOAPEnvelope.addChild(body);
+				return (new SOAPBodyImpl(body));
+			} else {
+				throw new SOAPException("Body already present, can't set body again without deleting the existing body");
+			}
+		}catch (Exception e)
+		{
+			throw new SOAPException(e);
+		}
+	}
+
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPFactoryImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPFactoryImpl.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPFactoryImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPFactoryImpl.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,75 @@
+/*
+ * Created on Apr 27, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.saaj;
+
+import javax.xml.soap.Detail;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMAbstractFactory;
+
+/**
+ * @author shaas02
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class SOAPFactoryImpl extends javax.xml.soap.SOAPFactory {
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPFactory#createElement(javax.xml.soap.Name)
+	 */
+	public SOAPElement createElement(Name name) throws SOAPException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPFactory#createElement(java.lang.String)
+	 */
+	public SOAPElement createElement(String localName) throws SOAPException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPFactory#createElement(java.lang.String, java.lang.String, java.lang.String)
+	 */
+	public SOAPElement createElement(String localName, String prefix, String uri)
+			throws SOAPException {
+		OMElement newOMElement = OMAbstractFactory.getOMFactory().createOMElement(localName, uri, prefix);
+		return new SOAPElementImpl(newOMElement);
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPFactory#createDetail()
+	 */
+	public Detail createDetail() throws SOAPException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPFactory#createName(java.lang.String, java.lang.String, java.lang.String)
+	 */
+	public Name createName(String localName, String prefix, String uri)
+			throws SOAPException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPFactory#createName(java.lang.String)
+	 */
+	public Name createName(String localName) throws SOAPException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPFaultElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPFaultElementImpl.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPFaultElementImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPFaultElementImpl.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,21 @@
+/*
+ * Created on Mar 17, 2005
+ *
+ */
+package org.apache.axis.saaj;
+
+import javax.xml.soap.SOAPFaultElement;
+
+/**
+ * Class SOAPFaultElementImpl
+ * Just a placeholder, extends SOAPElementImpl
+ * Does not implement any new methods or override anything
+ * 
+ * @author Ashutosh Shahi
+ * ashutosh.shahi@gmail.com
+ *
+ */
+public class SOAPFaultElementImpl extends SOAPElementImpl implements
+		SOAPFaultElement {
+
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPFaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPFaultImpl.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPFaultImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPFaultImpl.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,204 @@
+/*
+ * Created on Mar 16, 2005
+ *
+ */
+package org.apache.axis.saaj;
+
+import java.util.Locale;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Detail;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+
+import org.apache.axis.om.OMNode;
+
+/**
+ * Class SOAPFaultImpl
+ * 
+ * @author Ashutosh Shahi
+ * ashutosh.shahi@gmail.com
+ * 
+ * SOAPFault specific classes not implemented in OM, so
+ * throwing unsupported operation for the time being
+ */
+public class SOAPFaultImpl extends SOAPBodyElementImpl implements SOAPFault {
+	
+	/**
+	 * Field fault   The omSOAPFault field
+	 */
+	org.apache.axis.soap.SOAPFault fault;
+	
+	/**
+	 * Constructor SOAPFaultImpl
+	 * @param fault
+	 */
+	public SOAPFaultImpl(org.apache.axis.soap.SOAPFault fault){
+		this.fault = fault;
+	}
+
+	/**
+	 * Method setFaultCode
+	 * 
+	 * @param faultCode
+	 * @throws SOAPException
+	 * @see javax.xml.soap.SOAPFault#setFaultCode(java.lang.String)
+	 */
+	public void setFaultCode(String faultCode) throws SOAPException {
+		//QName qName = new QName(faultCode);
+		//fault.setFaultCode(qName);
+		throw new UnsupportedOperationException("No supoprted for M2 release");
+	}
+
+	/**
+	 * Method getFaultCode
+	 * 
+	 * @return
+	 * @see javax.xml.soap.SOAPFault#getFaultCode()
+	 */
+	public String getFaultCode() {
+	
+		//QName qName = fault.getFaultCode();
+		//return qName.getLocalPart();
+		throw new UnsupportedOperationException("No supoprted for M2 release");
+	}
+
+	/**
+	 * method setFaultActor
+	 * 
+	 * @param faultActor
+	 * @throws SOAPException
+	 * @see javax.xml.soap.SOAPFault#setFaultActor(java.lang.String)
+	 */
+	public void setFaultActor(String faultActor) throws SOAPException {
+		
+		//fault.setFaultActor(faultActor);
+		throw new UnsupportedOperationException("No supoprted for M2 release");
+	}
+
+	/**
+	 * method getFaultActor
+	 * 
+	 * @return
+	 * @see javax.xml.soap.SOAPFault#getFaultActor()
+	 */
+	public String getFaultActor() {
+	
+		//return fault.getFaultActor();
+		throw new UnsupportedOperationException("No supoprted for M2 release");
+	}
+
+	/**
+	 * method setFaultString
+	 * 
+	 * @param faultString
+	 * @throws SOAPException
+	 * @see javax.xml.soap.SOAPFault#setFaultString(java.lang.String)
+	 */
+	public void setFaultString(String faultString) throws SOAPException {
+	
+		//fault.setFaultString(faultString);
+		throw new UnsupportedOperationException("No supoprted for M2 release");
+	}
+
+	/**
+	 * method getFaultString
+	 * 
+	 * @return
+	 * @see javax.xml.soap.SOAPFault#getFaultString()
+	 */
+	public String getFaultString() {
+	
+		//return fault.getFaultString();
+		throw new UnsupportedOperationException("No supoprted for M2 release");
+	}
+
+	/**
+	 * method getDetail
+	 * 
+	 * @return
+	 * @see javax.xml.soap.SOAPFault#getDetail()
+	 */
+	public Detail getDetail() {
+		// May need to change after w have detail and detail entry implementation
+		//in SoapEnvelope of OM
+		/*QName detailName = new QName("detail");
+		DetailImpl detail = new DetailImpl(detailName, fault);
+		OMNode entry = fault.getDetailInformation();
+		detail.addDetailEntry(entry);
+		return detail;*/
+		throw new UnsupportedOperationException("No supoprted for M2 release");
+	}
+
+	/**
+	 * method addDetail
+	 * 
+	 * @return
+	 * @throws SOAPException
+	 * @see javax.xml.soap.SOAPFault#addDetail()
+	 */
+	public Detail addDetail() throws SOAPException {
+		// Not sure what detail information to add
+		//May need to change later
+		/*QName detailName = new QName("detail");
+		DetailImpl detail = new DetailImpl(detailName, fault);
+		return detail;*/
+		throw new UnsupportedOperationException("No supoprted for M2 release");
+	}
+
+	/**
+	 * method setFaultCode
+	 * 
+	 * @param name
+	 * @throws SOAPException
+	 * @see javax.xml.soap.SOAPFault#setFaultCode(javax.xml.soap.Name)
+	 */
+	public void setFaultCode(Name name) throws SOAPException {
+		
+		/*QName qName = new QName(name.getURI(), name.getLocalName(), name.getPrefix());
+		fault.setFaultCode(qName);*/
+		throw new UnsupportedOperationException("No supoprted for M2 release");
+	}
+
+	/**
+	 * method getFaultCodeAsName
+	 * 
+	 * @return
+	 * @see javax.xml.soap.SOAPFault#getFaultCodeAsName()
+	 */
+	public Name getFaultCodeAsName() {
+	
+		/*QName qName = fault.getFaultCode();
+		Name name = new PrefixedQName(qName);
+		return name;*/
+		throw new UnsupportedOperationException("No supoprted for M2 release");
+	}
+
+	/**
+	 * method seFaultString
+	 * 
+	 * @param faultString
+	 * @param locale
+	 * @throws SOAPException
+	 * @see javax.xml.soap.SOAPFault#setFaultString(java.lang.String, java.util.Locale)
+	 */
+	public void setFaultString(String faultString, Locale locale)
+			throws SOAPException {
+	
+		//fault.setFaultString(faultString);
+		throw new UnsupportedOperationException("No supoprted for M2 release");
+	}
+
+	/**
+	 * method getFaultStringLocale
+	 * 
+	 * @return
+	 * @see javax.xml.soap.SOAPFault#getFaultStringLocale()
+	 */
+	public Locale getFaultStringLocale() {
+		//No implementation in Axis 1.2 also, not sure what to do here
+		return null;  //TODO
+	}
+
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPHeaderElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPHeaderElementImpl.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPHeaderElementImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPHeaderElementImpl.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,78 @@
+/*
+ * Created on Mar 16, 2005
+ *
+ */
+package org.apache.axis.saaj;
+
+import javax.xml.soap.SOAPHeaderElement;
+
+import org.apache.axis.soap.SOAPHeaderBlock;
+
+/**
+ * Class SOAPHeaderImpl
+ * 
+ * @author Ashutosh Shahi
+ * ashutosh.shahi@gmail.com
+ */
+public class SOAPHeaderElementImpl extends SOAPElementImpl implements
+		SOAPHeaderElement {
+	
+	/**
+	 * Field omHeaderElement
+	 */
+	SOAPHeaderBlock omHeaderElement;
+	
+	/**
+	 * Constructor SOAPHeaderElementImpl
+	 * @param headerElement
+	 */
+	public SOAPHeaderElementImpl(org.apache.axis.soap.SOAPHeaderBlock headerElement){
+		super(headerElement);
+		this.omHeaderElement = headerElement;
+	}
+
+	/**
+	 * method setActor
+	 * 
+	 * @param actorURI
+	 * @see javax.xml.soap.SOAPHeaderElement#setActor(java.lang.String)
+	 */
+	public void setActor(String actorURI) {
+	
+		omHeaderElement.setRole(actorURI);
+	}
+
+	/**
+	 * method getActor
+	 * 
+	 * @return
+	 * @see javax.xml.soap.SOAPHeaderElement#getActor()
+	 */
+	public String getActor() {
+
+		return omHeaderElement.getRole();
+	}
+
+	/**
+	 * method setMustUnderstand
+	 * 
+	 * @param mustUnderstand
+	 * @see javax.xml.soap.SOAPHeaderElement#setMustUnderstand(boolean)
+	 */
+	public void setMustUnderstand(boolean mustUnderstand) {
+		
+		omHeaderElement.setMustUnderstand(mustUnderstand);
+	}
+
+	/**
+	 * method getMustUnderstand
+	 * 
+	 * @return
+	 * @see javax.xml.soap.SOAPHeaderElement#getMustUnderstand()
+	 */
+	public boolean getMustUnderstand() {
+		
+		return omHeaderElement.getMustUnderstand();
+	}
+
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPHeaderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPHeaderImpl.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPHeaderImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPHeaderImpl.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,180 @@
+/*
+ * Created on Mar 16, 2005
+ *
+ */
+package org.apache.axis.saaj;
+
+import java.util.Iterator;
+import java.util.ArrayList;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMAbstractFactory;
+import org.apache.axis.om.OMNamespace;
+
+/**
+ * Class SOAPHeaderImpl
+ * 
+ * @author Ashutosh Shahi
+ * ashutosh.shahi@gmail.com
+ */
+public class SOAPHeaderImpl extends SOAPElementImpl implements SOAPHeader {
+
+	/**
+	 * Field omHeader	OM's SOAPHeader field
+	 */
+	private org.apache.axis.soap.SOAPHeader omHeader;
+	
+	/**
+	 * Constructor SOAPHeaderImpl
+	 * @param header
+	 */
+	public SOAPHeaderImpl(org.apache.axis.soap.SOAPHeader header){
+		super(header);
+		this.omHeader = header; 
+	}
+	
+	/**
+	 * Method addHeaderElement
+	 * 
+	 * @param name
+	 * @return
+	 * @throws SOAPException
+	 * @see javax.xml.soap.SOAPHeader#addHeaderElement(javax.xml.soap.Name)
+	 */
+	public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException {
+		// Create an OMHeaderBlock out of name and add it a SOAPHeaderElement
+		//to SOAPHeader
+		String localName = name.getLocalName();
+		OMFactory omFactory = OMAbstractFactory.getOMFactory();
+		OMNamespace ns = omFactory.createOMNamespace(name.getURI(), name.getPrefix());
+		org.apache.axis.soap.SOAPHeaderBlock headerBlock = omHeader.addHeaderBlock(localName, ns);
+		return (new SOAPHeaderElementImpl(headerBlock));
+	}
+
+	/**
+	 * method examineHeaderElements
+	 * 
+	 * @param actor
+	 * @return
+	 * @see javax.xml.soap.SOAPHeader#examineHeaderElements(java.lang.String)
+	 */
+	public Iterator examineHeaderElements(String actor) {
+		// Get all the om specific header elements in an iterator and wrap it
+		// in a soap specific iterator and return
+		Iterator headerElementsIter = omHeader.examineHeaderBlocks(actor);
+		ArrayList aList = new ArrayList();
+		while(headerElementsIter.hasNext()){
+			Object o = headerElementsIter.next();
+			if(o instanceof org.apache.axis.soap.SOAPHeaderBlock){
+				org.apache.axis.soap.SOAPHeaderBlock headerBlock = (org.apache.axis.soap.SOAPHeaderBlock)o;
+				SOAPHeaderElement element = (new SOAPHeaderElementImpl(headerBlock)); 
+				aList.add(element);
+			}
+		}
+		return aList.iterator();
+	}
+
+	/**
+	 * method extractHeaderElements
+	 * 
+	 * @param actor
+	 * @return
+	 * @see javax.xml.soap.SOAPHeader#extractHeaderElements(java.lang.String)
+	 */
+	public Iterator extractHeaderElements(String actor) {
+		// Get all the om specific header elements in an iterator and wrap it
+		// in a soap specific iterator and return
+		Iterator headerElementsIter = omHeader.extractHeaderBlocks(actor);
+		ArrayList aList = new ArrayList();
+		while(headerElementsIter.hasNext()){
+			Object o = headerElementsIter.next();
+			if(o instanceof org.apache.axis.soap.SOAPHeaderBlock){
+				org.apache.axis.soap.SOAPHeaderBlock headerBlock = (org.apache.axis.soap.SOAPHeaderBlock)o;
+				SOAPHeaderElement element = (new SOAPHeaderElementImpl(headerBlock)); 
+				aList.add(element);
+			}
+		}
+		return aList.iterator();
+	}
+
+	/**
+	 * method examineMustUnderstandHeaderElements
+	 * 
+	 * @param actor
+	 * @return
+	 * @see javax.xml.soap.SOAPHeader#examineMustUnderstandHeaderElements(java.lang.String)
+	 */
+	public Iterator examineMustUnderstandHeaderElements(String actor) {
+		// Get all the om specific header elements in an iterator and wrap it
+		// in a soap specific iterator and return		
+		Iterator headerElementsIter = omHeader.examineMustUnderstandHeaderBlocks(actor);
+		ArrayList aList = new ArrayList();
+		while(headerElementsIter.hasNext()){
+			Object o = headerElementsIter.next();
+			if(o instanceof org.apache.axis.soap.SOAPHeaderBlock){
+				org.apache.axis.soap.SOAPHeaderBlock headerBlock = (org.apache.axis.soap.SOAPHeaderBlock)o;
+				SOAPHeaderElement element = (new SOAPHeaderElementImpl(headerBlock)); 
+				aList.add(element);
+			}
+		}
+		return aList.iterator();
+	}
+
+	/**
+	 * method examineAllHeaderElements
+	 * 
+	 * @return
+	 * @see javax.xml.soap.SOAPHeader#examineAllHeaderElements()
+	 */
+	public Iterator examineAllHeaderElements() {
+		// Get all the om specific header elements in an iterator and wrap it
+		// in a soap specific iterator and return	
+		Iterator headerElementsIter = omHeader.examineAllHeaderBlocks();
+		ArrayList aList = new ArrayList();
+		while(headerElementsIter.hasNext()){
+			Object o = headerElementsIter.next();
+			if(o instanceof org.apache.axis.soap.SOAPHeaderBlock){
+				org.apache.axis.soap.SOAPHeaderBlock headerBlock = (org.apache.axis.soap.SOAPHeaderBlock)o;
+				SOAPHeaderElement element = (new SOAPHeaderElementImpl(headerBlock)); 
+				aList.add(element);
+			}
+		}
+		return aList.iterator();
+	}
+
+	/**
+	 * method extractAllHeaderElements
+	 * 
+	 * @return
+	 * @see javax.xml.soap.SOAPHeader#extractAllHeaderElements()
+	 */
+	public Iterator extractAllHeaderElements() {
+		// Get all the om specific header elements in an iterator and wrap it
+		// in a soap specific iterator and return	
+		Iterator headerElementsIter = omHeader.extractAllHeaderBlocks();
+		ArrayList aList = new ArrayList();
+		while(headerElementsIter.hasNext()){
+			Object o = headerElementsIter.next();
+			if(o instanceof org.apache.axis.soap.SOAPHeaderBlock){
+				org.apache.axis.soap.SOAPHeaderBlock headerBlock = (org.apache.axis.soap.SOAPHeaderBlock)o;
+				SOAPHeaderElement element = (new SOAPHeaderElementImpl(headerBlock)); 
+				aList.add(element);
+			}
+		}
+		return aList.iterator();
+	}
+	
+	/*public boolean equals(Object o){
+		if(o instanceof SOAPHeaderImpl){
+			if(this.omHeader.equals(((SOAPHeaderImpl)o).omHeader))
+					return true;
+		}
+		return false;
+	}*/
+
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPMessageImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPMessageImpl.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPMessageImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPMessageImpl.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,197 @@
+/*
+ * Created on Apr 8, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.saaj;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Iterator;
+
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axis.transport.http.HTTPConstants;
+
+/**
+ * @author Ashutosh Shahi ashutosh.shahi@gmail.com
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class SOAPMessageImpl extends SOAPMessage {
+	
+	private SOAPPartImpl mSOAPPart;
+    private java.util.Hashtable mProps = new java.util.Hashtable();
+    private MimeHeaders headers;
+
+	public SOAPMessageImpl(Object initialContents){
+		try{
+		setup(initialContents, false, null, null, null);
+		} catch(SOAPException e){
+			e.printStackTrace();
+		}
+	}
+	
+    public SOAPMessageImpl(Object initialContents, boolean bodyInStream, javax.xml.soap.MimeHeaders headers) {
+    	try{
+    	setup(initialContents, bodyInStream, null, null, (MimeHeaders)headers);
+		} catch(SOAPException e){
+			e.printStackTrace();
+		}   	
+    }
+	
+	private void setup(Object initialContents, boolean bodyInStream,
+			String contentType, String contentLocation,
+			MimeHeaders mimeHeaders)throws SOAPException{
+		if(null == mSOAPPart)
+			mSOAPPart = new SOAPPartImpl(this, initialContents, bodyInStream);
+		else
+			mSOAPPart.setMessage(this);
+		
+		headers = (mimeHeaders == null) ? new MimeHeaders() : new MimeHeaders(mimeHeaders);
+	}
+	
+    /**
+     * Retrieves a description of this <CODE>SOAPMessage</CODE>
+     * object's content.
+     * @return  a <CODE>String</CODE> describing the content of this
+     *     message or <CODE>null</CODE> if no description has been
+     *     set
+     * @see #setContentDescription(java.lang.String) setContentDescription(java.lang.String)
+     */
+    public String getContentDescription() {
+        String values[] = headers.getHeader(HTTPConstants.HEADER_CONTENT_DESCRIPTION);
+        if(values != null && values.length > 0)
+            return values[0];
+        return null;
+    }
+
+    /**
+     * Sets the description of this <CODE>SOAPMessage</CODE>
+     * object's content with the given description.
+     * @param  description a <CODE>String</CODE>
+     *     describing the content of this message
+     * @see #getContentDescription() getContentDescription()
+     */
+    public void setContentDescription(String description) {
+        headers.setHeader(HTTPConstants.HEADER_CONTENT_DESCRIPTION, description);
+    }
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPMessage#getSOAPPart()
+	 */
+	public SOAPPart getSOAPPart() {
+		return mSOAPPart;
+	}
+	
+    public SOAPBody getSOAPBody() throws SOAPException {
+        return mSOAPPart.getEnvelope().getBody();
+    }
+
+    public SOAPHeader getSOAPHeader() throws SOAPException {
+        return mSOAPPart.getEnvelope().getHeader();
+    }
+    
+    public void setProperty(String property, Object value) throws SOAPException {
+        mProps.put(property, value);
+    }
+
+    public Object getProperty(String property) throws SOAPException {
+        return mProps.get(property);
+    }
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPMessage#removeAllAttachments()
+	 */
+	public void removeAllAttachments() {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPMessage#countAttachments()
+	 */
+	public int countAttachments() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPMessage#getAttachments()
+	 */
+	public Iterator getAttachments() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPMessage#getAttachments(javax.xml.soap.MimeHeaders)
+	 */
+	public Iterator getAttachments(javax.xml.soap.MimeHeaders headers) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPMessage#addAttachmentPart(javax.xml.soap.AttachmentPart)
+	 */
+	public void addAttachmentPart(AttachmentPart attachmentpart) {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPMessage#createAttachmentPart()
+	 */
+	public AttachmentPart createAttachmentPart() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPMessage#getMimeHeaders()
+	 */
+	public javax.xml.soap.MimeHeaders getMimeHeaders() {
+		
+		return headers;
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPMessage#saveChanges()
+	 */
+	public void saveChanges() throws SOAPException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPMessage#saveRequired()
+	 */
+	public boolean saveRequired() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPMessage#writeTo(java.io.OutputStream)
+	 */
+	public void writeTo(OutputStream out) throws SOAPException, IOException {
+		try{
+		XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(out);
+		((SOAPEnvelopeImpl)mSOAPPart.getEnvelope()).getOMEnvelope().serialize(writer);
+		writer.flush();
+		} catch(Exception e){
+			throw new SOAPException(e);
+		}
+	}
+
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPPartImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPPartImpl.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPPartImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/SOAPPartImpl.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,493 @@
+/*
+ * Created on Apr 8, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.saaj;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Iterator;
+
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPPart;
+import javax.xml.transform.Source;
+
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLInputFactory;
+import org.apache.axis.soap.impl.llom.builder.StAXSOAPModelBuilder;
+
+import org.apache.axis.transport.http.HTTPConstants;
+import org.apache.axis.util.SessionUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.CDATASection;
+import org.w3c.dom.Comment;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Element;
+import org.w3c.dom.EntityReference;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.ProcessingInstruction;
+import org.w3c.dom.Text;
+
+/**
+ * @author Ashutosh Shahi ashutosh.shahi@gmail.com
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class SOAPPartImpl extends SOAPPart {
+
+	private SOAPMessageImpl msgObject;
+	private MimeHeaders mimeHeaders = new MimeHeaders();
+	private Object envelope;
+    /**
+     * default message encoding charset
+     */
+    private String currentEncoding = "UTF-8";
+	
+	public SOAPPartImpl(SOAPMessageImpl parent, Object initialContents, boolean isBodyStream) throws SOAPException{
+		
+        setMimeHeader(HTTPConstants.HEADER_CONTENT_ID , SessionUtils.generateSessionId());
+        setMimeHeader(HTTPConstants.HEADER_CONTENT_TYPE , "text/xml");
+        StAXSOAPModelBuilder stAXSOAPModelBuilder;
+        
+        msgObject = parent;
+        try{
+        	if(initialContents instanceof SOAPEnvelope){
+        		((SOAPEnvelopeImpl)initialContents).setOwnerDocument(this);
+        		envelope = initialContents;
+        	} else if(initialContents instanceof InputStream){
+        		//XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader((InputStream)initialContents);
+        		InputStreamReader inr = new InputStreamReader((InputStream)initialContents);
+        		stAXSOAPModelBuilder = new StAXSOAPModelBuilder(XMLInputFactory.newInstance().createXMLStreamReader(inr));
+        		org.apache.axis.soap.SOAPEnvelope omEnv = stAXSOAPModelBuilder.getSOAPEnvelope();
+        		envelope = new SOAPEnvelopeImpl(omEnv);
+        		((SOAPEnvelopeImpl)envelope).setOwnerDocument(this);
+        	}
+        
+        }catch(Exception e){
+        	throw new SOAPException(e);
+        }
+	}
+	
+    public SOAPMessageImpl getMessage(){
+        return msgObject;
+      }
+
+      /**
+       * Set the Message for this Part.
+       * Do not call this Directly. Called by Message.
+       *
+       * @param msg  the <code>Message</code> for this part
+       */
+      public void setMessage (SOAPMessageImpl msg) {
+          this.msgObject= msg;
+      }
+	
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPPart#getEnvelope()
+	 */
+  	public SOAPEnvelope getEnvelope() throws SOAPException {
+		//if(envelope != null)
+			return (SOAPEnvelope)envelope;
+		
+	}
+
+    /**
+     * Removes all MIME headers that match the given name.
+     * @param  header  a <CODE>String</CODE> giving
+     *     the name of the MIME header(s) to be removed
+     */
+    public void removeMimeHeader(String header) {
+        mimeHeaders.removeHeader(header);
+    }
+
+	   /**
+     * Removes all the <CODE>MimeHeader</CODE> objects for this
+     * <CODE>SOAPEnvelope</CODE> object.
+     */
+    public void removeAllMimeHeaders() {
+        mimeHeaders.removeAllHeaders();
+    }
+
+    /**
+     * Gets all the values of the <CODE>MimeHeader</CODE> object
+     * in this <CODE>SOAPPart</CODE> object that is identified by
+     * the given <CODE>String</CODE>.
+     * @param   name  the name of the header; example:
+     *     "Content-Type"
+     * @return a <CODE>String</CODE> array giving all the values for
+     *     the specified header
+     * @see #setMimeHeader(java.lang.String, java.lang.String) setMimeHeader(java.lang.String, java.lang.String)
+     */
+    public String[] getMimeHeader(String name) {
+        return mimeHeaders.getHeader(name);
+    }
+
+    /**
+     * Changes the first header entry that matches the given
+     *   header name so that its value is the given value, adding a
+     *   new header with the given name and value if no existing
+     *   header is a match. If there is a match, this method clears
+     *   all existing values for the first header that matches and
+     *   sets the given value instead. If more than one header has
+     *   the given name, this method removes all of the matching
+     *   headers after the first one.
+     *
+     *   <P>Note that RFC822 headers can contain only US-ASCII
+     *   characters.</P>
+     * @param  name a <CODE>String</CODE> giving the
+     *     header name for which to search
+     * @param  value a <CODE>String</CODE> giving the
+     *     value to be set. This value will be substituted for the
+     *     current value(s) of the first header that is a match if
+     *     there is one. If there is no match, this value will be
+     *     the value for a new <CODE>MimeHeader</CODE> object.
+     * @ throws java.lang.IllegalArgumentException if
+     *     there was a problem with the specified mime header name
+     *     or value
+     * @see #getMimeHeader(java.lang.String) getMimeHeader(java.lang.String)
+     */
+    public void setMimeHeader(String name, String value) {
+        mimeHeaders.setHeader(name,value);
+    }
+
+    /**
+     * Add the specified MIME header, as per JAXM.
+     *
+     * @param header  the header to add
+     * @param value   the value of that header
+     */
+    public void addMimeHeader (String header, String value) {
+        mimeHeaders.addHeader(header, value);
+    }
+
+    /**
+     * Retrieves all the headers for this <CODE>SOAPPart</CODE>
+     * object as an iterator over the <CODE>MimeHeader</CODE>
+     * objects.
+     * @return an <CODE>Iterator</CODE> object with all of the Mime
+     *     headers for this <CODE>SOAPPart</CODE> object
+     */
+    public Iterator getAllMimeHeaders() {
+        return mimeHeaders.getAllHeaders();
+    }
+
+    /**
+     * Get all headers that match.
+     *
+     * @param match  an array of <code>String</code>s giving mime header names
+     * @return an <code>Iterator</code> over all values matching these headers
+     */
+    public java.util.Iterator getMatchingMimeHeaders( final String[] match){
+        return mimeHeaders.getMatchingHeaders(match);
+    }
+
+    /**
+     * Get all headers that do not match.
+     *
+     * @param match  an array of <code>String</code>s giving mime header names
+     * @return an <code>Iterator</code> over all values not matching these
+     *          headers
+     */
+    public java.util.Iterator getNonMatchingMimeHeaders( final String[] match){
+        return mimeHeaders.getNonMatchingHeaders(match);
+    }
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPPart#setContent(javax.xml.transform.Source)
+	 */
+	public void setContent(Source source) throws SOAPException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.xml.soap.SOAPPart#getContent()
+	 */
+	public Source getContent() throws SOAPException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+    /**
+     *  Implementation of org.w3c.Document
+     *  Most of methods will be implemented using the delgate
+     *  instance of SOAPDocumentImpl
+     *  This is for two reasons:
+     *  - possible change of message classes, by extenstion of xerces implementation
+     *  - we cannot extends SOAPPart (multiple inheritance),
+     *    since it is defined as Abstract class
+     * ***********************************************************
+     */
+
+    private Document document = new SOAPDocumentImpl(this);
+    /**
+     *  @since SAAJ 1.2
+     */
+    public Document getSOAPDocument(){
+        if(document == null){
+            document = new SOAPDocumentImpl(this);
+        }
+        return document;
+    }
+
+    /**
+     * @return
+     */
+    public DocumentType getDoctype(){
+        return document.getDoctype();
+    }
+
+    /**
+     * @return
+     */
+    public DOMImplementation getImplementation(){
+        return document.getImplementation();
+    }
+
+    /**
+     * SOAPEnvelope is the Document Elements of this XML docuement
+     */
+    protected Document mDocument;
+
+    public Element getDocumentElement()
+    {
+        try{
+            return getEnvelope();
+        }catch(SOAPException se){
+            return null;
+        }
+    }
+
+    /**
+     *
+     * @param tagName
+     * @return
+     * @throws DOMException
+     */
+    public Element createElement(String tagName) throws DOMException {
+        return document.createElement(tagName);
+    }
+
+    public DocumentFragment createDocumentFragment() {
+        return document.createDocumentFragment();
+    }
+
+    public Text createTextNode(String data) {
+        return document.createTextNode(data);
+    }
+
+    public Comment createComment(String data){
+        return document.createComment(data);
+    }
+
+    public CDATASection createCDATASection(String data) throws DOMException {
+        return document.createCDATASection(data);
+    }
+
+    public ProcessingInstruction createProcessingInstruction(String target, String data)
+    throws DOMException {
+        return document.createProcessingInstruction(target,data);
+    }
+
+    public Attr createAttribute(String name)throws DOMException {
+        return document.createAttribute(name);
+    }
+
+    public EntityReference createEntityReference(String name) throws DOMException {
+        return document.createEntityReference(name);
+    }
+
+    public NodeList getElementsByTagName(String tagname) {
+        return document.getElementsByTagName(tagname);
+    }
+
+    public Node importNode(Node importedNode, boolean deep)
+    throws DOMException {
+        return document.importNode(importedNode, deep);
+    }
+
+    public Element createElementNS(String namespaceURI, String qualifiedName)
+    throws DOMException {
+        return document.createElementNS(namespaceURI, qualifiedName);
+    }
+
+    public Attr createAttributeNS(String namespaceURI, String qualifiedName)
+    throws DOMException {
+        return document.createAttributeNS(namespaceURI, qualifiedName);
+    }
+
+    public NodeList getElementsByTagNameNS(String namespaceURI, String localName) {
+        return document.getElementsByTagNameNS(namespaceURI,localName);
+    }
+
+    public Element getElementById(String elementId){
+        return document.getElementById(elementId);
+    }
+
+    /////////////////////////////////////////////////////////////
+
+    public String getEncoding()
+    {
+        return currentEncoding;
+    }
+
+    public  void setEncoding(String s)
+    {
+        currentEncoding = s;
+    }
+
+    public  boolean getStandalone()
+    {
+        throw new UnsupportedOperationException("Not yet implemented.71");
+    }
+
+
+    public  void setStandalone(boolean flag)
+    {
+        throw new UnsupportedOperationException("Not yet implemented.72");
+    }
+
+    public  boolean getStrictErrorChecking()
+    {
+        throw new UnsupportedOperationException("Not yet implemented.73");
+    }
+
+
+    public  void setStrictErrorChecking(boolean flag)
+    {
+        throw new UnsupportedOperationException("Not yet implemented. 74");
+    }
+
+
+    public  String getVersion()
+    {
+        throw new UnsupportedOperationException("Not yet implemented. 75");
+    }
+
+
+    public  void setVersion(String s)
+    {
+        throw new UnsupportedOperationException("Not yet implemented.76");
+    }
+
+
+    public  Node adoptNode(Node node)
+    throws DOMException
+    {
+        throw new UnsupportedOperationException("Not yet implemented.77");
+    }
+
+    /**
+     *  Node Implementation
+     */
+
+    public String getNodeName(){
+        return document.getNodeName();
+    }
+
+    public String getNodeValue() throws DOMException {
+        return document.getNodeValue();
+    }
+
+    public void setNodeValue(String nodeValue) throws DOMException{
+        document.setNodeValue(nodeValue);
+    }
+
+    public short getNodeType() {
+        return document.getNodeType();
+    }
+
+    public Node getParentNode(){
+        return  document.getParentNode();
+    }
+
+    public NodeList getChildNodes() {
+        return document.getChildNodes();
+    }
+
+    public Node getFirstChild() {
+        return document.getFirstChild();
+    }
+
+    public Node getLastChild(){
+        return document.getLastChild();
+    }
+
+    public Node getPreviousSibling(){
+        return document.getPreviousSibling();
+    }
+
+    public Node getNextSibling(){
+        return document.getNextSibling();
+    }
+
+    public NamedNodeMap getAttributes(){
+        return document.getAttributes();
+    }
+
+    public Document getOwnerDocument(){
+        return document.getOwnerDocument();
+    }
+
+    public Node insertBefore(Node newChild, Node refChild) throws DOMException {
+        return document.insertBefore(newChild, refChild);
+    }
+
+    public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
+        return document.replaceChild(newChild, oldChild);
+    }
+
+    public Node removeChild(Node oldChild) throws DOMException {
+        return document.removeChild(oldChild);
+    }
+
+    public Node appendChild(Node newChild) throws DOMException {
+        return document.appendChild(newChild);
+    }
+
+    public boolean hasChildNodes(){
+        return document.hasChildNodes();
+    }
+    public Node cloneNode(boolean deep) {
+        return document.cloneNode(deep);
+    }
+
+    public void normalize(){
+        document.normalize();
+    }
+
+    public boolean isSupported(String feature, String version){
+        return document.isSupported(feature, version);
+    }
+
+    public String getNamespaceURI() {
+        return document.getNamespaceURI();
+    }
+
+    public String getPrefix() {
+        return document.getPrefix();
+    }
+
+    public void setPrefix(String prefix) throws DOMException {
+        document.setPrefix(prefix);
+    }
+    public String getLocalName() {
+        return document.getLocalName();
+    }
+
+    public boolean hasAttributes(){
+        return document.hasAttributes();
+    }
+
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/TextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/TextImpl.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/TextImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/saaj/TextImpl.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,167 @@
+/*
+ * Created on Apr 11, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.saaj;
+
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.Text;
+import javax.xml.soap.SOAPException;
+
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMText;
+import org.w3c.dom.DOMException;
+
+/**
+ * @author Ashutosh Shahi ashutosh.shahi@gmail.com
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class TextImpl extends NodeImpl implements Text {
+
+	private OMText omText;
+	
+	public TextImpl(String s){
+		//super();
+		omNode = omText = org.apache.axis.om.OMAbstractFactory.getOMFactory().createText(s);
+	}
+	
+	public TextImpl(SOAPElementImpl parent, String s) throws SOAPException{
+		//super();
+		//super.setParentElement(parent);
+		OMElement par = parent.getOMElement();
+		omNode = omText = org.apache.axis.om.OMAbstractFactory.getOMFactory().createText(par, s);
+	}
+	
+	public TextImpl(org.w3c.dom.CharacterData data){
+        if ( data == null ){
+           throw new IllegalArgumentException( "Text value may not be null." );
+        }
+        omText = org.apache.axis.om.OMAbstractFactory.getOMFactory().createText(data.getData());
+	}
+	
+	/*Overridden Method*/
+	public SOAPElement getParentElement() {
+		OMElement parent = omText.getParent();
+		return new SOAPElementImpl(parent);
+	}
+	
+	/*Overridden Method*/
+	public void setParentElement(SOAPElement parent) throws SOAPException {
+		OMElement omParent = ((SOAPElementImpl)parent).getOMElement();
+		omText.setParent(omParent);
+	}
+	
+	/*Overridden Method*/
+	public String getValue() {
+		return omText.getText();
+	}
+	
+	public boolean isComment() {
+		
+		String temp = omText.getText();
+		if(temp.startsWith("<!--") && temp.endsWith("-->"))
+            return true;
+        return false;
+	}
+
+    /**
+     * Implementation of DOM TEXT Interface
+     * *************************************************************
+     */
+	
+	
+	public org.w3c.dom.Text splitText(int offset) throws DOMException {
+		
+		String temp = omText.getText();
+		int length = temp.length();
+		String tailData = temp.substring(offset);
+		temp = temp.substring(0, offset);
+		omText = org.apache.axis.om.OMAbstractFactory.getOMFactory().createText(temp);
+		TextImpl tailText = new TextImpl(tailData);
+		org.w3c.dom.Node myParent = getParentNode();
+        if(myParent != null){
+            org.w3c.dom.NodeList brothers = myParent.getChildNodes();
+            for(int i = 0;i  < brothers.getLength(); i++){
+                if(brothers.item(i).equals(this)){
+                    myParent.insertBefore(tailText, this);
+                    return tailText;
+                }
+            }
+        }
+        return tailText;
+	}
+
+	
+	public int getLength() {
+		
+		return omText.getText().length();
+	}
+
+	
+	public void deleteData(int offset, int count) throws DOMException {
+		
+		String temp = omText.getText();
+		StringBuffer subString = new StringBuffer(temp.substring(0,offset));
+		if(temp.length() - offset >= count - offset)
+			subString = subString.append(temp.substring(offset+count));
+		temp = subString.toString();
+		omText = org.apache.axis.om.OMAbstractFactory.getOMFactory().createText(temp);
+		
+	}
+
+	
+	public String getData() throws DOMException {
+		
+		return omText.getText();
+	}
+
+	
+	public String substringData(int offset, int count) throws DOMException {
+		
+		String temp = omText.getText();
+		if(temp.length() - offset >= count - offset)
+			return temp.substring(offset, count);
+		else
+			return temp.substring(offset);
+	}
+
+	
+	public void replaceData(int offset, int count, String arg)
+			throws DOMException {
+		
+		deleteData(offset, count);
+		StringBuffer temp = new StringBuffer(omText.getText());
+		temp.append(arg);
+		omText = org.apache.axis.om.OMAbstractFactory.getOMFactory().createText(temp.toString());
+	}
+
+	
+	public void insertData(int offset, String arg) throws DOMException {
+		
+		if(offset < 0 || offset > omText.getText().length())
+			throw new DOMException(DOMException.INDEX_SIZE_ERR, "");
+		StringBuffer temp = new StringBuffer(omText.getText().substring(0, offset));
+		temp = temp.append(arg);
+		omText = org.apache.axis.om.OMAbstractFactory.getOMFactory().createText(temp.toString());
+	}
+
+	
+	public void appendData(String arg) throws DOMException {
+		
+		StringBuffer temp = new StringBuffer(omText.getText());
+		temp = temp.append(arg);
+		omText = org.apache.axis.om.OMAbstractFactory.getOMFactory().createText(temp.toString());
+
+	}
+
+	
+	public void setData(String arg) throws DOMException {
+		
+		omText = org.apache.axis.om.OMAbstractFactory.getOMFactory().createText(arg);
+	}
+
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/util/Dom2OmUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/util/Dom2OmUtils.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/util/Dom2OmUtils.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/util/Dom2OmUtils.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,32 @@
+/*
+ * Created on May 20, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.util;
+
+import org.apache.axis.om.OMNode;
+import org.apache.axis.saaj.NodeImpl;
+import org.w3c.dom.Node;
+
+/**
+ * @author shaas02
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class Dom2OmUtils {
+	
+	private OMNode omNode;
+	public static OMNode toOM(Node node){
+		if(node instanceof NodeImpl){
+			return ((NodeImpl)node).getOMNode();
+		}
+		//ELSE Assumes an implemenattion of DOM to be present
+		//so, here we convert DOM Node to a OMNode and add it as a
+		//child to the omNode member of this NodeImpl
+		return null;
+	}
+
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/util/IOUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/util/IOUtils.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/util/IOUtils.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/util/IOUtils.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,55 @@
+/*
+ * Created on Apr 7, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Utility class containing IO helper methods
+ */
+public class IOUtils
+{
+    private IOUtils() {
+    }
+
+    /**
+     * Read into a byte array; tries to ensure that the the
+     * full buffer is read.
+     *
+     * Helper method, just calls <tt>readFully(in, b, 0, b.length)</tt>
+     * @see #readFully(java.io.InputStream, byte[], int, int)
+     */
+    public static int readFully(InputStream in, byte[] b)
+    throws IOException
+    {
+        return readFully(in, b, 0, b.length);
+    }
+
+    /**
+     * Same as the normal <tt>in.read(b, off, len)</tt>, but tries to ensure that
+     * the entire len number of bytes is read.
+     * <p>
+     * @returns the number of bytes read, or -1 if the end of file is
+     *  reached before any bytes are read
+     */
+    public static int readFully(InputStream in, byte[] b, int off, int len)
+    throws IOException
+    {
+        int total = 0;
+        for (;;) {
+            int got = in.read(b, off + total, len - total);
+            if (got < 0) {
+                return (total == 0) ? -1 : total;
+            } else {
+                total += got;
+                if (total == len)
+                    return total;
+            }
+        }
+    }
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/util/SessionUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/util/SessionUtils.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/util/SessionUtils.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/util/SessionUtils.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,99 @@
+/*
+ * Created on Apr 8, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.util;
+
+import java.util.Random;
+
+/**
+ * Code borrowed from AuthenticatorBase.java for generating a secure id's.
+ */
+public class SessionUtils {
+
+    /**
+     * The number of random bytes to include when generating a
+     * session identifier.
+     */
+    protected static final int SESSION_ID_BYTES = 16;
+
+    /**
+     * A random number generator to use when generating session identifiers.
+     */
+    protected static Random random = null;
+
+    /**
+     * The Java class name of the random number generator class to be used
+     * when generating session identifiers.
+     */
+    protected static String randomClass = "java.security.SecureRandom";
+
+    /**
+     * Host name/ip.
+     */
+    private static String thisHost = null;
+
+    /**
+     * Generate and return a new session identifier.
+     *
+     * @return a new session id
+     */
+    public static synchronized String generateSessionId() {
+        // Generate a byte array containing a session identifier
+        byte bytes[] = new byte[SESSION_ID_BYTES];
+
+        getRandom().nextBytes(bytes);
+
+        // Render the result as a String of hexadecimal digits
+        StringBuffer result = new StringBuffer();
+
+        for (int i = 0; i < bytes.length; i++) {
+            byte b1 = (byte) ((bytes[i] & 0xf0) >> 4);
+            byte b2 = (byte) (bytes[i] & 0x0f);
+
+            if (b1 < 10) {
+                result.append((char) ('0' + b1));
+            } else {
+                result.append((char) ('A' + (b1 - 10)));
+            }
+            if (b2 < 10) {
+                result.append((char) ('0' + b2));
+            } else {
+                result.append((char) ('A' + (b2 - 10)));
+            }
+        }
+        return (result.toString());
+    }
+
+    /**
+     * Generate and return a new session identifier.
+     *
+     * @return a new session.
+     */
+    public static synchronized Long generateSession() {
+        return new Long(getRandom().nextLong());
+    }
+
+    /**
+     * Return the random number generator instance we should use for
+     * generating session identifiers.  If there is no such generator
+     * currently defined, construct and seed a new one.
+     *
+     * @return Random object
+     */
+    private static synchronized Random getRandom() {
+        if (random == null) {
+            try {
+                Class clazz = Class.forName(randomClass);
+                random = (Random) clazz.newInstance();
+            } catch (Exception e) {
+                random = new java.util.Random();
+            }
+        }
+        return (random);
+    }
+
+}
+

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/util/XMLUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/util/XMLUtils.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/util/XMLUtils.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/org/apache/axis/util/XMLUtils.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,60 @@
+/*
+ * Created on Apr 11, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.util;
+
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @author shaas02
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class XMLUtils {
+	
+    /**
+     * Get an empty new Document
+     *
+     * @return Document
+     * @throws ParserConfigurationException if construction problems occur
+     */
+    public static Document newDocument()
+    throws ParserConfigurationException {
+    	DocumentBuilder db = null;
+    	
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        db = dbf.newDocumentBuilder();
+        Document doc = db.newDocument();
+        return doc;
+    }
+	
+    /**
+     * Method newDocument
+     *
+     * @param in
+     * @return
+     * @throws ParserConfigurationException
+     * @throws SAXException
+     * @throws IOException
+     */
+    public static Document newDocument(InputStream in)
+            throws ParserConfigurationException, SAXException, IOException {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        return db.parse(in);
+    }
+
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestClient.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestClient.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestClient.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,83 @@
+/*
+ * Created on Mar 21, 2005
+ *
+ */
+package org.apache.axis.saaj;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.axis.Constants;
+import org.apache.axis.clientapi.Call;
+import org.apache.axis.addressing.AddressingConstants;
+import org.apache.axis.addressing.EndpointReference;
+import org.apache.axis.engine.AxisFault;
+
+/**
+ * Class TestClient
+ * Creates a SAAJ specific soap message using SAAJ api
+ * Takes the omEnvelope from this SAAJ Envelope and sends it using Call.sendReceive()
+ * recives the echoed response
+ * 
+ * @author Ashutosh Shahi
+ * ashutosh.shahi@gmail.com
+ */
+public class TestClient {
+	
+	public static void main(String[] args){
+		try{
+		SOAPEnvelopeImpl env = new SOAPEnvelopeImpl();
+		Name ns =  env.createName("EchoOM", "test1", "http://MyClient.org/MyClient");
+		SOAPBody body = env.getBody();
+		SOAPElement bodyElmnt =  body.addBodyElement(ns);
+		Name ns2 = env.createName("Text","test2", "http://MyClient.org/ABC");
+		SOAPElement text = bodyElmnt.addChildElement(ns2);
+		text.addTextNode("Echo String");
+		
+		org.apache.axis.soap.SOAPEnvelope omEnv = env.getOMEnvelope();
+		
+		System.out.println("Request sent   ...");
+		XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+		omEnv.serialize(writer);
+		writer.flush();
+		System.out.println();
+		
+		Call call = new Call();
+		URL url = null;
+
+		try {
+				url = new URL("http://localhost:8080/axis2/services/myecho");
+		} catch (MalformedURLException e) {
+			e.printStackTrace();
+			System.exit(0);
+		}
+		
+		call.setTransportInfo(Constants.TRANSPORT_HTTP,Constants.TRANSPORT_HTTP, true);
+		call.setTo(new EndpointReference(AddressingConstants.WSA_TO, url.toString()));
+		
+		org.apache.axis.soap.SOAPEnvelope responseEnv = (org.apache.axis.soap.SOAPEnvelope)call.invokeBlocking("echo", omEnv);
+
+		System.out.println("Responce received  ...");
+		responseEnv.serialize(writer);
+		writer.flush();
+		
+		} catch(AxisFault e1){
+			e1.printStackTrace();
+		} catch(javax.xml.soap.SOAPException e){
+			e.printStackTrace();
+		} catch (XMLStreamException e1) {
+			e1.printStackTrace();
+		}catch (FactoryConfigurationError e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		}
+	}
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestClient2.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestClient2.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestClient2.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestClient2.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,67 @@
+/*
+ * Created on Apr 8, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.saaj;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConnectionFactory;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamException;
+/**
+ * @author Ashutosh Shahi
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class TestClient2 {
+	
+	public static void main(String[] args){
+		try{
+			javax.xml.soap.MessageFactory fact = javax.xml.soap.MessageFactory.newInstance(); 
+			javax.xml.soap.SOAPMessage message = fact.createMessage();
+			javax.xml.soap.SOAPPart soapPart = message.getSOAPPart();
+			SOAPEnvelopeImpl env = (SOAPEnvelopeImpl)soapPart.getEnvelope(); 
+			Name ns =  env.createName("EchoOM", "test1", "http://MyClient.org/MyClient");
+			SOAPBody body = env.getBody();
+			SOAPElement bodyElmnt =  body.addBodyElement(ns);
+			Name ns2 = env.createName("Text","test2", "http://MyClient.org/ABC");
+			SOAPElement text = bodyElmnt.addChildElement(ns2);
+			text.addTextNode("Echo String");
+			// TODO: Test with TextImpl, need some fix 
+			//TextImpl data = new TextImpl((SOAPElementImpl)text, "Echo String");
+			//System.out.println(data.getParentElement().getElementName());
+			//data.setParentElement(text);
+					
+		/*	SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
+			SOAPConnection connection = factory.createConnection();
+			javax.xml.soap.SOAPMessage respMsg = ((SOAPConnectionImpl)connection).call(message, "http://localhost:8080/axis2/services/myecho");
+			SOAPEnvelope response = respMsg.getSOAPPart().getEnvelope();
+		*/	
+			org.apache.axis.soap.SOAPEnvelope omEnv = env.getOMEnvelope();
+			System.out.println("Request sent   ...");
+			XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+			omEnv.serialize(writer);
+			writer.flush();
+			System.out.println();
+		/*	org.apache.axis.om.SOAPEnvelope omResp = ((SOAPEnvelopeImpl)response).getOMEnvelope();
+			System.out.println("Response received  ...");
+			omResp.serialize(writer,true);
+			writer.flush();
+			*/
+			} catch(SOAPException e){
+				e.printStackTrace();
+			} catch(XMLStreamException e1){
+				e1.printStackTrace();
+			}
+	}
+
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestHeaders.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestHeaders.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestHeaders.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestHeaders.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,57 @@
+/*
+ * Created on Apr 15, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.saaj;
+
+import junit.framework.TestCase;
+import java.io.ByteArrayOutputStream;
+import java.util.Iterator;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+
+/**
+ * @author Ashutosh Shahi ashutosh.shahi@gmail.com
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class TestHeaders extends TestCase {
+	
+    private final String actor = "ACTOR#1";
+    private final String localName = "Local1";
+    private final String namespace = "http://ws.apache.org";
+    private final String prefix = "P1";
+	
+    public TestHeaders(String name) {
+        super(name);
+    }
+    
+    public void testAddingHeaderElements() throws Exception {
+        javax.xml.soap.SOAPMessage soapMessage = javax.xml.soap.MessageFactory.newInstance().createMessage();
+        javax.xml.soap.SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
+        javax.xml.soap.SOAPHeader header = soapEnv.getHeader();
+        header.addChildElement("ebxmlms");
+        
+        /*ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        soapMessage.writeTo(baos);
+        String xml = new String(baos.toByteArray());
+        assertTrue(xml.indexOf("ebxmlms") != -1);*/
+        
+        Iterator it = header.getChildElements();
+        boolean b = false;
+        while(it.hasNext()){
+            SOAPElement el = (SOAPElement) it.next();
+            String lName = el.getNodeName();
+            if(lName.equalsIgnoreCase("ebxmlms")){
+            	b = true;
+            	break;
+            }
+        }
+        assertTrue(b);
+    }
+
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestPrefixes.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestPrefixes.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestPrefixes.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestPrefixes.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,77 @@
+/*
+ * Created on Apr 26, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.saaj;
+
+import junit.framework.TestCase;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+
+import java.io.ByteArrayOutputStream;
+import java.io.ByteArrayInputStream;
+
+/**
+ * @author Ashutosh Shahi
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class TestPrefixes extends TestCase {
+	
+    public TestPrefixes(String name) {
+        super(name);
+    }
+    
+    public void testAddingPrefixesForChildElements() throws Exception {
+    	MessageFactory factory = MessageFactory.newInstance();
+    	SOAPMessage msg = factory.createMessage();
+    	SOAPPart sp = msg.getSOAPPart();
+    	SOAPEnvelope se = sp.getEnvelope();
+    	SOAPBody sb = se.getBody();
+        SOAPElement el1 = sb.addBodyElement(se.createName
+                ("element1", "prefix1", "http://www.sun.com"));
+        SOAPElement el2 = el1.addChildElement(se.createName
+                ("element2", "prefix2", "http://www.apache.org"));
+        
+        org.apache.axis.soap.SOAPEnvelope omEnv = ((SOAPEnvelopeImpl)se).getOMEnvelope();
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        msg.writeTo(baos);
+        
+        String xml = new String(baos.toByteArray());
+        System.out.println(xml);
+        assertTrue(xml.indexOf("prefix1") != -1);
+        assertTrue(xml.indexOf("prefix2") != -1);
+        assertTrue(xml.indexOf("http://www.sun.com") != -1);
+        assertTrue(xml.indexOf("http://www.apache.org") != -1);
+    }
+    
+   /* public void testAttribute() throws Exception {
+        String soappacket = "<SOAP-ENV:Envelope xmlns:SOAP-ENV =\"http://schemas.xmlsoap.org/soap/envelope/\"" + 
+                            "xmlns:xsi =\"http://www.w3.org/1999/XMLSchema-instance\"" +
+                            "xmlns:xsd =\"http://www.w3.org/1999/XMLSchema\">" + 
+                            "<SOAP-ENV:Body>" +
+                            "<helloworld name=\"tester\" />" + 
+                            "</SOAP-ENV:Body>" +
+                            "</SOAP-ENV:Envelope>";
+        SOAPMessage msg = MessageFactory.newInstance().createMessage(new MimeHeaders(), new ByteArrayInputStream(soappacket.getBytes()));
+        SOAPBody body = msg.getSOAPPart().getEnvelope().getBody();
+        msg.writeTo(System.out);
+
+        SOAPElement ele = (SOAPElement) body.getChildElements().next();
+        java.util.Iterator attit = ele.getAllAttributes();
+
+        System.out.println(attit.next().getClass());
+        
+        javax.xml.soap.Name n = (javax.xml.soap.Name) attit.next();
+        //assertEquals("Test fail prefix problem",n.getQualifiedName(),"name");
+    }*/
+
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestSOAPBody.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestSOAPBody.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestSOAPBody.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestSOAPBody.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,94 @@
+/*
+ * Created on Apr 13, 2005
+ *
+ */
+package org.apache.axis.saaj;
+
+import java.util.Iterator;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.framework.Test;
+
+/**
+ * @author Ashutosh Shahi ashutosh.shahi@gmail.com
+ *
+ */
+public class TestSOAPBody extends TestCase {
+
+    /**
+     * Method suite
+     *
+     * @return
+     */
+  /*  public static Test suite() {
+        return new TestSuite(test.message.TestSOAPBody.class);
+    }
+  */
+    /**
+     * Method main
+     *
+     * @param argv
+     */
+    public static void main(String[] argv) throws Exception {
+        TestSOAPBody tester = new TestSOAPBody("TestSOAPBody");
+        tester.testSoapBodyBUG();
+    }
+
+    /**
+     * Constructor TestSOAPBody
+     *
+     * @param name
+     */
+    public TestSOAPBody(String name) {
+        super(name);
+    }
+    
+    /**
+     * Method testSoapBodyBUG
+     *
+     * @throws Exception
+     */
+    public void testSoapBodyBUG() throws Exception {
+    	
+    	MessageFactory fact = MessageFactory.newInstance();
+    	SOAPMessage message = fact.createMessage();
+    	SOAPPart soapPart = message.getSOAPPart();
+    	SOAPEnvelopeImpl env = (SOAPEnvelopeImpl)soapPart.getEnvelope();
+    	SOAPHeader header = env.getHeader();
+    	Name hns = env.createName("Hello","shw", "http://www.jcommerce.net/soap/ns/SOAPHelloWorld");
+    	SOAPElement headElmnt = header.addHeaderElement(hns);
+    	Name hns1 = env.createName("Myname","shw", "http://www.jcommerce.net/soap/ns/SOAPHelloWorld");
+    	SOAPElement myName = headElmnt.addChildElement(hns1);
+    	myName.addTextNode("Tony");
+    	Name ns =  env.createName("Address", "shw", "http://www.jcommerce.net/soap/ns/SOAPHelloWorld");
+    	SOAPBody body = env.getBody();
+    	SOAPElement bodyElmnt =  body.addBodyElement(ns);
+    	Name ns1 =  env.createName("City", "shw", "http://www.jcommerce.net/soap/ns/SOAPHelloWorld");
+    	SOAPElement city = bodyElmnt.addChildElement(ns1);
+    	city.addTextNode("GENT");
+    	
+    	Iterator it = body.getChildElements();
+    	int count = 0;
+    	
+        while (it.hasNext()) {
+            SOAPElement el = (SOAPElement) it.next();
+            count++;
+            Name name = el.getElementName();
+            System.out.println("Element:" + el);
+            System.out.println("BODY ELEMENT NAME:" + name.getPrefix() + ":"
+                    + name.getLocalName() + " " + name.getURI());
+        }
+        assertTrue(count == 1);
+    }
+
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestSOAPElement.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestSOAPElement.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestSOAPElement.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestSOAPElement.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,57 @@
+/*
+ * Created on Apr 27, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.saaj;
+
+import junit.framework.TestCase;
+
+import javax.xml.soap.SOAPElement;
+import java.util.List;
+
+/**
+ * @author Ashutosh Shahi ashutosh.shahi@gmail.com	
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class TestSOAPElement extends TestCase {
+	
+	private SOAPElement soapElem;
+	
+    protected void setUp() throws Exception
+    {
+        soapElem = SOAPFactoryImpl.newInstance().createElement( "Test", "test", "http://test.apache.org/" );
+    }
+
+    public void testAddTextNode() throws Exception
+    {
+        assertNotNull( soapElem );
+        final String value = "foo";
+        soapElem.addTextNode( value );
+        assertEquals( value, soapElem.getValue() );
+        TextImpl text = assertContainsText( soapElem );
+        assertEquals( value, text.getValue() );
+    }
+
+    private TextImpl assertContainsText( SOAPElement soapElem ){
+    	assertTrue( soapElem.hasChildNodes() );
+    	List childElems = toList( soapElem.getChildElements() );
+    	assertTrue( childElems.size() == 1 );
+    	NodeImpl node = (NodeImpl) childElems.get( 0 );
+    	assertTrue( node instanceof TextImpl );
+    	return (TextImpl) node;
+    }
+    
+    private List toList( java.util.Iterator iter )
+    {
+        List list = new java.util.ArrayList();
+        while ( iter.hasNext() )
+        {
+            list.add( iter.next() );
+        }
+        return list;
+    }
+}

Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestSOAPEnvelope.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestSOAPEnvelope.java?rev=179794&view=auto
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestSOAPEnvelope.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/test/org/apache/axis/saaj/TestSOAPEnvelope.java Fri Jun  3 07:08:11 2005
@@ -0,0 +1,107 @@
+/*
+ * Created on Apr 13, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.axis.saaj;
+
+import junit.framework.TestCase;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+
+
+/**
+ * @author shaas02
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class TestSOAPEnvelope extends TestCase {
+	
+    public TestSOAPEnvelope(String name) {
+        super(name);
+    }
+    
+    public void testName() throws Exception {
+        SOAPEnvelope env = new org.apache.axis.saaj.SOAPEnvelopeImpl();
+        Name n = env.createName("local", "pref", "urn:blah");
+        assertEquals("local part of name did not match", "local",
+                     n.getLocalName());
+        assertEquals("qname of name did not match", "pref:local",
+                     n.getQualifiedName());
+        assertEquals("prefix of name did not match", "pref",
+                     n.getPrefix());
+        assertEquals("uri of name did not match", "urn:blah",
+                     n.getURI());
+        Name n2 = env.createName("loc");
+        assertEquals("local part of name2 did not match", "loc",
+                     n2.getLocalName());
+    }
+    
+    public void testHeader() throws Exception {
+        SOAPEnvelope env = new org.apache.axis.saaj.SOAPEnvelopeImpl();
+        SOAPHeader h1 = env.getHeader();
+        assertTrue("null initial header", h1 != null);
+        h1.detachNode();
+        assertTrue("header not freed", env.getHeader() == null);
+        SOAPHeader h2 = env.addHeader();
+        assertTrue("null created header", h2 != null);
+        assertEquals("wrong header retrieved", h2, env.getHeader());
+        assertEquals("header parent incorrect", env, h2.getParentElement());
+        
+        try {
+            env.addHeader();
+            assertTrue("second header added", false);
+        } catch (SOAPException e) {
+        }
+    }
+
+    public void testBody() throws Exception {
+        SOAPEnvelope env = new org.apache.axis.saaj.SOAPEnvelopeImpl();
+        SOAPBody b1 = env.getBody();
+        assertTrue("null initial body", b1 != null);
+        b1.detachNode();
+        assertTrue("body not freed", env.getBody() == null);
+        SOAPBody b2 = env.addBody();
+        assertTrue("null created body", b2 != null);
+        assertEquals("wrong body retrieved", b2, env.getBody());
+        assertEquals("body parent incorrect", env, b2.getParentElement());
+        try {
+            env.addBody();
+            assertTrue("second body added", false);
+        } catch (SOAPException e) {
+        }
+    }
+    
+	/*public void testNullpointer() throws Exception{
+		org.apache.axis.saaj.SOAPEnvelopeImpl env=new org.apache.axis.saaj.SOAPEnvelopeImpl();
+		SOAPBodyElementImpl bdy=new SOAPBodyElementImpl();
+		bdy.setName("testResponse");
+		env.addBodyElement(bdy);
+		Message msg=new Message(env);
+		SOAPBodyElement sbe = msg.getSOAPEnvelope().getBodyByName(null,"testResponse");
+        assertTrue(sbe != null);
+	}
+	
+    public void testNullpointerInHeader() throws Exception{
+		org.apache.axis.saaj.SOAPEnvelopeImpl env=new org.apache.axis.saaj.SOAPEnvelopeImpl();
+		SOAPHeaderElementImpl hdr=new SOAPHeaderElementImpl("", "testHeader");
+		env.addHeader(hdr);
+		Message msg=new Message(env);
+		SOAPHeaderElement she = msg.getSOAPEnvelope().getHeaderByName(null,"testHeader");
+        assertTrue(she != null);
+	}*/
+    
+    public static void main(String args[]) throws Exception {
+        TestSOAPEnvelope tester = new TestSOAPEnvelope("TestSOAPEnvelope");
+        tester.testName();
+        tester.testHeader();
+        tester.testBody();
+    }
+
+}



Mime
View raw message