You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2005/06/30 06:57:53 UTC

svn commit: r202482 - in /webservices/axis/trunk/java/modules: core/src/org/apache/axis/clientapi/ samples/test/org/apache/axis/engine/ xml/src/org/apache/axis/om/impl/llom/ xml/src/org/apache/axis/soap/impl/llom/ xml/src/org/apache/axis/soap/impl/llom...

Author: chinthaka
Date: Wed Jun 29 21:57:51 2005
New Revision: 202482

URL: http://svn.apache.org/viewcvs?rev=202482&view=rev
Log:
- fixing setSOAPAction bug
- fixing SOAPElement bug for setxxx

Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java
    webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/SOAPversionTest.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMNodeImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPEnvelopeImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPFaultCodeImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPFaultImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPFaultReasonImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap11/SOAP11FaultImpl.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultImpl.java
    webservices/axis/trunk/java/modules/xml/test/org/apache/axis/soap/SOAPFaultTest.java

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java?rev=202482&r1=202481&r2=202482&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/MEPClient.java Wed Jun 29 21:57:51 2005
@@ -46,10 +46,6 @@
         return soapAction;
     }
 
-    public void setSoapAction(String soapAction) {
-        this.soapAction = soapAction;
-    }
-
     public MEPClient(ServiceContext service, String mep) {
         this.serviceContext = service;
         this.mep = mep;

Modified: webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/SOAPversionTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/SOAPversionTest.java?rev=202482&r1=202481&r2=202482&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/SOAPversionTest.java (original)
+++ webservices/axis/trunk/java/modules/samples/test/org/apache/axis/engine/SOAPversionTest.java Wed Jun 29 21:57:51 2005
@@ -25,6 +25,7 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
 
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
@@ -104,6 +105,30 @@
                  inOutMEPClient.invokeBlockingWithEnvelopeOut(operationName.getLocalPart(), payload);
         assertEquals("SOAP Version received is not compatible", SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, result.getNamespace().getName());
 
+
+        inOutMEPClient.close();
+    }
+
+    public void testSOAPfault() throws AxisFault {
+        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
+
+        OMElement payload = createEnvelope();
+        MyInOutMEPClient inOutMEPClient = new MyInOutMEPClient();
+        inOutMEPClient.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+        inOutMEPClient.setTo(targetEPR);
+        inOutMEPClient.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false);
+
+        SOAPEnvelope result =
+                 inOutMEPClient.invokeBlockingWithEnvelopeOut(operationName.getLocalPart(), payload);
+//        assertEquals("SOAP Version received is not compatible", SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, result.getNamespace().getName());
+        try {
+            OMOutput output = new OMOutput(System.out, false);
+            result.serializeWithCache(output);
+            output.flush();
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+        }
 
         inOutMEPClient.close();
     }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMNodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMNodeImpl.java?rev=202482&r1=202481&r2=202482&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMNodeImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/om/impl/llom/OMNodeImpl.java Wed Jun 29 21:57:51 2005
@@ -38,11 +38,11 @@
      * Field previousSibling
      */
     protected OMNodeImpl previousSibling;
-       /**
+    /**
      * Field builder
      */
     protected OMXMLParserWrapper builder;
-   
+
     /**
      * Field done
      */
@@ -66,11 +66,11 @@
      */
     public OMNodeImpl(OMContainer parent) {
         //if ((parent != null) && (parent.getType() == OMNode.ELEMENT_NODE)) {
-    	//Comment by Jaya:
-    	//OMContainer is only implemented by OMElement and OMDocument which are
-    	//quite well deemed to act as parents, so checking the type of parent
-    	//is not necessary.
-    	if ((parent != null)) {
+        //Comment by Jaya:
+        //OMContainer is only implemented by OMElement and OMDocument which are
+        //quite well deemed to act as parents, so checking the type of parent
+        //is not necessary.
+        if ((parent != null)) {
             this.parent = parent;
             parent.addChild(this);
         }
@@ -95,14 +95,14 @@
      */
     public void setParent(OMContainer element) {
 
-        if( (this.parent) == element){
+        if ((this.parent) == element) {
             return;
         }
 
         //If we are asked to assign a new parent in place 
         //of an existing one. We should detach this node
         //from the aegis of previous parent.
-        if(this.parent != null){
+        if (this.parent != null) {
             this.detach();
         }
         this.parent = element;
@@ -160,19 +160,18 @@
      */
     public OMNode detach() throws OMException {
         if (parent == null) {
-            throw new OMException(
-                    "Elements that doesn't have a parent can not be detached");
+            throw new OMException("Elements that doesn't have a parent can not be detached");
         }
         OMNodeImpl nextSibling = (OMNodeImpl) getNextSibling();
         if (previousSibling == null) {
             parent.setFirstChild(nextSibling);
         } else {
-            previousSibling.setNextSibling(nextSibling);
+            getPreviousSibling().setNextSibling(nextSibling);
         }
         if (nextSibling != null) {
-            nextSibling.setPreviousSibling(previousSibling);
+            nextSibling.setPreviousSibling(getPreviousSibling());
         }
-
+        this.parent = null;
         return this;
     }
 
@@ -267,21 +266,18 @@
     }
 
 
-
-   /**
+    /**
      * This will completely parse this node and build the object structure in the memory.
      * However a programmatically created node will have done set to true by default and will cause
      * populateyourself not to work properly!
+     *
      * @throws OMException
      */
     public void build() throws OMException {
-        while(!done){
+        while (!done) {
             builder.next();
         }
     }
-
-
-
 
 
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPEnvelopeImpl.java?rev=202482&r1=202481&r2=202482&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPEnvelopeImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPEnvelopeImpl.java Wed Jun 29 21:57:51 2005
@@ -29,9 +29,6 @@
 public class SOAPEnvelopeImpl extends SOAPElement
         implements SOAPEnvelope, OMConstants {
 
-    private SOAPBody soapBody;
-    private SOAPHeader soapHeader;
-
     /**
      * @param builder
      */
@@ -59,10 +56,7 @@
      * @throws OMException
      */
     public SOAPHeader getHeader() throws OMException {
-        if (soapHeader == null) {
-            soapHeader = (SOAPHeader) getFirstChildWithName(new QName(SOAPConstants.HEADER_LOCAL_NAME));
-        }
-        return soapHeader;
+        return (SOAPHeader) getFirstChildWithName(new QName(SOAPConstants.HEADER_LOCAL_NAME));
     }
 
     /**
@@ -77,13 +71,11 @@
      * @throws OMException
      */
     public SOAPBody getBody() throws OMException {
-        if (soapBody == null) {
-
             //check for the first element
             OMElement element = getFirstElement();
             if (element != null) {
                 if (SOAPConstants.BODY_LOCAL_NAME.equals(element.getLocalName())) {
-                    soapBody = (SOAPBody) element;
+                    return (SOAPBody) element;
                 } else {      // if not second element SHOULD be the body
                     OMNode node = element.getNextSibling();
                     while (node != null && node.getType() != OMNode.ELEMENT_NODE) {
@@ -92,14 +84,13 @@
                     element = (OMElement) node;
 
                     if (node != null && SOAPConstants.BODY_LOCAL_NAME.equals(element.getLocalName())) {
-                        soapBody = (SOAPBody) element;
+                        return (SOAPBody) element;
                     } else {
                         throw new OMException("SOAPEnvelope must contain a body element which is either first or second child element of the SOAPEnvelope.");
                     }
                 }
             }
-        }
-        return soapBody;
+        return null;
     }
 
     /**

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPFaultCodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPFaultCodeImpl.java?rev=202482&r1=202481&r2=202482&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPFaultCodeImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPFaultCodeImpl.java Wed Jun 29 21:57:51 2005
@@ -32,8 +32,6 @@
  */
 public abstract class SOAPFaultCodeImpl extends SOAPElement implements SOAPFaultCode {
 
-    protected SOAPFaultValue value;
-    protected SOAPFaultSubCode subCode;
 
     /**
      * Constructor OMElementImpl
@@ -63,20 +61,14 @@
     }
 
     public SOAPFaultValue getValue() {
-        if (value == null) {
-            value = (SOAPFaultValue) UtilProvider.getChildWithName(this, SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME);
-        }
-        return value;
+       return (SOAPFaultValue) UtilProvider.getChildWithName(this, SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME);
     }
 
     public void setSubCode(SOAPFaultSubCode value) throws SOAPProcessingException {
-        UtilProvider.setNewElement(this, subCode, value);
+        UtilProvider.setNewElement(this, getSubCode(), value);
     }
 
     public SOAPFaultSubCode getSubCode() {
-        if (subCode == null) {
-            subCode = (SOAPFaultSubCode) UtilProvider.getChildWithName(this, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
-        }
-        return subCode;
+        return (SOAPFaultSubCode) UtilProvider.getChildWithName(this, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
     }
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPFaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPFaultImpl.java?rev=202482&r1=202481&r2=202482&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPFaultImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPFaultImpl.java Wed Jun 29 21:57:51 2005
@@ -38,12 +38,6 @@
 public abstract class SOAPFaultImpl extends SOAPElement
         implements SOAPFault, OMConstants {
 
-    protected SOAPFaultCode faultCode;
-    protected SOAPFaultReason faultReason;
-    protected SOAPFaultNode faultNode;
-    protected SOAPFaultRoleImpl faultRole;
-    protected SOAPFaultDetail faultDetail;
-
     protected Exception e;
 
     /**
@@ -74,7 +68,7 @@
      * @param builder
      */
     public SOAPFaultImpl(SOAPBody parent, OMXMLParserWrapper builder) {
-        super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME,builder);
+        super(parent, SOAPConstants.SOAPFAULT_LOCAL_NAME, builder);
     }
 
 
@@ -83,66 +77,55 @@
     // --------------- Getters and Settors --------------------------- //
 
     public void setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException {
-        setNewElement(faultCode, soapFaultCode);
+        setNewElement(getCode(), soapFaultCode);
     }
 
     public SOAPFaultCode getCode() {
-        if (faultCode == null) {
-            faultCode = (SOAPFaultCode) this.getChildWithName(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME);
-        }
-
-        return faultCode;
+        return (SOAPFaultCode) this.getChildWithName(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME);
     }
 
     public void setReason(SOAPFaultReason reason) throws SOAPProcessingException {
-        setNewElement(faultReason, reason);
+        setNewElement(getReason(), reason);
     }
 
     public SOAPFaultReason getReason() {
-        if (faultReason == null) {
-            faultReason = (SOAPFaultReason) this.getChildWithName(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME);
-        }
-        return faultReason;
+        return (SOAPFaultReason) this.getChildWithName(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME);
     }
 
     public void setNode(SOAPFaultNode node) throws SOAPProcessingException {
-        setNewElement(faultNode, node);
+        setNewElement(getNode(), node);
     }
 
     public SOAPFaultNode getNode() {
-        if (faultNode == null) {
-            faultNode = (SOAPFaultNode) this.getChildWithName(SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME);
-        }
-        return faultNode;
+        return (SOAPFaultNode) this.getChildWithName(SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME);
     }
 
     public void setRole(SOAPFaultRole role) throws SOAPProcessingException {
-        setNewElement(faultRole, role);
+        setNewElement(getRole(), role);
     }
 
     public SOAPFaultRole getRole() {
-        if (faultRole == null) {
-            faultRole = (SOAPFaultRoleImpl) this.getChildWithName(SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME);
-        }
-        return faultRole;
+        return (SOAPFaultRoleImpl) this.getChildWithName(SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME);
     }
 
     public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException {
-        setNewElement(faultDetail, detail);
+        setNewElement(getDetail(), detail);
     }
 
-    public abstract SOAPFaultDetail getDetail();
+    public SOAPFaultDetail getDetail() {
+        return (SOAPFaultDetail) this.getChildWithName(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME);
+    }
 
 
     // ---------------------------------------------------------------------------------------------//
 
     public Exception getException() throws OMException {
         getDetail();
-        if (faultDetail == null) {
+        if (getDetail() == null) {
             return new Exception("No Exception element found in the SOAP Detail element");
         }
 
-        OMElement exceptionElement = faultDetail.getFirstChildWithName(new QName(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY));
+        OMElement exceptionElement = getDetail().getFirstChildWithName(new QName(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY));
         if (exceptionElement != null) {
             return new Exception(exceptionElement.getText());
         }
@@ -154,18 +137,21 @@
         e.printStackTrace(new PrintWriter(sw));
 
         getDetail();
-        if (faultDetail == null) {
-            faultDetail = getNewSOAPFaultDetail(this);
+        if (getDetail() == null) {
+            setDetail(getNewSOAPFaultDetail(this));
 
         }
         OMElement faultDetailEnty = new OMElementImpl(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY, this.getNamespace());
         faultDetailEnty.setText(sw.getBuffer().toString());
-        faultDetail.addChild(faultDetailEnty);
+        getDetail().addChild(faultDetailEnty);
     }
 
     protected void setNewElement(OMElement myElement, OMElement newElement) {
         if (myElement != null) {
             myElement.discard();
+        }
+        if(newElement != null && newElement.getParent() != null){
+            newElement.discard();
         }
         this.addChild(newElement);
         myElement = newElement;

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPFaultReasonImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPFaultReasonImpl.java?rev=202482&r1=202481&r2=202482&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPFaultReasonImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/SOAPFaultReasonImpl.java Wed Jun 29 21:57:51 2005
@@ -55,11 +55,8 @@
     public void setSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException {
         UtilProvider.setNewElement(this, text, soapFaultText);
     }
-
+                                                                                                                      
     public SOAPFaultText getSOAPText() {
-        if (text == null) {
-            text =  (SOAPFaultText) UtilProvider.getChildWithName(this, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME);
-        }
-        return text;
+        return (SOAPFaultText) UtilProvider.getChildWithName(this, SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME);
     }
 }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap11/SOAP11FaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap11/SOAP11FaultImpl.java?rev=202482&r1=202481&r2=202482&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap11/SOAP11FaultImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap11/SOAP11FaultImpl.java Wed Jun 29 21:57:51 2005
@@ -69,59 +69,12 @@
         super.serialize(omOutput);
     }
 
-//    /**
-//     * Method getException
-//     *
-//     * @return
-//     * @throws OMException
-//     */
-//    public Exception getException() throws OMException {
-//       getDetail();
-//        if (faultDetail == null) {
-//            return null;
-//        }
-//
-//        OMElement exceptionElement = faultDetail.getFirstChildWithName(new QName(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY));
-//        if(exceptionElement != null){
-//             return new Exception(exceptionElement.getText());
-//        }
-//        return null;
-//    }
-//
-//    protected void putExceptionToSOAPFault(Exception e) {
-//        StringWriter sw = new StringWriter();
-//        e.printStackTrace(new PrintWriter(sw));
-//        getDetail();
-//        if (faultDetail == null) {
-//            faultDetail = new SOAP11FaultDetailImpl(this);
-//
-//        }
-//        OMElement faultDetailEnty = new OMElementImpl(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY, this.getNamespace());
-//        faultDetailEnty.setText(sw.getBuffer().toString());
-//        faultDetail.addChild(faultDetailEnty);
-//    }
-//
-//    /**
-//     * Equivalent for FaultCode in SOAP 1.1 is faultCode.
-//     * So creating faultCode element and putting the value as SOAPFaultCode.SOAPFaultCodeValue.value
-//     *
-//     * @param soapFaultCode
-//     * @throws SOAPProcessingException
-//     */
     public void setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException {
         if (!(soapFaultCode instanceof SOAP11FaultCodeImpl)) {
             throw new SOAPProcessingException("Expecting SOAP 1.1 implementation of SOAP Fault Code. But received some other implementation");
         }
         super.setCode(soapFaultCode);
     }
-//
-//    public SOAPFaultCode getCode() {
-//        if (faultCode == null) {
-//            faultCode = (SOAPFaultCode) getChildWithName(SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME);
-//        }
-//        return faultCode;
-//    }
-//
     public void setReason(SOAPFaultReason reason) throws SOAPProcessingException {
         if (!(reason instanceof SOAP11FaultReasonImpl)) {
             throw new SOAPProcessingException("Expecting SOAP 1.1 implementation of SOAP Fault Reason. But received some other implementation");
@@ -129,36 +82,17 @@
         super.setReason(reason);
     }
 //
-//    public SOAPFaultReason getReason() {
-//        if (faultReason == null) {
-//            faultReason = (SOAPFaultReason) getChildWithName(SOAP11Constants.SOAP_FAULT_STRING_LOCAL_NAME);
-//        }
-//        return faultReason;
-//    }
-//
     public void setNode(SOAPFaultNode node) throws SOAPProcessingException {
         if (!(node instanceof SOAP11FaultNodeImpl)) {
             throw new SOAPProcessingException("Expecting SOAP 1.1 implementation of SOAP Fault Node. But received some other implementation");
         }
         super.setNode(node);
     }
-//
-//    public SOAPFaultNode getNode() {
-//        throw new UnsupportedOperationException();
-//    }
-//
     public void setRole(SOAPFaultRole role) throws SOAPProcessingException {
         if (!(role instanceof SOAP11FaultRoleImpl)) {
             throw new SOAPProcessingException("Expecting SOAP 1.1 implementation of SOAP Fault Role. But received some other implementation");
         }
         super.setRole(role);
-    }
-
-    public SOAPFaultDetail getDetail()  {
-        if (faultDetail == null || faultDetail.getParent() != this) {
-            faultDetail = (SOAPFaultDetail) this.getChildWithName(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME);
-        }
-        return faultDetail;
     }
 
     protected void checkParent(OMElement parent) throws SOAPProcessingException {

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultImpl.java?rev=202482&r1=202481&r2=202482&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultImpl.java Wed Jun 29 21:57:51 2005
@@ -89,14 +89,6 @@
         super.setDetail(detail);
     }
 
-    public SOAPFaultDetail getDetail() {
-        if (faultDetail == null || faultDetail.getParent() != this) {
-            faultDetail = (SOAPFaultDetail) this.getChildWithName(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME);
-        }
-        return faultDetail;
-    }
-
-
     protected void checkParent(OMElement parent) throws SOAPProcessingException {
         if (!(parent instanceof SOAP12BodyImpl)) {
             throw new SOAPProcessingException("Expecting SOAP 1.2 implementation of SOAP Body as the parent. But received some other implementation");

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis/soap/SOAPFaultTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis/soap/SOAPFaultTest.java?rev=202482&r1=202481&r2=202482&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis/soap/SOAPFaultTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis/soap/SOAPFaultTest.java Wed Jun 29 21:57:51 2005
@@ -18,9 +18,12 @@
 
 import junit.framework.TestCase;
 import org.apache.axis.om.OMAbstractFactory;
+import org.apache.axis.om.OMOutput;
 import org.apache.axis.soap.impl.llom.soap11.SOAP11Constants;
 import org.apache.axis.soap.impl.llom.soap12.SOAP12Constants;
 
+import javax.xml.stream.XMLStreamException;
+
 public class SOAPFaultTest extends SOAPFaultTestCase {
 
     public SOAPFaultTest(String testName) {
@@ -205,7 +208,7 @@
         try {
             soap12Fault.setDetail(soap11Factory.createSOAPFaultDetail(soap11Fault));
             fail("SOAP11FaultDetail should not be set in to a SOAP12Fault");
-            
+
         } catch (Exception e) {
             assertTrue(true);
         }
@@ -255,5 +258,37 @@
     public void testSOAP12GetDetailWithParser() {
         assertFalse("SOAP 1.2 Fault Test with parser: - getDetail method returns null", soap12FaultWithParser.getDetail() == null);
         assertTrue("SOAP 1.2 Fault Test with parser: - Fault detail local name mismatch", soap12FaultWithParser.getDetail().getLocalName().equals(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
+    }
+
+    public void testMoreChildrenAddition() {
+        OMOutput output = null;
+        try {
+            output = new OMOutput(System.out, false);
+            SOAPFactory soapFactory = OMAbstractFactory.getSOAP12Factory();
+            SOAPEnvelope envelope = soapFactory.getDefaultFaultEnvelope();
+
+            assertNotNull("Default FaultEnvelope must have a SOAPFault in it", envelope.getBody().getFault());
+            assertNotNull("Default FaultEnvelope must have a SOAPFaultCode in it", envelope.getBody().getFault().getCode());
+            assertNotNull("Default FaultEnvelope must have a SOAPFaultCodeValue in it", envelope.getBody().getFault().getCode().getValue());
+            assertNotNull("Default FaultEnvelope must have a SOAPFaultReason in it", envelope.getBody().getFault().getReason());
+            assertNotNull("Default FaultEnvelope must have a SOAPFaultText in it", envelope.getBody().getFault().getReason().getSOAPText());
+
+            SOAPEnvelope soapEnvelope = soapFactory.getDefaultFaultEnvelope();
+            String errorCodeString = "Some Error occurred !!";
+            soapEnvelope.getBody().getFault().getCode().getValue().setText(errorCodeString);
+
+            SOAPFaultCode code = soapEnvelope.getBody().getFault().getCode();
+            envelope.getBody().getFault().setCode(code);
+
+            assertTrue("Parent Value of Code has not been set to new fault", code.getParent() == envelope.getBody().getFault());
+            assertTrue("Parent Value of Code is still pointing to old fault", code.getParent() != soapEnvelope.getBody().getFault());
+            assertNull("Old fault must not have a fault code", soapEnvelope.getBody().getFault().getCode());
+            assertEquals("The SOAP Code value must be "+errorCodeString, errorCodeString, envelope.getBody().getFault().getCode().getValue().getText());
+
+        } catch (Exception e) {
+            fail(e.getMessage());
+        }
+
+
     }
 }