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/20 19:59:00 UTC

svn commit: r191524 [4/4] - in /webservices/axis/trunk/java/modules: core/src/org/apache/axis/clientapi/ core/src/org/apache/axis/engine/ core/src/org/apache/axis/transport/http/ core/test/org/apache/axis/engine/ core/test/org/apache/axis/handlers/addr...

Added: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultReasonImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultReasonImpl.java?rev=191524&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultReasonImpl.java (added)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultReasonImpl.java Mon Jun 20 10:58:56 2005
@@ -0,0 +1,57 @@
+package org.apache.axis.soap.impl.llom.soap12;
+
+import org.apache.axis.soap.impl.llom.SOAPFaultReasonImpl;
+import org.apache.axis.soap.impl.llom.SOAPProcessingException;
+import org.apache.axis.soap.SOAPFaultText;
+import org.apache.axis.soap.SOAPFault;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.OMException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ * <p/>
+ */
+public class SOAP12FaultReasonImpl extends SOAPFaultReasonImpl{
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+    public SOAP12FaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder) {
+        super(parent, builder);
+    }
+
+    /**
+     * @param parent
+     */
+    public SOAP12FaultReasonImpl(SOAPFault parent) throws SOAPProcessingException {
+        super(parent, true);
+    }
+
+    public void setSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException {
+        if (!(soapFaultText instanceof SOAP12FaultTextImpl)) {
+            throw new SOAPProcessingException("Expecting SOAP 1.2 implementation of SOAP Fault Text. But received some other implementation");
+        }
+        super.setSOAPText(soapFaultText);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultImpl)) {
+            throw new SOAPProcessingException("Expecting SOAP 1.2 implementation of SOAP Fault as the parent. But received some other implementation");
+        }
+    }
+}

Added: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultRoleImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultRoleImpl.java?rev=191524&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultRoleImpl.java (added)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultRoleImpl.java Mon Jun 20 10:58:56 2005
@@ -0,0 +1,45 @@
+package org.apache.axis.soap.impl.llom.soap12;
+
+import org.apache.axis.soap.impl.llom.SOAPFaultRoleImpl;
+import org.apache.axis.soap.impl.llom.SOAPProcessingException;
+import org.apache.axis.soap.SOAPFault;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMXMLParserWrapper;
+
+import javax.xml.namespace.QName;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * author : Eran Chinthaka (chinthaka@apache.org)
+ */
+
+public class SOAP12FaultRoleImpl extends SOAPFaultRoleImpl{
+      public SOAP12FaultRoleImpl(SOAPFault parent) throws SOAPProcessingException {
+        super(parent, true);
+    }
+
+    public SOAP12FaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder) {
+        super(parent, builder);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultImpl)) {
+            throw new SOAPProcessingException("Expecting SOAP 1.2 implementation of SOAP Fault as the parent. But received some other implementation");
+        }
+    }
+}

Added: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java?rev=191524&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java (added)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultSubCodeImpl.java Mon Jun 20 10:58:56 2005
@@ -0,0 +1,72 @@
+package org.apache.axis.soap.impl.llom.soap12;
+
+import org.apache.axis.soap.impl.llom.SOAPFaultSubCodeImpl;
+import org.apache.axis.soap.impl.llom.SOAPProcessingException;
+import org.apache.axis.soap.impl.llom.soap11.SOAP11FaultSubCodeImpl;
+import org.apache.axis.soap.SOAPFaultSubCode;
+import org.apache.axis.soap.SOAPFaultCode;
+import org.apache.axis.soap.SOAPFaultValue;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.OMException;
+
+import javax.xml.namespace.QName;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * author : Eran Chinthaka (chinthaka@apache.org)
+ */
+
+public class SOAP12FaultSubCodeImpl extends SOAPFaultSubCodeImpl{
+    //changed
+    public SOAP12FaultSubCodeImpl(SOAPFaultCode parent) throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
+    }
+
+    //changed
+    public SOAP12FaultSubCodeImpl(SOAPFaultCode parent, OMXMLParserWrapper builder) {
+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder);
+    }
+
+    public SOAP12FaultSubCodeImpl(SOAPFaultSubCode parent) throws SOAPProcessingException {
+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
+    }
+
+    public SOAP12FaultSubCodeImpl(SOAPFaultSubCode parent, OMXMLParserWrapper builder) {
+        super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultSubCodeImpl) || (parent instanceof SOAP12FaultCodeImpl)) {
+            throw new SOAPProcessingException("Expecting SOAP 1.2 implementation of SOAP FaultSubCode or SOAP FaultCodeValue as the parent. But received some other implementation");
+        }
+    }
+
+    public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException {
+        if (!(subCode instanceof SOAP12FaultSubCodeImpl)) {
+            throw new SOAPProcessingException("Expecting SOAP 1.2 implementation of SOAP Fault Sub Code. But received some other implementation");
+        }
+        super.setSubCode(subCode);
+    }
+
+    public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException {
+        if (!(soapFaultSubCodeValue instanceof SOAP12FaultValueImpl)) {
+            throw new SOAPProcessingException("Expecting SOAP 1.2 implementation of SOAP Fault Value. But received some other implementation");
+        }
+        super.setValue(soapFaultSubCodeValue);
+    }
+}

Added: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultTextImpl.java?rev=191524&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultTextImpl.java (added)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultTextImpl.java Mon Jun 20 10:58:56 2005
@@ -0,0 +1,42 @@
+package org.apache.axis.soap.impl.llom.soap12;
+
+import org.apache.axis.soap.SOAPFaultText;
+import org.apache.axis.soap.SOAPFaultReason;
+import org.apache.axis.soap.impl.llom.SOAPFaultTextImpl;
+import org.apache.axis.soap.impl.llom.SOAPProcessingException;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMXMLParserWrapper;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * author : Eran Chinthaka (chinthaka@apache.org)
+ */
+
+public class SOAP12FaultTextImpl extends SOAPFaultTextImpl{
+   public SOAP12FaultTextImpl(SOAPFaultReason parent) throws SOAPProcessingException {
+        super(parent);
+    }
+
+    public SOAP12FaultTextImpl(SOAPFaultReason parent, OMXMLParserWrapper builder) {
+        super(parent, builder);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultReasonImpl)) {
+            throw new SOAPProcessingException("Expecting SOAP 1.2 implementation of SOAP FaultReason as the parent. But received some other implementation");
+        }
+    }
+}

Added: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultValueImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultValueImpl.java?rev=191524&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultValueImpl.java (added)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12FaultValueImpl.java Mon Jun 20 10:58:56 2005
@@ -0,0 +1,45 @@
+package org.apache.axis.soap.impl.llom.soap12;
+
+import org.apache.axis.soap.impl.llom.SOAPProcessingException;
+import org.apache.axis.soap.impl.llom.SOAPFaultValueImpl;
+import org.apache.axis.soap.impl.llom.soap11.SOAP11FaultSubCodeImpl;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.OMException;
+
+import javax.xml.namespace.QName;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * author : Eran Chinthaka (chinthaka@apache.org)
+ */
+
+public class SOAP12FaultValueImpl extends SOAPFaultValueImpl{
+    public SOAP12FaultValueImpl(OMElement parent) throws SOAPProcessingException {
+        super(parent);
+    }
+
+    public SOAP12FaultValueImpl(OMElement parent, OMXMLParserWrapper builder) {
+        super(parent, builder);
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12FaultSubCodeImpl)|| (parent instanceof SOAP12FaultCodeImpl)) {
+            throw new SOAPProcessingException("Expecting SOAP 1.2 implementation of SOAP FaultSubCode or SOAP FaultCode as the parent. But received some other implementation");
+        }
+    }
+}

Added: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12HeaderBlockImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12HeaderBlockImpl.java?rev=191524&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12HeaderBlockImpl.java (added)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12HeaderBlockImpl.java Mon Jun 20 10:58:56 2005
@@ -0,0 +1,92 @@
+package org.apache.axis.soap.impl.llom.soap12;
+
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.soap.impl.llom.SOAPConstants;
+import org.apache.axis.soap.impl.llom.SOAPHeaderBlockImpl;
+import org.apache.axis.soap.impl.llom.SOAPProcessingException;
+import org.apache.axis.soap.impl.llom.soap11.SOAP11Constants;
+import org.apache.axis.soap.impl.llom.soap11.SOAP11HeaderImpl;
+import org.apache.axis.soap.SOAPHeader;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ * <p/>
+ */
+public class SOAP12HeaderBlockImpl extends SOAPHeaderBlockImpl {
+    /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+    /**
+     * @param localName
+     * @param ns
+     */
+    public SOAP12HeaderBlockImpl(String localName, OMNamespace ns, SOAPHeader parent) throws SOAPProcessingException {
+        super(localName, ns, parent);
+        checkParent(parent);
+    }
+
+    /**
+     * Constructor SOAPHeaderBlockImpl
+     *
+     * @param localName
+     * @param ns
+     * @param parent
+     * @param builder
+     */
+    public SOAP12HeaderBlockImpl(String localName, OMNamespace ns, SOAPHeader parent, OMXMLParserWrapper builder) {
+        super(localName, ns, parent, builder);
+        
+    }
+
+    protected void checkParent(OMElement parent) throws SOAPProcessingException {
+        if (!(parent instanceof SOAP12HeaderImpl)) {
+            throw new SOAPProcessingException("Expecting SOAP 1.2 implementation of SOAP Body as the parent. But received some other implementation");
+        }
+    }
+
+    public void setRole(String roleURI) {
+        setAttribute(SOAP12Constants.SOAP_ROLE, roleURI, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+    }
+
+    public String getRole() {
+        return getAttribute(SOAP12Constants.SOAP_ROLE, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+    }
+
+    public void setMustUnderstand(boolean mustUnderstand) {
+        setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND, mustUnderstand ? "1" : "0", SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+
+    }
+
+    public void setMustUnderstand(String mustUnderstand) throws SOAPProcessingException {
+        if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_0.equals(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_1.equals(mustUnderstand)) {
+            setAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND, mustUnderstand, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+        } else {
+            throw new SOAPProcessingException("mustUndertand should be one of \"true\", \"false\", \"0\" or \"1\" ");
+        }
+    }
+
+    public boolean getMustUnderstand() {
+        String mustUnderstand = "";
+        if ((mustUnderstand = getAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND, SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI))
+                != null) {
+            return SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equalsIgnoreCase(mustUnderstand) || SOAPConstants.ATTR_MUSTUNDERSTAND_1.equalsIgnoreCase(mustUnderstand);
+        }
+        return false;
+
+    }
+}

Added: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12HeaderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12HeaderImpl.java?rev=191524&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12HeaderImpl.java (added)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/soap12/SOAP12HeaderImpl.java Mon Jun 20 10:58:56 2005
@@ -0,0 +1,85 @@
+package org.apache.axis.soap.impl.llom.soap12;
+
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.impl.llom.traverse.OMChildrenWithSpecificAttributeIterator;
+import org.apache.axis.soap.SOAPEnvelope;
+import org.apache.axis.soap.SOAPHeaderBlock;
+import org.apache.axis.soap.impl.llom.SOAPHeaderImpl;
+import org.apache.axis.soap.impl.llom.SOAPProcessingException;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+/**
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * <p/>
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ * <p/>
+ */
+public class SOAP12HeaderImpl extends SOAPHeaderImpl{
+     /**
+     * Eran Chinthaka (chinthaka@apache.org)
+     */
+
+    /**
+     * @param envelope
+     */
+    public SOAP12HeaderImpl(SOAPEnvelope envelope) throws SOAPProcessingException {
+        super(envelope);
+    }
+
+    /**
+     * Constructor SOAPHeaderImpl
+     *
+     * @param envelope
+     * @param builder
+     */
+    public SOAP12HeaderImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder) {
+        super(envelope, builder);
+    }
+
+    public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException {
+        if (ns == null || ns.getName() == null || "".equals(ns.getName())) {
+            throw new OMException("All the SOAP Header blocks should be namespace qualified");
+        }
+
+        OMNamespace namespace = findNamespace(ns.getName(), ns.getPrefix());
+        if (namespace != null) {
+            ns = namespace;
+        }
+
+        SOAPHeaderBlock soapHeaderBlock = null;
+        try {
+            soapHeaderBlock = new SOAP12HeaderBlockImpl(localName, ns, this);
+        } catch (SOAPProcessingException e) {
+            throw new OMException(e);
+        }
+        soapHeaderBlock.setComplete(true);
+        return soapHeaderBlock;
+    }
+
+
+    public Iterator extractHeaderBlocks(String role) {
+        return new OMChildrenWithSpecificAttributeIterator(getFirstChild(),
+                new QName(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+                        SOAP12Constants.SOAP_ROLE),
+                role,
+                true);
+    }
+
+    public Iterator examineMustUnderstandHeaderBlocks(String actor) {
+        throw new UnsupportedOperationException();
+    }
+}

Added: webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/util/UtilProvider.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/util/UtilProvider.java?rev=191524&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/util/UtilProvider.java (added)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis/soap/impl/llom/util/UtilProvider.java Mon Jun 20 10:58:56 2005
@@ -0,0 +1,45 @@
+package org.apache.axis.soap.impl.llom.util;
+
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMNode;
+
+import java.util.Iterator;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * author : Eran Chinthaka (chinthaka@apache.org)
+ */
+
+public class UtilProvider {
+    public static void setNewElement(OMElement parent, OMElement myElement, OMElement newElement) {
+        if (myElement != null) {
+            myElement.discard();
+        }
+        parent.addChild(newElement);
+        myElement = newElement;
+    }
+
+    public static OMElement getChildWithName(OMElement parent, String childName) {
+        Iterator childrenIter = parent.getChildren();
+        while (childrenIter.hasNext()) {
+            OMNode node = (OMNode) childrenIter.next();
+            if (node.getType() == OMNode.ELEMENT_NODE && childName.equals(((OMElement) node).getLocalName())) {
+                return (OMElement) node;
+            }
+        }
+        return null;
+    }
+}

Added: webservices/axis/trunk/java/modules/xml/test-resources/soap/soap11fault.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test-resources/soap/soap11fault.xml?rev=191524&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test-resources/soap/soap11fault.xml (added)
+++ webservices/axis/trunk/java/modules/xml/test-resources/soap/soap11fault.xml Mon Jun 20 10:58:56 2005
@@ -0,0 +1,16 @@
+ <SOAP-ENV:Envelope
+  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+     <SOAP-ENV:Header>
+         <TestHeader>Test</TestHeader>
+     </SOAP-ENV:Header>
+   <SOAP-ENV:Body>
+       <SOAP-ENV:Fault>
+           <faultcode>SOAP-ENV:MustUnderstand</faultcode>
+           <faultstring>SOAP Must Understand Error</faultstring>
+           <faultactor>Actor</faultactor>
+           <detail>Detail text
+               <SomeElement>Some Element Text</SomeElement>
+           </detail>
+       </SOAP-ENV:Fault>
+   </SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
\ No newline at end of file

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/CompareOMWithDOMTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/CompareOMWithDOMTest.java?rev=191524&r1=191523&r2=191524&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/CompareOMWithDOMTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/CompareOMWithDOMTest.java Mon Jun 20 10:58:56 2005
@@ -20,6 +20,8 @@
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLOutputFactory;
 import java.io.File;
 
 /**
@@ -45,6 +47,10 @@
                     dbf.setNamespaceAware(true);
                     DocumentBuilder builder = dbf.newDocumentBuilder();
                     Document doc = builder.parse(files[i].getAbsolutePath());
+
+//                    XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out) ;
+//                    soapEnvelope.serializeWithCache(writer);
+//                    writer.flush();
                     OMTestUtils.compare(doc.getDocumentElement(), soapEnvelope);
                 }
             }

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/OMBodyTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/OMBodyTest.java?rev=191524&r1=191523&r2=191524&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/OMBodyTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/OMBodyTest.java Mon Jun 20 10:58:56 2005
@@ -16,6 +16,7 @@
 package org.apache.axis.om;
 
 import org.apache.axis.soap.SOAPBody;
+import org.apache.axis.soap.impl.llom.SOAPProcessingException;
 
 public class OMBodyTest extends OMTestCase implements OMConstants {
     SOAPBody soapBody;
@@ -37,7 +38,12 @@
      */
     public void testAddFault() {
         System.out.println("Adding SOAP fault to body ....");
-        soapBody.addChild(soapFactory.createSOAPFault(soapBody, new Exception("Testing soap fault")));
+        try {
+            soapBody.addChild(soapFactory.createSOAPFault(soapBody, new Exception("Testing soap fault")));
+        } catch (SOAPProcessingException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
         System.out.println("\t checking for SOAP Fault ...");
         assertTrue("SOAP body has no SOAP fault", soapBody.hasFault());
         System.out.println("\t checking for not-nullity ...");

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/OMEnvelopeTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/OMEnvelopeTest.java?rev=191524&r1=191523&r2=191524&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/OMEnvelopeTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/OMEnvelopeTest.java Mon Jun 20 10:58:56 2005
@@ -18,6 +18,7 @@
 import org.apache.axis.soap.SOAPBody;
 import org.apache.axis.soap.SOAPEnvelope;
 import org.apache.axis.soap.SOAPHeader;
+import org.apache.axis.soap.impl.llom.SOAPProcessingException;
 
 public class OMEnvelopeTest extends OMTestCase {
     public OMEnvelopeTest(String testName) {
@@ -53,7 +54,13 @@
     }
 
     public void testDefaultEnveleope() {
-        SOAPEnvelope env = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
+        SOAPEnvelope env = null;
+        try {
+            env = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
+        } catch (SOAPProcessingException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
         assertNotNull(env);
         assertNotNull("Header should not be null", env.getHeader());
         assertNotNull("Body should not be null", env.getBody());

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/OMTestUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/OMTestUtils.java?rev=191524&r1=191523&r2=191524&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/OMTestUtils.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/OMTestUtils.java Mon Jun 20 10:58:56 2005
@@ -38,7 +38,7 @@
         if (attibIt != null) {
             while (attibIt.hasNext()) {
                 TestCase.assertNotNull("once the has next is not null, the " +
-                                "element should not be null", attibIt.next());
+                        "element should not be null", attibIt.next());
             }
         }
         Iterator it = omEle.getChildren();
@@ -46,7 +46,7 @@
             while (it.hasNext()) {
                 OMNode ele = (OMNode) it.next();
                 TestCase.assertNotNull("once the has next is not null, the " +
-                                "element should not be null", ele);
+                        "element should not be null", ele);
                 if (ele instanceof OMElement) {
                     walkThrough((OMElement) ele);
                 }
@@ -58,8 +58,11 @@
         if (ele == null && omele == null) {
             return;
         } else if (ele != null && omele != null) {
-            TestCase.assertTrue(ele.getLocalName().equals(omele.getLocalName()));
-            TestCase.assertTrue(ele.getNamespaceURI().equals(omele.getNamespace().getName()));
+            TestCase.assertEquals("Element name not correct", ele.getLocalName(), omele.getLocalName());
+            if (omele.getNamespace() != null) {
+                TestCase.assertEquals("Namespace URI not correct", ele.getNamespaceURI(), omele.getNamespace().getName());
+
+            }
 
             //go through the attributes
             NamedNodeMap map = ele.getAttributes();

Modified: webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/factory/OMLinkedListImplFactoryTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/factory/OMLinkedListImplFactoryTest.java?rev=191524&r1=191523&r2=191524&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/factory/OMLinkedListImplFactoryTest.java (original)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis/om/factory/OMLinkedListImplFactoryTest.java Mon Jun 20 10:58:56 2005
@@ -95,9 +95,9 @@
     public void testCreateSOAPEnvelope() {
         try {
             OMNamespace soapNamespace = omFactory.createOMNamespace(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX);
-            SOAPEnvelope soapEnvelopeTwo = omFactory.createSOAPEnvelope(soapNamespace);
+            SOAPEnvelope soapEnvelopeTwo = omFactory.createSOAPEnvelope();
             assertTrue("Programatically created SOAPEnvelope should have done = true ", soapEnvelopeTwo.isComplete());
-            SOAPEnvelope soapEnvelope = omFactory.createSOAPEnvelope(soapNamespace, OMTestUtils.getOMBuilder(getTestResourceFile("soap/minimalMessage.xml")));
+            SOAPEnvelope soapEnvelope = omFactory.createSOAPEnvelope(OMTestUtils.getOMBuilder(getTestResourceFile("soap/minimalMessage.xml")));
             assertTrue("SOAPEnvelope with a builder should start with done = false ", !soapEnvelope.isComplete());
             assertTrue("This SOAPEnvelope must have a builder ", soapEnvelope.getBuilder() instanceof OMXMLParserWrapper);
 
@@ -129,7 +129,7 @@
             OMXMLParserWrapper omBuilder = OMTestUtils.getOMBuilder(getTestResourceFile("soap/soapmessage.xml"));
             SOAPEnvelope soapEnvelope = (SOAPEnvelope) omBuilder.getDocumentElement();
             SOAPHeader soapHeader = soapEnvelope.getHeader();
-            SOAPHeaderBlock soapHeaderBlock = omFactory.createSOAPHeaderBlock("soapHeaderBlockOne", namespace);
+            SOAPHeaderBlock soapHeaderBlock = omFactory.createSOAPHeaderBlock("soapHeaderBlockOne", namespace, soapHeader);
             assertTrue("Programatically created SOAPHeaderBlock should have done = true ", soapHeaderBlock.isComplete());
             SOAPHeaderBlock soapHeaderBlockTwo = omFactory.createSOAPHeaderBlock("soapHeaderBlockOne", namespace, soapHeader, omBuilder);
             assertTrue("SOAPHeaderBlock with a builder should start with done = false ", !soapHeaderBlockTwo.isComplete());
@@ -149,7 +149,7 @@
             SOAPFault soapFault = omFactory.createSOAPFault(soapBody, new Exception(" this is just a test "));
             assertTrue("Programatically created SOAPFault should have done = true ", soapFault.isComplete());
             soapFault.detach();
-            SOAPFault soapFaultTwo = omFactory.createSOAPFault(namespace, soapBody, omBuilder);
+            SOAPFault soapFaultTwo = omFactory.createSOAPFault(soapBody, omBuilder);
             assertTrue("SOAPFault with a builder should start with done = false ", !soapFaultTwo.isComplete());
             assertTrue("This SOAPFault must have a builder ", soapFaultTwo.getBuilder() instanceof OMXMLParserWrapper);
 

Added: webservices/axis/trunk/java/modules/xml/test/org/apache/axis/soap/impl/llom/builder/StAXSOAPModelBuilderTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis/soap/impl/llom/builder/StAXSOAPModelBuilderTest.java?rev=191524&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis/soap/impl/llom/builder/StAXSOAPModelBuilderTest.java (added)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis/soap/impl/llom/builder/StAXSOAPModelBuilderTest.java Mon Jun 20 10:58:56 2005
@@ -0,0 +1,366 @@
+package org.apache.axis.soap.impl.llom.builder;
+
+import junit.framework.TestCase;
+import javax.xml.stream.*;
+import java.io.StringReader;
+import java.util.Iterator;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.OMAttribute;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.soap.impl.llom.soap12.SOAP12Constants;
+import org.apache.axis.soap.impl.llom.SOAPConstants;
+import org.apache.axis.soap.impl.llom.soap11.SOAP11Constants;
+import org.apache.axis.soap.*;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: Anushka
+ * Date: Jun 3, 2005
+ * Time: 10:22:26 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class StAXSOAPModelBuilderTest extends TestCase {
+
+    public void setUp() {
+
+    }
+
+    public void testStAXSOAPModelBuilder() {
+        String soap12Message =
+                "<?xml version='1.0' ?>" +
+                "<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">\n" +
+                "   <env:Header>\n" +
+                "       <test:echoOk xmlns:test=\"http://example.org/ts-tests\"\n" +
+                "                    env:role=\"http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver\"\n" +
+                "                    env:mustUnderstand=\"true\">\n" +
+                "                       foo\n" +
+                "       </test:echoOk>\n" +
+                "   </env:Header>\n" +
+                "   <env:Body>\n" +
+                "       <env:Fault>\n" +
+                "           <env:Code>\n" +
+                "               <env:Value>env:Sender</env:Value>\n" +
+                "               <env:SubCode>\n" +
+                "                   <env:Value>m:MessageTimeout</env:Value>\n" +
+                "                   <env:SubCode>\n" +
+                "                       <env:Value>m:MessageTimeout</env:Value>\n" +
+                "                   </env:SubCode>\n" +
+                "               </env:SubCode>\n" +
+                "           </env:Code>\n" +
+                "           <env:Reason>\n" +
+                "               <env:Text>Sender Timeout</env:Text>\n" +
+                "           </env:Reason>\n" +
+                "           <env:Node>\n" +
+                "               http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver\n" +
+                "           </env:Node>\n" +
+                "           <env:Role>\n" +
+                "               ultimateReceiver\n" +
+                "           </env:Role>\n" +
+                "           <env:Detail xmlns:m=\"http:www.sample.org\">\n" +
+                "               Details of error\n" +
+                "               <m:MaxTime m:detail=\"This is only a test\">\n" +
+                "                   P5M\n" +
+                "               </m:MaxTime>\n" +
+                "               <m:AveTime>\n" +
+                "                   <m:Time>\n" +
+                "                       P3M\n" +
+                "                   </m:Time>\n" +
+                "               </m:AveTime>\n" +
+                "           </env:Detail>\n" +
+                "       </env:Fault>\n" +
+                "   </env:Body>\n" +
+                "</env:Envelope>";
+
+        String soap11Message =
+                "<?xml version='1.0' ?>" +
+                "<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
+                "   <env:Header>\n" +
+                "       <test:echoOk xmlns:test=\"http://example.org/ts-tests\"\n" +
+                "                    env:actor=\"http://schemas.xmlsoap.org/soap/actor/next\"\n" +
+                "                    env:mustUnderstand=\"1\"" +
+                "       >\n" +
+                "                       foo\n" +
+                "       </test:echoOk>\n" +
+                "   </env:Header>\n" +
+                "   <env:Body>\n" +
+                "       <env:Fault>\n" +
+                "           <env:faultcode>\n" +
+                "               env:Sender\n" +
+                "           </env:faultcode>\n" +
+                "           <env:faultstring>\n" +
+                "               Sender Timeout\n" +
+                "           </env:faultstring>\n" +
+                "           <env:faultactor>\n" +
+                "               http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver\n" +
+                "           </env:faultactor>\n" +
+                "           <env:detail xmlns:m=\"http:www.sample.org\">\n" +
+                "               Details of error\n" +
+                "               <m:MaxTime m:detail=\"This is only a test\">\n" +
+                "                   P5M\n" +
+                "               </m:MaxTime>\n" +
+                "               <m:AveTime>\n" +
+                "                   <m:Time>\n" +
+                "                       P3M\n" +
+                "                   </m:Time>\n" +
+                "               </m:AveTime>\n" +
+                "           </env:detail>\n" +
+                "           <n:Test xmlns:n=\"http:www.Test.org\">\n" +
+                "               <n:TestElement>\n" +
+                "                   This is only a test\n" +
+                "               </n:TestElement>\n" +
+                "           </n:Test>\n" +
+                "       </env:Fault>\n" +
+                "   </env:Body>\n" +
+                "</env:Envelope>";
+
+
+        try {
+            XMLStreamReader sopa12Parser = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(soap12Message));
+            OMXMLParserWrapper soap12Builder = new StAXSOAPModelBuilder(sopa12Parser);
+            SOAPEnvelope soap12Envelope = (SOAPEnvelope) soap12Builder.getDocumentElement();
+            soap12Envelope.build();
+//            XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+//            soap12Envelope.serialize(writer);
+//		    writer.flush();
+
+            assertTrue("SOAP 1.2 :- envelope local name mismatch", soap12Envelope.getLocalName().equals(SOAPConstants.SOAPENVELOPE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- envelope namespace uri mismatch", soap12Envelope.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            SOAPHeader header = soap12Envelope.getHeader();
+            assertTrue("SOAP 1.2 :- Header local name mismatch", header.getLocalName().equals(SOAPConstants.HEADER_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Header namespace uri mismatch", header.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            SOAPHeaderBlock headerBlock = (SOAPHeaderBlock) header.getFirstElement();
+            assertTrue("SOAP 1.2 :- Header block name mismatch", headerBlock.getLocalName().equals("echoOk"));
+            assertTrue("SOAP 1.2 :- Header block name space uri mismatch", headerBlock.getNamespace().getName().equals("http://example.org/ts-tests"));
+            assertTrue("SOAP 1.2 :- Headaer block text mismatch", headerBlock.getText().equals("foo"));
+
+            Iterator headerBlockAttributes = headerBlock.getAttributes();
+            OMAttribute roleAttribute = (OMAttribute) headerBlockAttributes.next();
+            assertTrue("SOAP 1.2 :- Role attribute name mismatch", roleAttribute.getLocalName().equals(SOAP12Constants.SOAP_ROLE));
+            assertTrue("SOAP 1.2 :- Role value mismatch", roleAttribute.getValue().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI + "/" + SOAP12Constants.SOAP_ROLE + "/" + "ultimateReceiver"));
+            assertTrue("SOAP 1.2 :- Role attribute namespace uri mismatch", roleAttribute.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            OMAttribute mustUnderstandAttribute = (OMAttribute) headerBlockAttributes.next();
+            assertTrue("SOAP 1.2 :- Mustunderstand attribute name mismatch", mustUnderstandAttribute.getLocalName().equals(SOAPConstants.ATTR_MUSTUNDERSTAND));
+            assertTrue("SOAP 1.2 :- Mustunderstand value mismatch", mustUnderstandAttribute.getValue().equals(SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE));
+            assertTrue("SOAP 1.2 :- Mustunderstand attribute namespace uri mismatch", mustUnderstandAttribute.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            SOAPBody body = soap12Envelope.getBody();
+            assertTrue("SOAP 1.2 :- Body local name mismatch", body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Body namespace uri mismatch", body.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            SOAPFault fault = body.getFault();
+            assertTrue("SOAP 1.2 :- Fault local name mismatch", fault.getLocalName().equals(SOAPConstants.SOAPFAULT_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault namespace uri mismatch", fault.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            Iterator iteratorInFault = fault.getChildren();
+
+            iteratorInFault.next();
+            SOAPFaultCode code = (SOAPFaultCode) iteratorInFault.next();
+            assertTrue("SOAP 1.2 :- Fault code local name mismatch", code.getLocalName().equals(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch", code.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            Iterator iteratorInCode = code.getChildren();
+
+            iteratorInCode.next();
+            SOAPFaultValue value1 = (SOAPFaultValue) iteratorInCode.next();
+            assertTrue("SOAP 1.2 :- Fault code value local name mismatch", value1.getLocalName().equals(SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch", value1.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+            assertTrue("SOAP 1.2 :- Value1 text mismatch", value1.getText().equals("env:Sender"));
+
+            iteratorInCode.next();
+            SOAPFaultSubCode subCode1 = (SOAPFaultSubCode) iteratorInCode.next();
+            assertTrue("SOAP 1.2 :- Fault sub code local name mismatch", subCode1.getLocalName().equals(SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault subcode namespace uri mismatch", subCode1.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            Iterator iteratorInSubCode1 = subCode1.getChildren();
+
+            iteratorInSubCode1.next();
+            SOAPFaultValue value2 = (SOAPFaultValue) iteratorInSubCode1.next();
+            assertTrue("SOAP 1.2 :- Fault code value local name mismatch", value2.getLocalName().equals(SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch", value2.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+            assertTrue("SOAP 1.2 :- Value2 text mismatch", value2.getText().equals("m:MessageTimeout"));
+
+            iteratorInSubCode1.next();
+            SOAPFaultSubCode subCode2 = (SOAPFaultSubCode) iteratorInSubCode1.next();
+            assertTrue("SOAP 1.2 :- Fault sub code local name mismatch", subCode2.getLocalName().equals(SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault subcode namespace uri mismatch", subCode2.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            Iterator iteratorInSubCode2 = subCode2.getChildren();
+
+            iteratorInSubCode2.next();
+            SOAPFaultValue value3 = (SOAPFaultValue) iteratorInSubCode2.next();
+            assertTrue("SOAP 1.2 :- Fault code value local name mismatch", value3.getLocalName().equals(SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault code namespace uri mismatch", value3.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+            assertTrue("SOAP 1.2 :- Value2 text mismatch", value3.getText().equals("m:MessageTimeout"));
+
+            iteratorInFault.next();
+            SOAPFaultReason reason = (SOAPFaultReason) iteratorInFault.next();
+            assertTrue("SOAP 1.2 :- Fault reason local name mismatch", reason.getLocalName().equals(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault reason namespace uri mismatch", reason.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            Iterator iteratorInReason = reason.getChildren();
+
+            iteratorInReason.next();
+            SOAPFaultText text = (SOAPFaultText) iteratorInReason.next();
+            assertTrue("SOAP 1.2 :- Fault text local name mismatch", text.getLocalName().equals(SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Text namespace uri mismatch", text.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+            assertTrue("SOAP 1.2 :- Text value mismatch", text.getText().equals("Sender Timeout"));
+
+            iteratorInFault.next();
+            SOAPFaultNode node = (SOAPFaultNode) iteratorInFault.next();
+            assertTrue("SOAP 1.2 :- Fault node local name mismatch", node.getLocalName().equals(SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault node namespace uri mismatch", node.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+            assertTrue("SOAP 1.2 :- Node value mismatch", node.getText().equals("http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"));
+
+            iteratorInFault.next();
+            SOAPFaultRole role = (SOAPFaultRole) iteratorInFault.next();
+            assertTrue("SOAP 1.2 :- Fault role local name mismatch", role.getLocalName().equals(SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault role namespace uri mismatch", role.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+            assertTrue("SOAP 1.2 :- Role value mismatch", role.getText().equals("ultimateReceiver"));
+
+            iteratorInFault.next();
+            SOAPFaultDetail detail = (SOAPFaultDetail) iteratorInFault.next();
+            assertTrue("SOAP 1.2 :- Fault detail local name mismatch", detail.getLocalName().equals(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault detail namespace uri mismatch", detail.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            assertTrue("SOAP 1.2 :- Text in detail mismatch",detail.getText().equals("Details of error"));
+
+            Iterator iteratorInDetail = detail.getChildren();
+
+            iteratorInDetail.next();
+            OMElement element1 = (OMElement)iteratorInDetail.next();
+            assertTrue("SOAP 1.2 :- MaxTime element mismatch",element1.getLocalName().equals("MaxTime"));
+            assertTrue("SOAP 1.2 :- MaxTime element namespace mismatch",element1.getNamespace().getName().equals("http:www.sample.org"));
+            assertTrue("SOAP 1.2 :- Text value in MaxTime element mismatch",element1.getText().equals("P5M"));
+
+            Iterator attributeIterator = element1.getAttributes();
+            OMAttribute attributeInMaxTime = (OMAttribute)attributeIterator.next();
+            assertTrue("SOAP 1.2 :- Attribute local name mismatch",attributeInMaxTime.getLocalName().equals("detail"));
+            assertTrue("SOAP 1.2 :- Attribute namespace mismatch",attributeInMaxTime.getNamespace().getName().equals("http:www.sample.org"));
+            assertTrue("SOAP 1.2 :- Attribute value mismatch",attributeInMaxTime.getValue().equals("This is only a test"));
+
+            iteratorInDetail.next();
+            OMElement element2 = (OMElement)iteratorInDetail.next();
+            assertTrue("SOAP 1.2 :- AveTime element mismatch",element2.getLocalName().equals("AveTime"));
+            assertTrue("SOAP 1.2 :- AveTime element namespace mismatch",element2.getNamespace().getName().equals("http:www.sample.org"));
+
+            Iterator iteratorInAveTimeElement = element2.getChildren();
+
+            iteratorInAveTimeElement.next();
+            OMElement element21 = (OMElement)iteratorInAveTimeElement.next();
+            assertTrue("SOAP 1.2 :- Time element mismatch",element21.getLocalName().equals("Time"));
+            assertTrue("SOAP 1.2 :- Time element namespace mismatch",element21.getNamespace().getName().equals("http:www.sample.org"));
+            assertTrue("SOAP 1.2 :- Text value in Time element mismatch",element21.getText().equals("P3M"));
+
+            XMLStreamReader sopa11Parser = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(soap11Message));
+            OMXMLParserWrapper soap11Builder = new StAXSOAPModelBuilder(sopa11Parser);
+            SOAPEnvelope soap11Envelope = (SOAPEnvelope) soap11Builder.getDocumentElement();
+            soap11Envelope.build();
+//            writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+//            soap11Envelope.serialize(writer);
+//		    writer.flush();
+
+            assertTrue("SOAP 1.1 :- envelope local name mismatch", soap11Envelope.getLocalName().equals(SOAPConstants.SOAPENVELOPE_LOCAL_NAME));
+            assertTrue("SOAP 1.1 :- envelope namespace uri mismatch", soap11Envelope.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            header = soap11Envelope.getHeader();
+            assertTrue("SOAP 1.1 :- Header local name mismatch", header.getLocalName().equals(SOAPConstants.HEADER_LOCAL_NAME));
+            assertTrue("SOAP 1.1 :- Header namespace uri mismatch", header.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            headerBlock = (SOAPHeaderBlock) header.getFirstElement();
+            assertTrue("SOAP 1.1 :- Header block name mismatch", headerBlock.getLocalName().equals("echoOk"));
+            assertTrue("SOAP 1.1 :- Header block name space uri mismatch", headerBlock.getNamespace().getName().equals("http://example.org/ts-tests"));
+            assertTrue("SOAP 1.1 :- Headaer block text mismatch", headerBlock.getText().equals("foo"));
+
+            headerBlockAttributes = headerBlock.getAttributes();
+
+            mustUnderstandAttribute = (OMAttribute) headerBlockAttributes.next();
+            assertTrue("SOAP 1.1 :- Mustunderstand attribute name mismatch", mustUnderstandAttribute.getLocalName().equals(SOAPConstants.ATTR_MUSTUNDERSTAND));
+            assertTrue("SOAP 1.1 :- Mustunderstand value mismatch", mustUnderstandAttribute.getValue().equals(SOAPConstants.ATTR_MUSTUNDERSTAND_1));
+            assertTrue("SOAP 1.1 :- Mustunderstand attribute namespace uri mismatch", mustUnderstandAttribute.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            OMAttribute actorAttribute = (OMAttribute) headerBlockAttributes.next();
+            assertTrue("SOAP 1.1 :- Actor attribute name mismatch", actorAttribute.getLocalName().equals(SOAP11Constants.ATTR_ACTOR));
+            assertTrue("SOAP 1.1 :- Actor value mismatch", actorAttribute.getValue().equals("http://schemas.xmlsoap.org/soap/" + SOAP11Constants.ATTR_ACTOR + "/" + "next"));
+            assertTrue("SOAP 1.1 :- Actor attribute namespace uri mismatch", actorAttribute.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            body = soap11Envelope.getBody();
+            assertTrue("SOAP 1.1 :- Body local name mismatch", body.getLocalName().equals(SOAPConstants.BODY_LOCAL_NAME));
+            assertTrue("SOAP 1.1 :- Body namespace uri mismatch", body.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            fault = body.getFault();
+            assertTrue("SOAP 1.1 :- Fault local name mismatch", fault.getLocalName().equals(SOAPConstants.SOAPFAULT_LOCAL_NAME));
+            assertTrue("SOAP 1.1 :- Fault namespace uri mismatch", fault.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+
+            iteratorInFault = fault.getChildren();
+
+            iteratorInFault.next();
+            code = (SOAPFaultCode) iteratorInFault.next();
+            assertTrue("SOAP 1.1 :- Fault code local name mismatch", code.getLocalName().equals(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME));
+            assertTrue("SOAP 1.1 :- Fault code namespace uri mismatch", code.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+            assertTrue("SOAP 1.1 :- Fault code value mismatch",code.getText().equals("env:Sender"));
+
+            iteratorInFault.next();
+            reason = (SOAPFaultReason) iteratorInFault.next();
+            assertTrue("SOAP 1.1 :- Fault string local name mismatch", reason.getLocalName().equals(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME));
+            assertTrue("SOAP 1.2 :- Fault string namespace uri mismatch", reason.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+            assertTrue("SOAP 1.1 :- Fault string value mismatch",reason.getText().equals("Sender Timeout"));
+
+            iteratorInFault.next();
+            role = (SOAPFaultRole) iteratorInFault.next();
+            assertTrue("SOAP 1.1 :- Fault actor local name mismatch", role.getLocalName().equals(SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME));
+            assertTrue("SOAP 1.1 :- Fault actor namespace uri mismatch", role.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+            assertTrue("SOAP 1.1 :- Actor value mismatch", role.getText().equals("http://schemas.xmlsoap.org/soap/envelope/actor/ultimateReceiver"));
+
+            iteratorInFault.next();
+            detail = (SOAPFaultDetail) iteratorInFault.next();
+            assertTrue("SOAP 1.1 :- Fault detail local name mismatch", detail.getLocalName().equals(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
+            assertTrue("SOAP 1.1 :- Fault detail namespace uri mismatch", detail.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI));
+            assertTrue("SOAP 1.2 :- Text in detail mismatch",detail.getText().equals("Details of error"));
+
+            iteratorInDetail = detail.getChildren();
+
+            iteratorInDetail.next();
+            element1 = (OMElement)iteratorInDetail.next();
+            assertTrue("SOAP 1.1 :- MaxTime element mismatch",element1.getLocalName().equals("MaxTime"));
+            assertTrue("SOAP 1.1 :- MaxTime element namespace mismatch",element1.getNamespace().getName().equals("http:www.sample.org"));
+            assertTrue("SOAP 1.1 :- Text value in MaxTime element mismatch",element1.getText().equals("P5M"));
+
+            attributeIterator = element1.getAttributes();
+            attributeInMaxTime = (OMAttribute)attributeIterator.next();
+            assertTrue("SOAP 1.1 :- Attribute local name mismatch",attributeInMaxTime.getLocalName().equals("detail"));
+            assertTrue("SOAP 1.1 :- Attribute namespace mismatch",attributeInMaxTime.getNamespace().getName().equals("http:www.sample.org"));
+            assertTrue("SOAP 1.1 :- Attribute value mismatch",attributeInMaxTime.getValue().equals("This is only a test"));
+
+            iteratorInDetail.next();
+            element2 = (OMElement)iteratorInDetail.next();
+            assertTrue("SOAP 1.1 :- AveTime element mismatch",element2.getLocalName().equals("AveTime"));
+            assertTrue("SOAP 1.1 :- AveTime element namespace mismatch",element2.getNamespace().getName().equals("http:www.sample.org"));
+
+            iteratorInAveTimeElement = element2.getChildren();
+
+            iteratorInAveTimeElement.next();
+            element21 = (OMElement)iteratorInAveTimeElement.next();
+            assertTrue("SOAP 1.1 :- Time element mismatch",element21.getLocalName().equals("Time"));
+            assertTrue("SOAP 1.1 :- Time element namespace mismatch",element21.getNamespace().getName().equals("http:www.sample.org"));
+            assertTrue("SOAP 1.1 :- Text value in Time element mismatch",element21.getText().equals("P3M"));
+
+            iteratorInFault.next();
+            OMElement testElement = (OMElement)iteratorInFault.next();
+            assertTrue("SOAP 1.1 :- Test element mismatch",testElement.getLocalName().equals("Test"));
+            assertTrue("SOAP 1.1 :- Test element namespace mismatch",testElement.getNamespace().getName().equals("http:www.Test.org"));
+
+            OMElement childOfTestElement = testElement.getFirstElement();
+            assertTrue("SOAP 1.1 :- Test element child local name mismatch",childOfTestElement.getLocalName().equals("TestElement"));
+            assertTrue("SOAP 1.1 :- Test element child namespace mismatch",childOfTestElement.getNamespace().getName().equals("http:www.Test.org"));
+            assertTrue("SOAP 1.1 :- Test element child value mismatch",childOfTestElement.getText().equals("This is only a test"));
+
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

Added: webservices/axis/trunk/java/modules/xml/test/org/apache/axis/soap/impl/llom/soap11/SOAP11SerialiserTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/test/org/apache/axis/soap/impl/llom/soap11/SOAP11SerialiserTest.java?rev=191524&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/xml/test/org/apache/axis/soap/impl/llom/soap11/SOAP11SerialiserTest.java (added)
+++ webservices/axis/trunk/java/modules/xml/test/org/apache/axis/soap/impl/llom/soap11/SOAP11SerialiserTest.java Mon Jun 20 10:58:56 2005
@@ -0,0 +1,61 @@
+package org.apache.axis.soap.impl.llom.soap11;
+
+import org.apache.axis.om.OMTestCase;
+import org.apache.axis.soap.impl.llom.builder.StAXSOAPModelBuilder;
+import org.apache.axis.soap.SOAPEnvelope;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.stream.XMLStreamException;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * author : Eran Chinthaka (chinthaka@apache.org)
+ */
+
+public class SOAP11SerialiserTest extends OMTestCase{
+    private XMLStreamWriter writer;
+
+    public SOAP11SerialiserTest(String testName) {
+        super(testName);
+    }
+
+    protected StAXSOAPModelBuilder getOMBuilder(String fileName) throws Exception {
+        return super.getOMBuilder(fileName);
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        soapEnvelope = (SOAPEnvelope) getOMBuilder("soap/soap11fault.xml").getDocumentElement();
+        writer = XMLOutputFactory.newInstance().
+                createXMLStreamWriter(System.out);
+    }
+
+    public void testSerialise(){
+        try {
+            soapEnvelope.serializeWithCache(writer);
+            writer.flush();
+
+            System.out.println("");
+            System.out.println("=======================");
+            soapEnvelope.serialize(writer);
+            writer.flush();
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+        }
+
+    }
+}