You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ve...@apache.org on 2005/03/23 10:38:53 UTC
svn commit: r158750 [3/3] - in
webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj: ./ src/
src/java/ src/java/javax/ src/java/javax/xml/ src/java/javax/xml/namespace/
src/java/javax/xml/soap/ src/java/org/ src/java/org/apache/
src/java/org/apache/axis/ src/java/org/apache/axis/saaj/ src/test/
src/test/org/ src/test/org/apache/ src/test/org/apache/axis/
src/test/org/apache/axis/saaj/
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/javax/xml/soap/SOAPPart.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/javax/xml/soap/SOAPPart.java?view=auto&rev=158750
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/javax/xml/soap/SOAPPart.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/javax/xml/soap/SOAPPart.java Wed Mar 23 01:38:46 2005
@@ -0,0 +1,261 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.soap;
+
+import javax.xml.transform.Source;
+import java.util.Iterator;
+
+/**
+ * <P>The container for the SOAP-specific portion of a <CODE>
+ * SOAPMessage</CODE> object. All messages are required to have a
+ * SOAP part, so when a <CODE>SOAPMessage</CODE> object is
+ * created, it will automatically have a <CODE>SOAPPart</CODE>
+ * object.</P>
+ *
+ * <P>A <CODE>SOAPPart</CODE> object is a MIME part and has the
+ * MIME headers Content-Id, Content-Location, and Content-Type.
+ * Because the value of Content-Type must be "text/xml", a <CODE>
+ * SOAPPart</CODE> object automatically has a MIME header of
+ * Content-Type with its value set to "text/xml". The value must
+ * be "text/xml" because content in the SOAP part of a message
+ * must be in XML format. Content that is not of type "text/xml"
+ * must be in an <CODE>AttachmentPart</CODE> object rather than in
+ * the <CODE>SOAPPart</CODE> object.</P>
+ *
+ * <P>When a message is sent, its SOAP part must have the MIME
+ * header Content-Type set to "text/xml". Or, from the other
+ * perspective, the SOAP part of any message that is received must
+ * have the MIME header Content-Type with a value of
+ * "text/xml".</P>
+ *
+ * <P>A client can access the <CODE>SOAPPart</CODE> object of a
+ * <CODE>SOAPMessage</CODE> object by calling the method <CODE>
+ * SOAPMessage.getSOAPPart</CODE>. The following line of code, in
+ * which <CODE>message</CODE> is a <CODE>SOAPMessage</CODE>
+ * object, retrieves the SOAP part of a message.</P>
+ * <PRE>
+ * SOAPPart soapPart = message.getSOAPPart();
+ * </PRE>
+ *
+ * <P>A <CODE>SOAPPart</CODE> object contains a <CODE>
+ * SOAPEnvelope</CODE> object, which in turn contains a <CODE>
+ * SOAPBody</CODE> object and a <CODE>SOAPHeader</CODE> object.
+ * The <CODE>SOAPPart</CODE> method <CODE>getEnvelope</CODE> can
+ * be used to retrieve the <CODE>SOAPEnvelope</CODE> object.</P>
+ */
+public abstract class SOAPPart implements org.w3c.dom.Document {
+
+ public SOAPPart() {}
+
+ /**
+ * Gets the <CODE>SOAPEnvelope</CODE> object associated with
+ * this <CODE>SOAPPart</CODE> object. Once the SOAP envelope is
+ * obtained, it can be used to get its contents.
+ * @return the <CODE>SOAPEnvelope</CODE> object for this <CODE>
+ * SOAPPart</CODE> object
+ * @throws SOAPException if there is a SOAP error
+ */
+ public abstract SOAPEnvelope getEnvelope() throws SOAPException;
+
+ /**
+ * Retrieves the value of the MIME header whose name is
+ * "Content-Id".
+ * @return a <CODE>String</CODE> giving the value of the MIME
+ * header named "Content-Id"
+ * @see #setContentId(java.lang.String) setContentId(java.lang.String)
+ */
+ public String getContentId() {
+
+ String as[] = getMimeHeader("Content-Id");
+
+ if (as != null && as.length > 0) {
+ return as[0];
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Retrieves the value of the MIME header whose name is
+ * "Content-Location".
+ * @return a <CODE>String</CODE> giving the value of the MIME
+ * header whose name is "Content-Location"
+ * @see #setContentLocation(java.lang.String) setContentLocation(java.lang.String)
+ */
+ public String getContentLocation() {
+
+ String as[] = getMimeHeader("Content-Location");
+
+ if (as != null && as.length > 0) {
+ return as[0];
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Sets the value of the MIME header named "Content-Id" to
+ * the given <CODE>String</CODE>.
+ * @param contentId a <CODE>String</CODE> giving
+ * the value of the MIME header "Content-Id"
+ * @throws java.lang.IllegalArgumentException if
+ * there is a problem in setting the content id
+ * @see #getContentId() getContentId()
+ */
+ public void setContentId(String contentId) {
+ setMimeHeader("Content-Id", contentId);
+ }
+
+ /**
+ * Sets the value of the MIME header "Content-Location" to
+ * the given <CODE>String</CODE>.
+ * @param contentLocation a <CODE>String</CODE>
+ * giving the value of the MIME header
+ * "Content-Location"
+ * @throws java.lang.IllegalArgumentException if
+ * there is a problem in setting the content location.
+ * @see #getContentLocation() getContentLocation()
+ */
+ public void setContentLocation(String contentLocation) {
+ setMimeHeader("Content-Location", contentLocation);
+ }
+
+ /**
+ * 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 abstract void removeMimeHeader(String header);
+
+ /**
+ * Removes all the <CODE>MimeHeader</CODE> objects for this
+ * <CODE>SOAPEnvelope</CODE> object.
+ */
+ public abstract void removeAllMimeHeaders();
+
+ /**
+ * 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 abstract String[] getMimeHeader(String 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
+ * @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 abstract void setMimeHeader(String name, String value);
+
+ /**
+ * Creates a <CODE>MimeHeader</CODE> object with the specified
+ * name and value and adds it to this <CODE>SOAPPart</CODE>
+ * object. If a <CODE>MimeHeader</CODE> with the specified
+ * name already exists, this method adds the specified value
+ * to the already existing value(s).
+ *
+ * <P>Note that RFC822 headers can contain only US-ASCII
+ * characters.</P>
+ *
+ * @param name a <CODE>String</CODE> giving the
+ * header name
+ * @param value a <CODE>String</CODE> giving the
+ * value to be set or added
+ * @throws java.lang.IllegalArgumentException if
+ * there was a problem with the specified mime header name
+ * or value
+ */
+ public abstract void addMimeHeader(String name, String 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 abstract Iterator getAllMimeHeaders();
+
+ /**
+ * Retrieves all <CODE>MimeHeader</CODE> objects that match
+ * a name in the given array.
+ * @param names a <CODE>String</CODE> array with
+ * the name(s) of the MIME headers to be returned
+ * @return all of the MIME headers that match one of the names
+ * in the given array, returned as an <CODE>Iterator</CODE>
+ * object
+ */
+ public abstract Iterator getMatchingMimeHeaders(String names[]);
+
+ /**
+ * Retrieves all <CODE>MimeHeader</CODE> objects whose name
+ * does not match a name in the given array.
+ * @param names a <CODE>String</CODE> array with
+ * the name(s) of the MIME headers not to be returned
+ * @return all of the MIME headers in this <CODE>SOAPPart</CODE>
+ * object except those that match one of the names in the
+ * given array. The nonmatching MIME headers are returned as
+ * an <CODE>Iterator</CODE> object.
+ */
+ public abstract Iterator getNonMatchingMimeHeaders(String names[]);
+
+ /**
+ * Sets the content of the <CODE>SOAPEnvelope</CODE> object
+ * with the data from the given <CODE>Source</CODE> object.
+ * @param source javax.xml.transform.Source</CODE> object with the data to
+ * be set
+ * @throws SOAPException if there is a problem in
+ * setting the source
+ * @see #getContent() getContent()
+ */
+ public abstract void setContent(Source source) throws SOAPException;
+
+ /**
+ * Returns the content of the SOAPEnvelope as a JAXP <CODE>
+ * Source</CODE> object.
+ * @return the content as a <CODE>
+ * javax.xml.transform.Source</CODE> object
+ * @throws SOAPException if the implementation cannot
+ * convert the specified <CODE>Source</CODE> object
+ * @see #setContent(javax.xml.transform.Source) setContent(javax.xml.transform.Source)
+ */
+ public abstract Source getContent() throws SOAPException;
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/javax/xml/soap/Text.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/javax/xml/soap/Text.java?view=auto&rev=158750
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/javax/xml/soap/Text.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/javax/xml/soap/Text.java Wed Mar 23 01:38:46 2005
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.soap;
+
+/**
+ * A representation of a node whose value is text. A <CODE>
+ * Text</CODE> object may represent text that is content or text
+ * that is a comment.
+ */
+public interface Text extends Node, org.w3c.dom.Text {
+
+ /**
+ * Retrieves whether this <CODE>Text</CODE> object
+ * represents a comment.
+ * @return <CODE>true</CODE> if this <CODE>Text</CODE> object is
+ * a comment; <CODE>false</CODE> otherwise
+ */
+ public abstract boolean isComment();
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/DetailEntryImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/DetailEntryImpl.java?view=auto&rev=158750
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/DetailEntryImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/DetailEntryImpl.java Wed Mar 23 01:38:46 2005
@@ -0,0 +1,39 @@
+/*
+ * Created on Mar 17, 2005
+ *
+ */
+package org.apache.axis.saaj;
+
+import javax.xml.soap.DetailEntry;
+
+/**
+ * Class DetailEntryImpl
+ *
+ * @author Ashutosh Shahi
+ * ashutosh.shahi@gmail.com
+ */
+public class DetailEntryImpl extends SOAPElementImpl implements DetailEntry {
+
+ /**
+ * Field detailEntry
+ */
+ private org.apache.axis.om.OMElement detailEntry;
+
+ /**
+ * Constructor DetailEntryImpl
+ *
+ */
+ public DetailEntryImpl(){
+
+ }
+
+ /**
+ * Constructor DetailEntryImpl
+ *
+ * @param detailEntry
+ */
+ public DetailEntryImpl(org.apache.axis.om.OMElement detailEntry){
+ this.detailEntry = detailEntry;
+ }
+
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/DetailImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/DetailImpl.java?view=auto&rev=158750
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/DetailImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/DetailImpl.java Wed Mar 23 01:38:46 2005
@@ -0,0 +1,99 @@
+/*
+ * Created on Mar 17, 2005
+ *
+ */
+package org.apache.axis.saaj;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.xml.soap.Detail;
+import javax.xml.soap.DetailEntry;
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPException;
+
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.impl.llom.OMElementImpl;
+
+/**
+ * Class DetailImpl
+ *
+ * @author Ashutosh Shahi
+ * ashutosh.shahi@gmail.com
+ */
+public class DetailImpl extends SOAPFaultElementImpl implements Detail {
+
+ /**
+ * Field detail
+ */
+ OMElement detail;
+
+ /**
+ * Constructor DetailImpl
+ *
+ * @param detailName
+ * @param parent
+ */
+ public DetailImpl(javax.xml.namespace.QName detailName, OMElement parent){
+ detail = new OMElementImpl(detailName, parent);
+ }
+
+ /*public DetailImpl(OMElement detail){
+ this.detail = detail;
+ }*/
+
+ /**
+ * Method addDetailEntry
+ *
+ * @param name
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.Detail#addDetailEntry(javax.xml.soap.Name)
+ */
+ public DetailEntry addDetailEntry(Name name) throws SOAPException {
+
+ // Create a OMElement and add it as a child of Detail
+ // May need change after OM allows adding multiple detailEntries
+ // as then we can delegate the task there rather than dealing with OMElement here
+ String localName = name.getLocalName();
+ OMNamespace ns = new org.apache.axis.om.impl.llom.OMNamespaceImpl(name.getURI(), name.getPrefix());
+ OMElement detailEntry = new org.apache.axis.om.impl.llom.OMElementImpl(localName, ns);
+ detail.addChild(detailEntry);
+ return (DetailEntry)(new DetailEntryImpl(detailEntry));
+ }
+
+ /**
+ * Method addDetailEntry
+ *
+ * @param detailEntry
+ * @return
+ */
+ protected DetailEntry addDetailEntry(org.apache.axis.om.OMNode detailEntry){
+ detail.addChild(detailEntry);
+ return (DetailEntry)(new DetailEntryImpl((OMElement)detailEntry));
+ }
+
+ /**
+ * Method getDetailEntries
+ *
+ * @return
+ * @see javax.xml.soap.Detail#getDetailEntries()
+ */
+ public Iterator getDetailEntries() {
+ // Get the detailEntried which will be omElements
+ // convert them to soap DetailEntry and return the iterator
+ Iterator detailEntryIter = detail.getChildren();
+ ArrayList aList = new ArrayList();
+ while(detailEntryIter.hasNext()){
+ Object o = detailEntryIter.next();
+ if(o instanceof org.apache.axis.om.OMElement){
+ OMElement omDetailEntry = (OMElement)o;
+ DetailEntry detailEntry = new DetailEntryImpl(omDetailEntry);
+ aList.add(detailEntry);
+ }
+ }
+ return aList.iterator();
+ }
+
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/NodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/NodeImpl.java?view=auto&rev=158750
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/NodeImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/NodeImpl.java Wed Mar 23 01:38:46 2005
@@ -0,0 +1,397 @@
+/*
+ * Created on Mar 16, 2005
+ *
+ */
+package org.apache.axis.saaj;
+
+import java.util.Iterator;
+
+import javax.xml.soap.Node;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+
+import org.apache.axis.om.OMAttribute;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.NodeList;
+
+/**
+ * Class NodeImpl
+ *
+ * @author Ashutosh Shahi
+ * ashutosh.shahi@gmail.com
+ */
+public class NodeImpl implements Node {
+
+ /**
+ * Field omNode
+ */
+ private org.apache.axis.om.OMNode omNode;
+ /**
+ * field document
+ */
+ private org.w3c.dom.Document document;
+
+ /**
+ * Constructor NodeImpl
+ *
+ */
+ public NodeImpl(){
+
+ }
+
+ /**
+ * Constructor NodeImpl
+ *
+ * @param node
+ */
+ public NodeImpl(OMNode node){
+ this.omNode = node;
+ }
+ /**
+ * Constructor NodeImpl
+ *
+ * @param attrib
+ */
+ public NodeImpl(OMAttribute attrib){
+
+ // To be implemented
+ // Find out a way to construct OMNode from a OMAttribute
+ // as OMAttributes are immutable
+ }
+
+ /**
+ * Constructor NodeImpl
+ *
+ * @param ns
+ */
+ public NodeImpl(OMNamespace ns){
+
+ // To be implemented
+ // Find out a way to construct OMNode from OMNamespace
+ // OMNamespace is immutable
+ }
+
+ /**
+ * Method getValue
+ *
+ * @see javax.xml.soap.Node#getValue()
+ */
+ public String getValue() {
+
+ return omNode.getValue();
+ }
+
+ /**
+ * Method setParentElement
+ * @param parent
+ *
+ * @see javax.xml.soap.Node#setParentElement(javax.xml.soap.SOAPElement)
+ */
+ public void setParentElement(SOAPElement parent) throws SOAPException {
+
+ OMElement omParent = ((SOAPElementImpl)parent).getOMElement();
+ omNode.setParent(omParent);
+ }
+
+ /**
+ * Method getParentElement
+ * @see javax.xml.soap.Node#getParentElement()
+ */
+ public SOAPElement getParentElement() {
+
+ OMElement omParent = omNode.getParent();
+ return new SOAPElementImpl(omParent);
+ }
+
+ /**
+ * Method detachNode
+ * @see javax.xml.soap.Node#detachNode()
+ */
+ public void detachNode() {
+
+ omNode.detach();
+ }
+
+ /**
+ * Method recycleNode
+ * @see javax.xml.soap.Node#recycleNode()
+ */
+ public void recycleNode() {
+ // No corresponding implementation in OM
+ // There is no implementation in Axis 1.2 also
+
+ }
+
+ /**
+ * Method setValue
+ * @param value
+ *
+ * @see javax.xml.soap.Node#setValue(java.lang.String)
+ */
+ public void setValue(String value) {
+ omNode.setValue(value);
+ }
+
+ /**
+ * Method getNodeType
+ * @see org.w3c.dom.Node#getNodeType()
+ */
+ public short getNodeType() {
+
+ return omNode.getType();
+ }
+
+ /**
+ * Method normalize
+ * @see org.w3c.dom.Node#normalize()
+ */
+ public void normalize() {
+ // No corresponding function in OM
+ //Axis 1.2 also doesn't have any implementation for this
+
+ }
+
+ /**
+ * Method hasAttributes
+ * @see org.w3c.dom.Node#hasAttributes()
+ */
+ public boolean hasAttributes() {
+ if(omNode instanceof OMElement){
+ Iterator iter = ((OMElement)omNode).getAttributes();
+ return (iter.hasNext() ? true : false);
+ }
+ return false;
+ }
+
+ /**
+ * Method hasChildNodes
+ * @see org.w3c.dom.Node#hasChildNodes()
+ */
+ public boolean hasChildNodes() {
+ if(omNode instanceof OMElement){
+ Iterator iter = ((OMElement)omNode).getChildren();
+ return (iter.hasNext() ? true : false);
+ }
+ return false;
+ }
+
+ /**
+ * Method getLocalName
+ * @see org.w3c.dom.Node#getLocalName()
+ */
+ public String getLocalName() {
+ if(omNode.getType() == ELEMENT_NODE || omNode.getType()
+ == ATTRIBUTE_NODE)
+ return omNode.getValue();
+ return null;
+ }
+
+ /**
+ * Method getNamespaceURI
+ * @see org.w3c.dom.Node#getNamespaceURI()
+ */
+ public String getNamespaceURI() {
+ // Could not find any method to access the namespace
+ // of the omNode.omElement allows to declare Namespace for
+ // in the context of current element, and stores them in a hashmap
+ // but no way to find which one was used to create the current node
+ return null;
+ }
+
+ /**
+ * Method getNodeName
+ * @see org.w3c.dom.Node#getNodeName()
+ */
+ public String getNodeName() {
+ // Returning the local name of the node if it is element
+ // or attribute, null otherwise
+ // Don't know if it is correct, may need to change
+ if(omNode.getType() == ELEMENT_NODE || omNode.getType()
+ == ATTRIBUTE_NODE)
+ return omNode.getValue();
+ return null;
+ }
+
+ /**
+ * Method getNodeValue
+ * @see org.w3c.dom.Node#getNodeValue()
+ */
+ public String getNodeValue() throws DOMException {
+ // Doing a get value on omNode
+ // Will be text for TEXT_NODE, and localname for
+ // ELEMENT_NODE and ATTRIBUTE_NODE
+ return omNode.getValue();
+ }
+
+ /**
+ * Method getPrefix
+ * @see org.w3c.dom.Node#getPrefix()
+ */
+ public String getPrefix() {
+ // See the comments of getNamespaceURI, same applies here
+ return null;
+ }
+
+ /**
+ * Method setNodeValue
+ * @see org.w3c.dom.Node#setNodeValue(java.lang.String)
+ */
+ public void setNodeValue(String arg0) throws DOMException {
+ // call omNode's setValue
+ omNode.setValue(arg0);
+ }
+
+ /**
+ * Method setPrefix
+ * @see org.w3c.dom.Node#setPrefix(java.lang.String)
+ */
+ public void setPrefix(String arg0) throws DOMException {
+ // No way of setting prefix in omNode or omElement without uri
+ // also, prefix and uri can be set only in constructor,
+ // later on we have declareNamespace method which allows namespace
+ //to be created in current element scope, but can't change the namespace
+ // for the current element
+
+ }
+
+ /**
+ * Method setOwnerDocument
+ * @param doc
+ */
+ public void setOwnerDocument(Document doc){
+ // method not part of org.w3c.dom.Node, created to set the document
+ this.document = doc;
+ }
+
+ /**
+ * Method getOwnerDocument
+ * @see org.w3c.dom.Node#getOwnerDocument()
+ */
+ public Document getOwnerDocument() {
+ // return the set document
+ return document;
+ }
+
+ /**
+ * Method getAttributes
+ * @see org.w3c.dom.Node#getAttributes()
+ */
+ public NamedNodeMap getAttributes() {
+ // Will have to provide an implementation of NamedNodeMap
+ // Dropping for now
+ // TODO
+ Iterator iter = ((OMElement)omNode).getAttributes();
+
+ return null;
+ }
+
+ /**
+ * Method getFirstChild
+ * @see org.w3c.dom.Node#getFirstChild()
+ */
+ public org.w3c.dom.Node getFirstChild() {
+ //
+ OMNode child = ((OMElement)omNode).getFirstChild();
+ return new NodeImpl(child);
+ }
+
+ /**
+ * Method getLastChild
+ * @see org.w3c.dom.Node#getLastChild()
+ */
+ public org.w3c.dom.Node getLastChild() {
+ // No corresponding implementation in OMElement or OMNode
+ // TODO: Discuss with Venkat what needs to be done here
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Node#getNextSibling()
+ */
+ public org.w3c.dom.Node getNextSibling() {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Node#getParentNode()
+ */
+ public org.w3c.dom.Node getParentNode() {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Node#getPreviousSibling()
+ */
+ public org.w3c.dom.Node getPreviousSibling() {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Node#cloneNode(boolean)
+ */
+ public org.w3c.dom.Node cloneNode(boolean arg0) {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Node#getChildNodes()
+ */
+ public NodeList getChildNodes() {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Node#isSupported(java.lang.String, java.lang.String)
+ */
+ public boolean isSupported(String arg0, String arg1) {
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Node#appendChild(org.w3c.dom.Node)
+ */
+ public org.w3c.dom.Node appendChild(org.w3c.dom.Node arg0)
+ throws DOMException {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Node#removeChild(org.w3c.dom.Node)
+ */
+ public org.w3c.dom.Node removeChild(org.w3c.dom.Node arg0)
+ throws DOMException {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Node#insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)
+ */
+ public org.w3c.dom.Node insertBefore(org.w3c.dom.Node arg0,
+ org.w3c.dom.Node arg1) throws DOMException {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Node#replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)
+ */
+ public org.w3c.dom.Node replaceChild(org.w3c.dom.Node arg0,
+ org.w3c.dom.Node arg1) throws DOMException {
+
+ return null;
+ }
+
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/PrefixedQName.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/PrefixedQName.java?view=auto&rev=158750
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/PrefixedQName.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/PrefixedQName.java Wed Mar 23 01:38:46 2005
@@ -0,0 +1,123 @@
+/*
+ * Created on Mar 15, 2005
+ *
+ */
+package org.apache.axis.saaj;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.Name;
+
+/**
+ * Class Prefixed QName
+ *
+ * Took this implementation from Axis 1.2 code
+ */
+public class PrefixedQName implements Name {
+ /** comment/shared empty string */
+ private static final String emptyString = "".intern();
+
+ /**
+ * Field prefix
+ */
+ private String prefix;
+ /**
+ * Field qName
+ */
+ private QName qName;
+
+ /**
+ * Constructor PrefixedQName
+ * @param uri
+ * @param localName
+ * @param pre
+ */
+ public PrefixedQName(String uri, String localName, String pre) {
+ qName = new QName(uri, localName);
+ prefix = (pre == null)
+ ? emptyString
+ : pre.intern();
+ }
+
+ /**
+ * Constructor qname
+ * @param qname
+ * @return
+ */
+ public PrefixedQName(QName qname) {
+ this.qName = qname;
+ prefix = emptyString;
+ }
+
+ /**
+ * Method getLocalName
+ * @return
+ */
+ public String getLocalName() {
+ return qName.getLocalPart();
+ }
+
+ /**
+ * Method getQualifiedName
+ * @return
+ */
+ public String getQualifiedName() {
+ StringBuffer buf = new StringBuffer(prefix);
+ if(prefix != emptyString)
+ buf.append(':');
+ buf.append(qName.getLocalPart());
+ return buf.toString();
+ }
+
+ /**
+ * Method getURI
+ * @return
+ */
+ public String getURI() {
+ return qName.getNamespaceURI();
+ }
+
+ /**
+ * Method getPrefix
+ * @return
+ */
+ public String getPrefix() {
+ return prefix;
+ }
+
+ /**
+ * Method equals
+ * @param obj
+ * @return
+ */
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof PrefixedQName)) {
+ return false;
+ }
+ if (!qName.equals(((PrefixedQName)obj).qName)) {
+ return false;
+ }
+ if (prefix == ((PrefixedQName) obj).prefix) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Method hasCode
+ * @return
+ */
+ public int hashCode() {
+ return prefix.hashCode() + qName.hashCode();
+ }
+
+ /**
+ * Method toString
+ * @return
+ */
+ public String toString() {
+ return qName.toString();
+ }
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPBodyElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPBodyElementImpl.java?view=auto&rev=158750
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPBodyElementImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPBodyElementImpl.java Wed Mar 23 01:38:46 2005
@@ -0,0 +1,36 @@
+/*
+ * Created on Mar 16, 2005
+ *
+ */
+package org.apache.axis.saaj;
+
+import javax.xml.soap.SOAPBodyElement;
+
+import org.apache.axis.om.OMElement;
+
+/**
+ * Class SOAPBodeElementImpl
+ *
+ * @author Ashutosh Shahi
+ * ashutosh.shahi@gmail.com
+ */
+public class SOAPBodyElementImpl extends SOAPElementImpl implements
+ SOAPBodyElement {
+
+ /**
+ * Constructor SOAPBodeElementImpl
+ *
+ */
+ public SOAPBodyElementImpl(){
+ super();
+ }
+
+ /**
+ * Constructor SOAPBodeElementImpl
+ * @param bodyElement
+ */
+ public SOAPBodyElementImpl(OMElement bodyElement){
+ super(bodyElement);
+ }
+
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPBodyImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPBodyImpl.java?view=auto&rev=158750
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPBodyImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPBodyImpl.java Wed Mar 23 01:38:46 2005
@@ -0,0 +1,167 @@
+/*
+ * Created on Mar 16, 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.util.Locale;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPBodyElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
+
+import org.w3c.dom.Document;
+
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.impl.llom.OMElementImpl;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Class SOAPBodeImpl
+ *
+ * @author Jayachandra
+ * jayachandra@gmail.com
+ */
+public class SOAPBodyImpl extends SOAPElementImpl implements SOAPBody {
+ /**
+ * Field omSOAPBody
+ * omSOAPBody is the OM's SOAPBody object that is used for delegation purpose
+ */
+ private org.apache.axis.om.SOAPBody omSOAPBody;
+
+ /**
+ * Constructor SOAPBodeImpl
+ * The constructor to facilitate conversion of SAAJ SOAPBody out of OM SOAPBody
+ * @param omSoapBody
+ */
+ public SOAPBodyImpl(org.apache.axis.om.SOAPBody omSoapBody)
+ {
+ this.omSOAPBody = omSoapBody;
+ }
+
+ /**
+ * Method addFault
+ * @see javax.xml.soap.SOAPBody#addFault()
+ * @return
+ * @throws SOAPException
+ */
+ public SOAPFault addFault() throws SOAPException {
+ try{
+ //OM SOAPFaultImpl has SOAPFaultImpl(OMElement parent, Exception e) constructor, will use that
+ org.apache.axis.om.SOAPFault omSoapFault = new org.apache.axis.om.impl.llom.SOAPFaultImpl(omSOAPBody, new Exception("No explicit faultstring available"));
+ omSOAPBody.addFault(omSoapFault);
+ return (SOAPFault)(new SOAPFaultImpl(omSoapFault));
+ }catch(Exception e)
+ {
+ throw new SOAPException(e);
+ }
+ }
+
+ /**
+ * Method hasFault
+ * @see javax.xml.soap.SOAPBody#hasFault()
+ * @return
+ */
+ public boolean hasFault() {
+ return omSOAPBody.hasFault();
+ }
+
+ /**
+ * Method getFault
+ * @see javax.xml.soap.SOAPBody#getFault()
+ * @return
+ */
+ public SOAPFault getFault() {
+ return (SOAPFault)(new SOAPFaultImpl(omSOAPBody.getFault()));
+ }
+
+ /**
+ * Method addBodyElement
+ * @param name
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPBody#addBodyElement(javax.xml.soap.Name)
+ */
+ public SOAPBodyElement addBodyElement(Name name) throws SOAPException {
+
+ try {
+ //QName qname = new QName(name.getURI(), name.getLocalName());
+ QName qname = new QName(name.getURI(), name.getLocalName(), name.getPrefix());
+ OMElement bodyElement = new OMElementImpl(qname, omSOAPBody);
+ omSOAPBody.addChild(bodyElement);
+ return (SOAPBodyElement)(new SOAPBodyElementImpl(bodyElement));
+ } catch (Exception e)
+ {
+ throw new SOAPException(e);
+ }
+ }
+
+ /**
+ * Method addFault
+ * @param faultCode
+ * @param faultString
+ * @param
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPBody#addFault(javax.xml.soap.Name, java.lang.String, java.util.Locale)
+ */
+ public SOAPFault addFault(Name faultCode, String faultString, Locale locale)
+ throws SOAPException {
+ try{
+ //OM SOAPFaultImpl has SOAPFaultImpl(OMElement parent, Exception e) constructor, will use that
+ //actually soap fault is created with the OM's default SOAPFAULT_LOCALNAME and PREFIX, b'coz I've droppe the name param
+ //a work around can be possible but would be confusing as there is no straight forward soapfault constructor in om.
+ //So am deferring it.
+ //even locale param is dropped, don't know how to handle it at the moment. so dropped it.
+ org.apache.axis.om.SOAPFault omSoapFault = new org.apache.axis.om.impl.llom.SOAPFaultImpl(omSOAPBody, new Exception(faultString));
+ omSOAPBody.addFault(omSoapFault);
+ return (SOAPFault)(new SOAPFaultImpl(omSoapFault));
+ }catch(Exception e)
+ {
+ throw new SOAPException(e);
+ }
+ }
+
+ /**
+ * Method addFault
+ * @param faultCode
+ * @param faultString
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPBody#addFault(javax.xml.soap.Name, java.lang.String)
+ */
+ public SOAPFault addFault(Name faultCode, String faultString)
+ throws SOAPException {
+ try{
+ //OM SOAPFaultImpl has SOAPFaultImpl(OMElement parent, Exception e) constructor, will use that
+ //actually soap fault is created with the OM's default SOAPFAULT_LOCALNAME and PREFIX, b'coz I've droppe the name param
+ //a work around can be possible but would be confusing as there is no straight forward soapfault constructor in om.
+ //So am deferring it.
+ org.apache.axis.om.SOAPFault omSoapFault = new org.apache.axis.om.impl.llom.SOAPFaultImpl(omSOAPBody, new Exception(faultString));
+ omSOAPBody.addFault(omSoapFault);
+ return (SOAPFault)(new SOAPFaultImpl(omSoapFault));
+ }catch(Exception e)
+ {
+ throw new SOAPException(e);
+ }
+ }
+
+ /**
+ * Method addDocument
+ * @param document
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPBody#addDocument(org.w3c.dom.Document)
+ */
+ public SOAPBodyElement addDocument(Document document) throws SOAPException {
+ /*
+ * Don't know how to resolve this as yet. So deferring it.
+ */
+ return null;
+ }
+
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPElementImpl.java?view=auto&rev=158750
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPElementImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPElementImpl.java Wed Mar 23 01:38:46 2005
@@ -0,0 +1,508 @@
+/*
+ * Created on Mar 17, 2005
+ *
+ */
+package org.apache.axis.saaj;
+
+import java.util.Iterator;
+
+import javax.xml.soap.Name;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.NodeList;
+
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+/**
+ * Class SOAPElementImpl
+ *
+ * @author Jayachandra
+ * jayachandra@gmail.com
+ */
+public class SOAPElementImpl extends NodeImpl implements SOAPElement {
+ /**
+ * Field omElement
+ * The corresponding OM object for SOAPElement is OMElement, so we would
+ * have a datamember of type OMElement in this class
+ */
+ protected org.apache.axis.om.OMElement omElement;
+
+ /**
+ * Constructor SOAPElementImpl
+ * The standard constructor of being able to create soapelement given a omElement
+ * @param omElement
+ */
+ public SOAPElementImpl(org.apache.axis.om.OMElement omElement)
+ {
+ this.omElement = omElement;
+ }
+
+ /**
+ * Constructor SOAPElementImpl
+ * The empty constructor
+ */
+ public SOAPElementImpl() {
+ }
+
+ /**
+ * Method getOMElement
+ * getter method on the data member omElement
+ * @return
+ */
+ public org.apache.axis.om.OMElement getOMElement() {
+ return this.omElement;
+ }
+
+ /**
+ * Method addChildElement
+ * @param name
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPElement#addChildElement(javax.xml.soap.Name)
+ */
+ public SOAPElement addChildElement(Name name) throws SOAPException {
+ //We will create a new OMElement and add that as a child to the OMElement datamember that
+ //we are carrying along. And return back a wrapped SOAPElement corresponding to the
+ //created OMElement
+
+ //Since a <code>Name</code> object is given as parameter we should try to create an OMElement
+ //and register it with the contents of the <code>name</code> element
+ org.apache.axis.om.OMElement newOMElement = new org.apache.axis.om.impl.llom.OMElementImpl(new QName(name.getURI(), name.getLocalName(), name.getPrefix()), omElement);
+ omElement.addChild(newOMElement);
+ return (SOAPElement)(new SOAPElementImpl(newOMElement));
+ }
+
+ /**
+ * Method addChildElement
+ * @param localName
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPElement#addChildElement(java.lang.String)
+ */
+ public SOAPElement addChildElement(String localName) throws SOAPException {
+ //We will create a new OMElement and add that as a child to the OMElement datamember that
+ //we are carrying along. And return back a wrapped SOAPElement corresponding to the
+ //created OMElement
+ org.apache.axis.om.OMElement newOMElement = new org.apache.axis.om.impl.llom.OMElementImpl(new QName(localName), omElement);
+ omElement.addChild(newOMElement);
+ return (SOAPElement)(new SOAPElementImpl(newOMElement));
+ }
+
+ /**
+ * Method addChildElement
+ * @param localName
+ * @param prefix
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPElement#addChildElement(java.lang.String, java.lang.String)
+ */
+ public SOAPElement addChildElement(String localName, String prefix)
+ throws SOAPException {
+ org.apache.axis.om.OMElement newOMElement = new org.apache.axis.om.impl.llom.OMElementImpl(new QName(null,localName,prefix), omElement);
+ omElement.addChild(newOMElement);
+ return (SOAPElement)(new SOAPElementImpl(newOMElement));
+ }
+
+ /**
+ * Method addChileElement
+ * @param localName
+ * @param prefix
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPElement#addChildElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public SOAPElement addChildElement(String localName, String prefix,
+ String uri) throws SOAPException {
+ org.apache.axis.om.OMElement newOMElement = new org.apache.axis.om.impl.llom.OMElementImpl(new QName(uri,localName,prefix), omElement);
+ omElement.addChild(newOMElement);
+ return (SOAPElement)(new SOAPElementImpl(newOMElement));
+ }
+
+ /**
+ * Method addChileElement
+ * @param element
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPElement#addChildElement(javax.xml.soap.SOAPElement)
+ */
+ public SOAPElement addChildElement(SOAPElement element)
+ throws SOAPException {
+ //TODO:
+ //The fragment rooted in element is either added as a whole or not at all, if there was an error.
+ //The fragment rooted in element cannot contain elements named Envelope, Header or Body
+ //and in the SOAP namespace. Any namespace prefixes present in the fragment should be fully
+ //resolved using appropriate namespace declarations within the fragment itself.
+
+ org.apache.axis.om.OMElement omElementToAdd = ((SOAPElementImpl)element).getOMElement();
+ omElementToAdd.setParent(omElement);
+ omElement.addChild(omElementToAdd);
+ return (SOAPElement)(new SOAPElementImpl(omElementToAdd));
+ }
+
+ /**
+ * Method addTextNode
+ * @param text
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPElement#addTextNode(java.lang.String)
+ */
+ public SOAPElement addTextNode(String text) throws SOAPException {
+ //This doesn't seem to have support directly in OM
+ //But work should always be possible.
+
+ //My objective would be to create an OMText node and add that to
+ //the omElement delegate member that we have with us.
+ omElement.setValue(text);
+ return this;
+ }
+
+ /**
+ * Method addAttribute
+ * @param name
+ * @param value
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPElement#addAttribute(javax.xml.soap.Name, java.lang.String)
+ */
+ public SOAPElement addAttribute(Name name, String value)
+ throws SOAPException {
+ //insertAttribute() make use of it.
+ return null;
+ }
+
+ /**
+ * Method addNamespaceDeclaration
+ * @param prefix
+ * @param uri
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPElement#addNamespaceDeclaration(java.lang.String, java.lang.String)
+ */
+ public SOAPElement addNamespaceDeclaration(String prefix, String uri)
+ throws SOAPException {
+ return null;
+ }
+
+ /**
+ * Method getAttributeValue
+ * @param name
+ * @return
+ * @see javax.xml.soap.SOAPElement#getAttributeValue(javax.xml.soap.Name)
+ */
+ public String getAttributeValue(Name name) {
+ return omElement.getAttributeWithQName( new QName(name.getURI(),name.getLocalName())).getValue();
+ }
+
+ /**
+ * method getAllAttributes
+ * @return
+ * @see javax.xml.soap.SOAPElement#getAllAttributes()
+ */
+ public Iterator getAllAttributes() {
+ Iterator attrIter = omElement.getAttributes();
+ ArrayList arrayList = new ArrayList();
+ while (attrIter.hasNext()) {
+ Object o = attrIter.next();
+ if (o instanceof org.apache.axis.om.OMAttribute) {
+ //we need to create a SOAPNode for this and add to the arrayList
+ javax.xml.soap.Node soapNode = new NodeImpl((org.apache.axis.om.OMAttribute)o);
+ arrayList.add(soapNode);
+ }
+ }
+ return arrayList.iterator();
+ }
+
+ /**
+ * Method getNamespaceURI
+ * @param prefix
+ * @return
+ * @see javax.xml.soap.SOAPElement#getNamespaceURI(java.lang.String)
+ */
+ public String getNamespaceURI(String prefix) {
+ return null;
+ //Taking too much of time, let me move on...
+ }
+
+ /**
+ * method getNamespacePrefixes
+ * @return
+ * @see javax.xml.soap.SOAPElement#getNamespacePrefixes()
+ */
+ public Iterator getNamespacePrefixes() {
+ return null;
+ //deferring this too.
+ }
+
+ /**
+ * Method getElementName
+ * @return
+ * @see javax.xml.soap.SOAPElement#getElementName()
+ */
+ public Name getElementName() {
+ //TODO: Ashu! Look into PrefixeQName implementation, and undesired extra <code>prefix</code> field
+ //is present inside it, which might create some problems up the execution flow.
+ return (Name)(new PrefixedQName(((org.apache.axis.om.impl.llom.OMElementImpl)omElement).getQName()));
+ }
+
+ /**
+ * method removeAttribute
+ * @param name
+ * @return
+ * @see javax.xml.soap.SOAPElement#removeAttribute(javax.xml.soap.Name)
+ */
+ public boolean removeAttribute(Name name) {
+ return false;
+ }
+
+ /**
+ * method removeNamespaceDeclaration
+ * @param prefix
+ * @return
+ * @see javax.xml.soap.SOAPElement#removeNamespaceDeclaration(java.lang.String)
+ */
+ public boolean removeNamespaceDeclaration(String prefix) {
+
+ //Couldn't figure out corresponding functionality in OM
+ return false;
+ }
+
+ /**
+ * method getChildElements
+ * @return
+ * @see javax.xml.soap.SOAPElement#getChildElements()
+ */
+ public Iterator getChildElements() {
+ //Actually all the children are being treated as OMNodes and are being
+ //wrapped accordingly to a single type and being returned
+ //Ideally speaking, node type should be observed and wrapped into
+ //corresponding type.
+ Iterator childIter = omElement.getChildren();
+ ArrayList arrayList = new ArrayList();
+ while(childIter.hasNext()) {
+ Object o = childIter.next();
+ if (o instanceof org.apache.axis.om.OMNode) {
+ SOAPElement childElement = new SOAPElementImpl((org.apache.axis.om.OMElement)o);
+ arrayList.add(childElement);
+ }
+ }
+ return arrayList.iterator();
+ }
+
+ /**
+ * method getChildElements
+ * @param name
+ * @return
+ * @see javax.xml.soap.SOAPElement#getChildElements(javax.xml.soap.Name)
+ */
+ public Iterator getChildElements(Name name) {
+ QName qName = new QName(name.getURI(),name.getLocalName());
+ Iterator childIter = omElement.getChildrenWithName(qName);
+ ArrayList arrayList = new ArrayList();
+ while(childIter.hasNext()) {
+ Object o = childIter.next();
+ if (o instanceof org.apache.axis.om.OMNode) {
+ SOAPElement childElement = new SOAPElementImpl((org.apache.axis.om.OMElement)o);
+ arrayList.add(childElement);
+ }
+ }
+ return arrayList.iterator();
+ }
+
+ /**
+ * method setEncodingStyle
+ * @param encodingStyle
+ * @see javax.xml.soap.SOAPElement#setEncodingStyle(java.lang.String)
+ */
+ public void setEncodingStyle(String encodingStyle) throws SOAPException {
+
+ //Donno how to tackle this right now.
+ //Couldn't figure out corresponding functionality in OM
+
+ }
+
+ /**
+ * method getEncodingStyle
+ * @return
+ * @see javax.xml.soap.SOAPElement#getEncodingStyle()
+ */
+ public String getEncodingStyle() {
+ return null;
+ }
+
+ /*&
+ * method removeContents
+ * @see javax.xml.soap.SOAPElement#removeContents()
+ */
+ public void removeContents() {
+
+ //Couldn't figure out corresponding functionality in OM
+ //Actually there is a detach() method in OMElementImpl, but
+ //that discards the current information item also. Here we only have to
+ //remove contents and return back a void. Will have to consult
+ //Venkat in making a work around for this.
+
+ }
+
+ /**
+ * method getVisibleNamespacePrefixes
+ * @return
+ * @see javax.xml.soap.SOAPElement#getVisibleNamespacePrefixes()
+ */
+ public Iterator getVisibleNamespacePrefixes() {
+ // See I'm returnign the iterator of namespaces returned by
+ // getAllDeclaredNamespaces() of the OMElementImpl as of now.
+ // But I doubt if that is going to cover the namespaces that are
+ // in the scope of the document at the higher levels of hierarchy
+
+ Iterator namespacesIter = omElement.getAllDeclaredNamespaces();
+ ArrayList returnList = new ArrayList();
+ while(namespacesIter.hasNext()) {
+ Object o = namespacesIter.next();
+ if (o instanceof org.apache.axis.om.OMNamespace) {
+ javax.xml.soap.Node soapNode = new NodeImpl((org.apache.axis.om.OMNamespace)o);
+ returnList.add(soapNode);
+ }
+ }
+ return returnList.iterator();
+ }
+
+ /**
+ * method getTagName
+ * @return
+ * @see org.w3c.dom.Element#getTagName()
+ */
+ public String getTagName() {
+ return null;
+ }
+
+ /**
+ * method removeAttribute
+ * @param arg0
+ * @see org.w3c.dom.Element#removeAttribute(java.lang.String)
+ */
+ public void removeAttribute(String arg0) throws DOMException {
+
+
+ }
+
+ /**
+ * method hasAttribute
+ * @param arg0
+ * @return
+ * @see org.w3c.dom.Element#hasAttribute(java.lang.String)
+ */
+ public boolean hasAttribute(String arg0) {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Element#getAttribute(java.lang.String)
+ */
+ public String getAttribute(String arg0) {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Element#removeAttributeNS(java.lang.String, java.lang.String)
+ */
+ public void removeAttributeNS(String arg0, String arg1) throws DOMException {
+
+// Couldn't figure out corresponding functionality in OM
+ //but looking into OMAttribute code might help you with some work around.
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Element#setAttribute(java.lang.String, java.lang.String)
+ */
+ public void setAttribute(String arg0, String arg1) throws DOMException {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Element#hasAttributeNS(java.lang.String, java.lang.String)
+ */
+ public boolean hasAttributeNS(String arg0, String arg1) {
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Element#getAttributeNode(java.lang.String)
+ */
+ public Attr getAttributeNode(String arg0) {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Element#removeAttributeNode(org.w3c.dom.Attr)
+ */
+ public Attr removeAttributeNode(Attr arg0) throws DOMException {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Element#setAttributeNode(org.w3c.dom.Attr)
+ */
+ public Attr setAttributeNode(Attr arg0) throws DOMException {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Element#setAttributeNodeNS(org.w3c.dom.Attr)
+ */
+ public Attr setAttributeNodeNS(Attr arg0) throws DOMException {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Element#getElementsByTagName(java.lang.String)
+ */
+ public NodeList getElementsByTagName(String arg0) {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Element#getAttributeNS(java.lang.String, java.lang.String)
+ */
+ public String getAttributeNS(String arg0, String arg1) {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Element#setAttributeNS(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void setAttributeNS(String arg0, String arg1, String arg2)
+ throws DOMException {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Element#getAttributeNodeNS(java.lang.String, java.lang.String)
+ */
+ public Attr getAttributeNodeNS(String arg0, String arg1) {
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.w3c.dom.Element#getElementsByTagNameNS(java.lang.String, java.lang.String)
+ */
+ public NodeList getElementsByTagNameNS(String arg0, String arg1) {
+
+ return null;
+ }
+
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPEnvelopeImpl.java?view=auto&rev=158750
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPEnvelopeImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPEnvelopeImpl.java Wed Mar 23 01:38:46 2005
@@ -0,0 +1,177 @@
+/*
+ * 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.om.OMFactory;
+import org.apache.axis.saaj.SOAPBodyImpl;
+import org.apache.axis.saaj.SOAPHeaderImpl;
+
+
+/**
+ * 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.om.SOAPEnvelope omSOAPEnvelope;
+
+ /**
+ * Constructor SOAPEnvelopeImpl
+ */
+ public SOAPEnvelopeImpl(){
+ OMFactory fac = OMFactory.newInstance();
+ omSOAPEnvelope = fac.getDefaultEnvelope();
+ }
+
+ /**
+ * method getOMEnvelope
+ * @return
+ */
+ public org.apache.axis.om.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.om.SOAPHeader omSOAPHeader;
+ try
+ {
+ omSOAPHeader = (org.apache.axis.om.impl.llom.SOAPHeaderImpl) omSOAPEnvelope.getHeader();
+ }catch (Exception e)
+ {
+ throw new SOAPException(e);
+ }
+ return (SOAPHeader) new SOAPHeaderImpl(omSOAPHeader);
+ }
+
+ /**
+ * method getBody
+ *
+ * @return
+ * @throws SOAPException
+ * @see javax.xml.soap.SOAPEnvelope#getBody()
+ */
+ public SOAPBody getBody() throws SOAPException {
+
+ org.apache.axis.om.SOAPBody omSOAPBody;
+ try
+ {
+ omSOAPBody = omSOAPEnvelope.getBody();
+ } catch (Exception e)
+ {
+ throw new SOAPException(e);
+ }
+ return (SOAPBody)(new SOAPBodyImpl(omSOAPBody));
+ }
+
+ /**
+ * 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.om.SOAPHeader header = omSOAPEnvelope.getHeader();
+ if (header == null) {
+ header = new org.apache.axis.om.impl.llom.SOAPHeaderImpl(omSOAPEnvelope);
+ omSOAPEnvelope.addChild(header);
+ return (SOAPHeader)(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.om.SOAPBody body = omSOAPEnvelope.getBody();
+ if (body == null) {
+ body = new org.apache.axis.om.impl.llom.SOAPBodyImpl(omSOAPEnvelope);
+ omSOAPEnvelope.addChild(body);
+ return (SOAPBody)(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/java/org/apache/axis/saaj/SOAPFaultElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPFaultElementImpl.java?view=auto&rev=158750
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPFaultElementImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPFaultElementImpl.java Wed Mar 23 01:38:46 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/java/org/apache/axis/saaj/SOAPFaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPFaultImpl.java?view=auto&rev=158750
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPFaultImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPFaultImpl.java Wed Mar 23 01:38:46 2005
@@ -0,0 +1,190 @@
+/*
+ * 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
+ */
+public class SOAPFaultImpl extends SOAPBodyElementImpl implements SOAPFault {
+
+ /**
+ * Field fault The omSOAPFault field
+ */
+ org.apache.axis.om.SOAPFault fault;
+
+ /**
+ * Constructor SOAPFaultImpl
+ * @param fault
+ */
+ public SOAPFaultImpl(org.apache.axis.om.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);
+ }
+
+ /**
+ * Method getFaultCode
+ *
+ * @return
+ * @see javax.xml.soap.SOAPFault#getFaultCode()
+ */
+ public String getFaultCode() {
+
+ QName qName = fault.getFaultCode();
+ return qName.getLocalPart();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * method getFaultActor
+ *
+ * @return
+ * @see javax.xml.soap.SOAPFault#getFaultActor()
+ */
+ public String getFaultActor() {
+
+ return fault.getFaultActor();
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * method getFaultString
+ *
+ * @return
+ * @see javax.xml.soap.SOAPFault#getFaultString()
+ */
+ public String getFaultString() {
+
+ return fault.getFaultString();
+ }
+
+ /**
+ * 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)detail;
+ }
+
+ /**
+ * 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)detail;
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * method getFaultCodeAsName
+ *
+ * @return
+ * @see javax.xml.soap.SOAPFault#getFaultCodeAsName()
+ */
+ public Name getFaultCodeAsName() {
+
+ QName qName = fault.getFaultCode();
+ Name name = new PrefixedQName(qName);
+ return name;
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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/java/org/apache/axis/saaj/SOAPHeaderElementImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPHeaderElementImpl.java?view=auto&rev=158750
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPHeaderElementImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPHeaderElementImpl.java Wed Mar 23 01:38:46 2005
@@ -0,0 +1,77 @@
+/*
+ * Created on Mar 16, 2005
+ *
+ */
+package org.apache.axis.saaj;
+
+import javax.xml.soap.SOAPHeaderElement;
+
+import org.apache.axis.om.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.om.SOAPHeaderBlock headerElement){
+ this.omHeaderElement = headerElement;
+ }
+
+ /**
+ * method setActor
+ *
+ * @param actorURI
+ * @see javax.xml.soap.SOAPHeaderElement#setActor(java.lang.String)
+ */
+ public void setActor(String actorURI) {
+
+ omHeaderElement.setActor(actorURI);
+ }
+
+ /**
+ * method getActor
+ *
+ * @return
+ * @see javax.xml.soap.SOAPHeaderElement#getActor()
+ */
+ public String getActor() {
+
+ return omHeaderElement.getActor();
+ }
+
+ /**
+ * 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/java/org/apache/axis/saaj/SOAPHeaderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPHeaderImpl.java?view=auto&rev=158750
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPHeaderImpl.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/java/org/apache/axis/saaj/SOAPHeaderImpl.java Wed Mar 23 01:38:46 2005
@@ -0,0 +1,169 @@
+/*
+ * 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.OMNamespace;
+import org.apache.axis.om.impl.llom.OMNamespaceImpl;
+
+/**
+ * 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.om.SOAPHeader omHeader;
+
+ /**
+ * Constructor SOAPHeaderImpl
+ * @param header
+ */
+ public SOAPHeaderImpl(org.apache.axis.om.SOAPHeader 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();
+ OMNamespace ns = new OMNamespaceImpl(name.getURI(), name.getPrefix());
+ org.apache.axis.om.SOAPHeaderBlock headerBlock = omHeader.addHeaderBlock(localName, ns);
+ return (SOAPHeaderElement)(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.om.SOAPHeaderBlock){
+ org.apache.axis.om.SOAPHeaderBlock headerBlock = (org.apache.axis.om.SOAPHeaderBlock)o;
+ SOAPHeaderElement element = (SOAPHeaderElement)(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.om.SOAPHeaderBlock){
+ org.apache.axis.om.SOAPHeaderBlock headerBlock = (org.apache.axis.om.SOAPHeaderBlock)o;
+ SOAPHeaderElement element = (SOAPHeaderElement)(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.om.SOAPHeaderBlock){
+ org.apache.axis.om.SOAPHeaderBlock headerBlock = (org.apache.axis.om.SOAPHeaderBlock)o;
+ SOAPHeaderElement element = (SOAPHeaderElement)(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.om.SOAPHeaderBlock){
+ org.apache.axis.om.SOAPHeaderBlock headerBlock = (org.apache.axis.om.SOAPHeaderBlock)o;
+ SOAPHeaderElement element = (SOAPHeaderElement)(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.om.SOAPHeaderBlock){
+ org.apache.axis.om.SOAPHeaderBlock headerBlock = (org.apache.axis.om.SOAPHeaderBlock)o;
+ SOAPHeaderElement element = (SOAPHeaderElement)(new SOAPHeaderElementImpl(headerBlock));
+ aList.add(element);
+ }
+ }
+ return aList.iterator();
+ }
+
+}
Added: webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/test/org/apache/axis/saaj/TestClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/test/org/apache/axis/saaj/TestClient.java?view=auto&rev=158750
==============================================================================
--- webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/test/org/apache/axis/saaj/TestClient.java (added)
+++ webservices/axis/trunk/archive/java/scratch/ashu_jaya_venkat/saaj/src/test/org/apache/axis/saaj/TestClient.java Wed Mar 23 01:38:46 2005
@@ -0,0 +1,82 @@
+/*
+ * 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.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.om.SOAPEnvelope omEnv = env.getOMEnvelope();
+
+ System.out.println("Request sent ...");
+ XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+ omEnv.serialize(writer,true);
+ 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.setListenerTransport("http", true);
+ call.setTo(new EndpointReference(AddressingConstants.WSA_TO, url.toString()));
+
+ org.apache.axis.om.SOAPEnvelope responseEnv = call.sendReceive(omEnv);
+
+ System.out.println("Responce received ...");
+ responseEnv.serialize(writer,true);
+ 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();
+ }
+ }
+}