axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r289289 [125/134] - in /webservices/axis2/trunk/java: ./ etc/ modules/addressing/ modules/addressing/src/META-INF/ modules/addressing/src/org/apache/axis2/handlers/addressing/ modules/addressing/test-resources/ modules/addressing/test/org/a...
Date Thu, 15 Sep 2005 19:07:03 GMT
Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAP11BuilderHelper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAP11BuilderHelper.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAP11BuilderHelper.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAP11BuilderHelper.java Thu Sep 15 11:52:11 2005
@@ -1,162 +1,162 @@
-package org.apache.axis2.soap.impl.llom.builder;
-
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMText;
-import org.apache.axis2.om.impl.llom.exception.OMBuilderException;
-import org.apache.axis2.soap.*;
-import org.apache.axis2.soap.impl.llom.SOAPProcessingException;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-/*
- * 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 SOAP11BuilderHelper extends SOAPBuilderHelper implements SOAP11Constants {
-    private SOAPFactory factory;
-    private boolean faultcodePresent = false;
-    private boolean faultstringPresent = false;
-
-    private OMElement lastProcessedSOAPElement;
-
-    public SOAP11BuilderHelper(StAXSOAPModelBuilder builder) {
-        super(builder);
-        factory = OMAbstractFactory.getSOAP11Factory();
-    }
-
-    public OMElement handleEvent(XMLStreamReader parser,
-                                 OMElement parent,
-                                 int elementLevel) throws SOAPProcessingException {
-        this.parser = parser;
-
-        OMElement element = null;
-        String localName = parser.getLocalName();
-
-        if (elementLevel == 4) {
-
-            if (SOAP_FAULT_CODE_LOCAL_NAME.equals(localName)) {
-                if (faultstringPresent) {
-                    builder.setBooleanProcessingMandatoryFaultElements(false);
-                }
-                SOAPFaultCode code = factory.createSOAPFaultCode(
-                        (SOAPFault) parent, builder);
-                SOAPFaultValue value = factory.createSOAPFaultValue(code);
-                processNamespaceData(code, true);
-                processAttributes(code);
-
-                processText(parser, value);
-                code.setComplete(true);
-                element = code;
-                builder.elementLevel--;
-
-                faultcodePresent = true;
-            } else if (SOAP_FAULT_STRING_LOCAL_NAME.equals(localName)) {
-                if (faultcodePresent) {
-                    builder.setBooleanProcessingMandatoryFaultElements(false);
-                }
-
-
-                SOAPFaultReason reason = factory.createSOAPFaultReason(
-                        (SOAPFault) parent, builder);
-                SOAPFaultText faultText = factory.createSOAPFaultText(reason);
-                processNamespaceData(reason, true);
-                processAttributes(reason);
-
-                processText(parser, faultText);
-                reason.setComplete(true);
-                element = reason;
-                builder.elementLevel--;
-
-
-                faultstringPresent = true;
-            } else if (SOAP_FAULT_ACTOR_LOCAL_NAME.equals(localName)) {
-                element =
-                        factory.createSOAPFaultRole((SOAPFault) parent,
-                                builder);
-                processNamespaceData(element, true);
-                processAttributes(element);
-            } else if (SOAP_FAULT_DETAIL_LOCAL_NAME.equals(localName)) {
-                element =
-                        factory.createSOAPFaultDetail((SOAPFault) parent,
-                                builder);
-                processNamespaceData(element, true);
-                processAttributes(element);
-            } else {
-                element =
-                        OMAbstractFactory.getOMFactory().createOMElement(
-                                localName, null, parent, builder);
-                processNamespaceData(element, false);
-                processAttributes(element);
-            }
-
-        } else if (elementLevel == 5) {
-
-            if (parent.getLocalName().equals(SOAP_FAULT_CODE_LOCAL_NAME)) {
-                throw new OMBuilderException(
-                        "faultcode element should not have children");
-            } else if (parent.getLocalName().equals(
-                    SOAP_FAULT_STRING_LOCAL_NAME)) {
-                throw new OMBuilderException(
-                        "faultstring element should not have children");
-            } else if (parent.getLocalName().equals(
-                    SOAP_FAULT_ACTOR_LOCAL_NAME)) {
-                throw new OMBuilderException(
-                        "faultactor element should not have children");
-            } else {
-                element =
-                        OMAbstractFactory.getOMFactory().createOMElement(
-                                localName, null, parent, builder);
-                processNamespaceData(element, false);
-                processAttributes(element);
-            }
-
-        } else if (elementLevel > 5) {
-            element =
-                    OMAbstractFactory.getOMFactory().createOMElement(localName,
-                            null,
-                            parent,
-                            builder);
-            processNamespaceData(element, false);
-            processAttributes(element);
-        }
-
-        return element;
-    }
-
-    private void processText(XMLStreamReader parser, OMElement value) {
-        try {
-            int token = parser.next();
-            while (token != XMLStreamReader.END_ELEMENT) {
-                if (token == XMLStreamReader.CHARACTERS) {
-                    OMText text = factory.createText(value, parser.getText());
-                    value.addChild(text);
-                } else {
-                    throw new SOAPProcessingException(
-                            "Only Characters are allowed here");
-                }
-                token = parser.next();
-            }
-
-
-        } catch (XMLStreamException e) {
-            throw new SOAPProcessingException(e);
-        }
-    }
-
+package org.apache.axis2.soap.impl.llom.builder;
+
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMText;
+import org.apache.axis2.om.impl.llom.exception.OMBuilderException;
+import org.apache.axis2.soap.*;
+import org.apache.axis2.soap.impl.llom.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+/*
+ * 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 SOAP11BuilderHelper extends SOAPBuilderHelper implements SOAP11Constants {
+    private SOAPFactory factory;
+    private boolean faultcodePresent = false;
+    private boolean faultstringPresent = false;
+
+    private OMElement lastProcessedSOAPElement;
+
+    public SOAP11BuilderHelper(StAXSOAPModelBuilder builder) {
+        super(builder);
+        factory = OMAbstractFactory.getSOAP11Factory();
+    }
+
+    public OMElement handleEvent(XMLStreamReader parser,
+                                 OMElement parent,
+                                 int elementLevel) throws SOAPProcessingException {
+        this.parser = parser;
+
+        OMElement element = null;
+        String localName = parser.getLocalName();
+
+        if (elementLevel == 4) {
+
+            if (SOAP_FAULT_CODE_LOCAL_NAME.equals(localName)) {
+                if (faultstringPresent) {
+                    builder.setBooleanProcessingMandatoryFaultElements(false);
+                }
+                SOAPFaultCode code = factory.createSOAPFaultCode(
+                        (SOAPFault) parent, builder);
+                SOAPFaultValue value = factory.createSOAPFaultValue(code);
+                processNamespaceData(code, true);
+                processAttributes(code);
+
+                processText(parser, value);
+                code.setComplete(true);
+                element = code;
+                builder.elementLevel--;
+
+                faultcodePresent = true;
+            } else if (SOAP_FAULT_STRING_LOCAL_NAME.equals(localName)) {
+                if (faultcodePresent) {
+                    builder.setBooleanProcessingMandatoryFaultElements(false);
+                }
+
+
+                SOAPFaultReason reason = factory.createSOAPFaultReason(
+                        (SOAPFault) parent, builder);
+                SOAPFaultText faultText = factory.createSOAPFaultText(reason);
+                processNamespaceData(reason, true);
+                processAttributes(reason);
+
+                processText(parser, faultText);
+                reason.setComplete(true);
+                element = reason;
+                builder.elementLevel--;
+
+
+                faultstringPresent = true;
+            } else if (SOAP_FAULT_ACTOR_LOCAL_NAME.equals(localName)) {
+                element =
+                        factory.createSOAPFaultRole((SOAPFault) parent,
+                                builder);
+                processNamespaceData(element, true);
+                processAttributes(element);
+            } else if (SOAP_FAULT_DETAIL_LOCAL_NAME.equals(localName)) {
+                element =
+                        factory.createSOAPFaultDetail((SOAPFault) parent,
+                                builder);
+                processNamespaceData(element, true);
+                processAttributes(element);
+            } else {
+                element =
+                        OMAbstractFactory.getOMFactory().createOMElement(
+                                localName, null, parent, builder);
+                processNamespaceData(element, false);
+                processAttributes(element);
+            }
+
+        } else if (elementLevel == 5) {
+
+            if (parent.getLocalName().equals(SOAP_FAULT_CODE_LOCAL_NAME)) {
+                throw new OMBuilderException(
+                        "faultcode element should not have children");
+            } else if (parent.getLocalName().equals(
+                    SOAP_FAULT_STRING_LOCAL_NAME)) {
+                throw new OMBuilderException(
+                        "faultstring element should not have children");
+            } else if (parent.getLocalName().equals(
+                    SOAP_FAULT_ACTOR_LOCAL_NAME)) {
+                throw new OMBuilderException(
+                        "faultactor element should not have children");
+            } else {
+                element =
+                        OMAbstractFactory.getOMFactory().createOMElement(
+                                localName, null, parent, builder);
+                processNamespaceData(element, false);
+                processAttributes(element);
+            }
+
+        } else if (elementLevel > 5) {
+            element =
+                    OMAbstractFactory.getOMFactory().createOMElement(localName,
+                            null,
+                            parent,
+                            builder);
+            processNamespaceData(element, false);
+            processAttributes(element);
+        }
+
+        return element;
+    }
+
+    private void processText(XMLStreamReader parser, OMElement value) {
+        try {
+            int token = parser.next();
+            while (token != XMLStreamReader.END_ELEMENT) {
+                if (token == XMLStreamReader.CHARACTERS) {
+                    OMText text = factory.createText(value, parser.getText());
+                    value.addChild(text);
+                } else {
+                    throw new SOAPProcessingException(
+                            "Only Characters are allowed here");
+                }
+                token = parser.next();
+            }
+
+
+        } catch (XMLStreamException e) {
+            throw new SOAPProcessingException(e);
+        }
+    }
+
 }

Propchange: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAP11BuilderHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAP12BuilderHelper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAP12BuilderHelper.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAP12BuilderHelper.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAP12BuilderHelper.java Thu Sep 15 11:52:11 2005
@@ -1,317 +1,317 @@
-package org.apache.axis2.soap.impl.llom.builder;
-
-import org.apache.axis2.om.OMAbstractFactory;
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.impl.llom.exception.OMBuilderException;
-import org.apache.axis2.soap.*;
-import org.apache.axis2.soap.impl.llom.SOAPProcessingException;
-
-import javax.xml.stream.XMLStreamReader;
-import java.util.Vector;
-
-/*
-* 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 SOAP12BuilderHelper extends SOAPBuilderHelper {
-
-    private SOAPFactory factory;
-    private boolean codePresent = false;
-    private boolean reasonPresent = false;
-    private boolean nodePresent = false;
-    private boolean rolePresent = false;
-    private boolean detailPresent = false;
-    private boolean subcodeValuePresent = false;
-    private boolean subSubcodePresent = false;
-    private boolean valuePresent = false;
-    private boolean subcodePresent = false;
-    private boolean codeprocessing = false;
-    private boolean subCodeProcessing = false;
-    private boolean reasonProcessing = false;
-    private Vector detailElementNames;
-
-    public SOAP12BuilderHelper(StAXSOAPModelBuilder builder) {
-        super(builder);
-        factory = OMAbstractFactory.getSOAP12Factory();
-    }
-
-    public OMElement handleEvent(XMLStreamReader parser,
-                                 OMElement parent,
-                                 int elementLevel) throws SOAPProcessingException {
-
-        this.parser = parser;
-        OMElement element = null;
-
-        if (elementLevel == 4) {
-            if (parser.getLocalName().equals(
-                    SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME)) {
-                if (codePresent) {
-                    throw new OMBuilderException(
-                            "Multiple Code element encountered");
-                } else {
-                    element =
-                            factory.createSOAPFaultCode((SOAPFault) parent,
-                                    builder);
-                    codePresent = true;
-                    codeprocessing = true;
-                }
-            } else if (parser.getLocalName().equals(
-                    SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME)) {
-                if (!codeprocessing && !subCodeProcessing) {
-                    if (codePresent) {
-                        if (reasonPresent) {
-                            throw new OMBuilderException(
-                                    "Multiple Reason Element encountered");
-                        } else {
-                            element =
-                                    factory.createSOAPFaultReason(
-                                            (SOAPFault) parent, builder);
-                            reasonPresent = true;
-                            reasonProcessing = true;
-                        }
-                    } else {
-                        throw new OMBuilderException(
-                                "Wrong element order encountred at " +
-                                parser.getLocalName());
-                    }
-                } else {
-                    if (codeprocessing) {
-                        throw new OMBuilderException(
-                                "Code doesn't have a value");
-                    } else {
-                        throw new OMBuilderException(
-                                "A subcode doesn't have a Value");
-                    }
-                }
-
-            } else if (parser.getLocalName().equals(
-                    SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME)) {
-                if (!reasonProcessing) {
-                    if (reasonPresent && !rolePresent && !detailPresent) {
-                        if (nodePresent) {
-                            throw new OMBuilderException(
-                                    "Multiple Node element encountered");
-                        } else {
-                            element =
-                                    factory.createSOAPFaultNode(
-                                            (SOAPFault) parent, builder);
-                            nodePresent = true;
-                        }
-                    } else {
-                        throw new OMBuilderException(
-                                "wrong element order encountered at " +
-                                parser.getLocalName());
-                    }
-                } else {
-                    throw new OMBuilderException(
-                            "Reason element Should have a text");
-                }
-            } else if (parser.getLocalName().equals(
-                    SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME)) {
-                if (!reasonProcessing) {
-                    if (reasonPresent && !detailPresent) {
-                        if (rolePresent) {
-                            throw new OMBuilderException(
-                                    "Multiple Role element encountered");
-                        } else {
-                            element =
-                                    factory.createSOAPFaultRole(
-                                            (SOAPFault) parent, builder);
-                            rolePresent = true;
-                        }
-                    } else {
-                        throw new OMBuilderException(
-                                "Wrong element order encountered at " +
-                                parser.getLocalName());
-                    }
-                } else {
-                    throw new OMBuilderException(
-                            "Reason element should have a text");
-                }
-            } else if (parser.getLocalName().equals(
-                    SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME)) {
-                if (!reasonProcessing) {
-                    if (reasonPresent) {
-                        if (detailPresent) {
-                            throw new OMBuilderException(
-                                    "Multiple detail element encountered");
-                        } else {
-                            element =
-                                    factory.createSOAPFaultDetail(
-                                            (SOAPFault) parent, builder);
-                            detailPresent = true;
-                        }
-                    } else {
-                        throw new OMBuilderException(
-                                "wrong element order encountered at " +
-                                parser.getLocalName());
-                    }
-                } else {
-                    throw new OMBuilderException(
-                            "Reason element should have a text");
-                }
-            } else {
-                throw new OMBuilderException(
-                        parser.getLocalName() +
-                        " unsupported element in SOAPFault element");
-            }
-
-        } else if (elementLevel == 5) {
-            if (parent.getLocalName().equals(
-                    SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME)) {
-                if (parser.getLocalName().equals(
-                        SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME)) {
-                    if (!valuePresent) {
-                        element =
-                                factory.createSOAPFaultValue(
-                                        (SOAPFaultCode) parent, builder);
-                        valuePresent = true;
-                        codeprocessing = false;
-                    } else {
-                        throw new OMBuilderException(
-                                "Multiple value Encountered in code element");
-                    }
-
-                } else if (parser.getLocalName().equals(
-                        SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME)) {
-                    if (!subcodePresent) {
-                        if (valuePresent) {
-                            element =
-                                    factory.createSOAPFaultSubCode(
-                                            (SOAPFaultCode) parent, builder);
-                            subcodePresent = true;
-                            subCodeProcessing = true;
-                        } else {
-                            throw new OMBuilderException(
-                                    "Value should present before the subcode");
-                        }
-
-                    } else {
-                        throw new OMBuilderException(
-                                "multiple subcode Encountered in code element");
-                    }
-                } else {
-                    throw new OMBuilderException(
-                            parser.getLocalName() +
-                            " is not supported inside the code element");
-                }
-
-            } else if (parent.getLocalName().equals(
-                    SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME)) {
-                if (parser.getLocalName().equals(
-                        SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME)) {
-                    element =
-                            factory.createSOAPFaultText(
-                                    (SOAPFaultReason) parent, builder);
-                    element.setComplete(false);
-                    reasonProcessing = false;
-                    builder.setBooleanProcessingMandatoryFaultElements(false);
-                } else {
-                    throw new OMBuilderException(
-                            parser.getLocalName() +
-                            " is not supported inside the reason");
-                }
-            } else if (parent.getLocalName().equals(
-                    SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME)) {
-                element =
-                        OMAbstractFactory.getOMFactory().createOMElement(
-                                parser.getLocalName(), null, parent, builder);
-                builder.setProcessingDetailElements(true);
-                detailElementNames = new Vector();
-                detailElementNames.add(parser.getLocalName());
-
-            } else {
-                throw new OMBuilderException(
-                        parent.getLocalName() +
-                        " should not have child element");
-            }
-
-
-        } else if (elementLevel > 5) {
-            if (parent.getLocalName().equals(
-                    SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME)) {
-                if (parser.getLocalName().equals(
-                        SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME)) {
-                    if (subcodeValuePresent) {
-                        throw new OMBuilderException(
-                                "multiple subCode value encountered");
-                    } else {
-                        element =
-                                factory.createSOAPFaultValue(
-                                        (SOAPFaultSubCode) parent, builder);
-                        subcodeValuePresent = true;
-                        subSubcodePresent = false;
-                        subCodeProcessing = false;
-                    }
-                } else if (parser.getLocalName().equals(
-                        SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME)) {
-                    if (subcodeValuePresent) {
-                        if (!subSubcodePresent) {
-                            element =
-                                    factory.createSOAPFaultSubCode(
-                                            (SOAPFaultSubCode) parent,
-                                            builder);
-                            subcodeValuePresent = false;
-                            subSubcodePresent = true;
-                            subCodeProcessing = true;
-                        } else {
-                            throw new OMBuilderException(
-                                    "multiple subcode encountered");
-                        }
-                    } else {
-                        throw new OMBuilderException(
-                                "Value should present before the subcode");
-                    }
-                } else {
-                    throw new OMBuilderException(
-                            parser.getLocalName() +
-                            " is not supported inside the subCode element");
-                }
-            } else if (builder.isProcessingDetailElements()) {
-                int detailElementLevel = 0;
-                boolean localNameExist = false;
-                for (int i = 0; i < detailElementNames.size(); i++) {
-                    if (parent.getLocalName().equals(
-                            detailElementNames.get(i))) {
-                        localNameExist = true;
-                        detailElementLevel = i + 1;
-                    }
-                }
-                if (localNameExist) {
-                    detailElementNames.setSize(detailElementLevel);
-                    element =
-                            OMAbstractFactory.getOMFactory().createOMElement(
-                                    parser.getLocalName(),
-                                    null,
-                                    parent,
-                                    builder);
-                    detailElementNames.add(parser.getLocalName());
-                }
-
-            } else {
-                throw new OMBuilderException(
-                        parent.getLocalName() +
-                        " should not have child at element level " +
-                        elementLevel);
-            }
-        }
-
-        processNamespaceData(element, false);
-        processAttributes(element);
-        return element;
-    }
+package org.apache.axis2.soap.impl.llom.builder;
+
+import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.impl.llom.exception.OMBuilderException;
+import org.apache.axis2.soap.*;
+import org.apache.axis2.soap.impl.llom.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamReader;
+import java.util.Vector;
+
+/*
+* 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 SOAP12BuilderHelper extends SOAPBuilderHelper {
+
+    private SOAPFactory factory;
+    private boolean codePresent = false;
+    private boolean reasonPresent = false;
+    private boolean nodePresent = false;
+    private boolean rolePresent = false;
+    private boolean detailPresent = false;
+    private boolean subcodeValuePresent = false;
+    private boolean subSubcodePresent = false;
+    private boolean valuePresent = false;
+    private boolean subcodePresent = false;
+    private boolean codeprocessing = false;
+    private boolean subCodeProcessing = false;
+    private boolean reasonProcessing = false;
+    private Vector detailElementNames;
+
+    public SOAP12BuilderHelper(StAXSOAPModelBuilder builder) {
+        super(builder);
+        factory = OMAbstractFactory.getSOAP12Factory();
+    }
+
+    public OMElement handleEvent(XMLStreamReader parser,
+                                 OMElement parent,
+                                 int elementLevel) throws SOAPProcessingException {
+
+        this.parser = parser;
+        OMElement element = null;
+
+        if (elementLevel == 4) {
+            if (parser.getLocalName().equals(
+                    SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME)) {
+                if (codePresent) {
+                    throw new OMBuilderException(
+                            "Multiple Code element encountered");
+                } else {
+                    element =
+                            factory.createSOAPFaultCode((SOAPFault) parent,
+                                    builder);
+                    codePresent = true;
+                    codeprocessing = true;
+                }
+            } else if (parser.getLocalName().equals(
+                    SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME)) {
+                if (!codeprocessing && !subCodeProcessing) {
+                    if (codePresent) {
+                        if (reasonPresent) {
+                            throw new OMBuilderException(
+                                    "Multiple Reason Element encountered");
+                        } else {
+                            element =
+                                    factory.createSOAPFaultReason(
+                                            (SOAPFault) parent, builder);
+                            reasonPresent = true;
+                            reasonProcessing = true;
+                        }
+                    } else {
+                        throw new OMBuilderException(
+                                "Wrong element order encountred at " +
+                                parser.getLocalName());
+                    }
+                } else {
+                    if (codeprocessing) {
+                        throw new OMBuilderException(
+                                "Code doesn't have a value");
+                    } else {
+                        throw new OMBuilderException(
+                                "A subcode doesn't have a Value");
+                    }
+                }
+
+            } else if (parser.getLocalName().equals(
+                    SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME)) {
+                if (!reasonProcessing) {
+                    if (reasonPresent && !rolePresent && !detailPresent) {
+                        if (nodePresent) {
+                            throw new OMBuilderException(
+                                    "Multiple Node element encountered");
+                        } else {
+                            element =
+                                    factory.createSOAPFaultNode(
+                                            (SOAPFault) parent, builder);
+                            nodePresent = true;
+                        }
+                    } else {
+                        throw new OMBuilderException(
+                                "wrong element order encountered at " +
+                                parser.getLocalName());
+                    }
+                } else {
+                    throw new OMBuilderException(
+                            "Reason element Should have a text");
+                }
+            } else if (parser.getLocalName().equals(
+                    SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME)) {
+                if (!reasonProcessing) {
+                    if (reasonPresent && !detailPresent) {
+                        if (rolePresent) {
+                            throw new OMBuilderException(
+                                    "Multiple Role element encountered");
+                        } else {
+                            element =
+                                    factory.createSOAPFaultRole(
+                                            (SOAPFault) parent, builder);
+                            rolePresent = true;
+                        }
+                    } else {
+                        throw new OMBuilderException(
+                                "Wrong element order encountered at " +
+                                parser.getLocalName());
+                    }
+                } else {
+                    throw new OMBuilderException(
+                            "Reason element should have a text");
+                }
+            } else if (parser.getLocalName().equals(
+                    SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME)) {
+                if (!reasonProcessing) {
+                    if (reasonPresent) {
+                        if (detailPresent) {
+                            throw new OMBuilderException(
+                                    "Multiple detail element encountered");
+                        } else {
+                            element =
+                                    factory.createSOAPFaultDetail(
+                                            (SOAPFault) parent, builder);
+                            detailPresent = true;
+                        }
+                    } else {
+                        throw new OMBuilderException(
+                                "wrong element order encountered at " +
+                                parser.getLocalName());
+                    }
+                } else {
+                    throw new OMBuilderException(
+                            "Reason element should have a text");
+                }
+            } else {
+                throw new OMBuilderException(
+                        parser.getLocalName() +
+                        " unsupported element in SOAPFault element");
+            }
+
+        } else if (elementLevel == 5) {
+            if (parent.getLocalName().equals(
+                    SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME)) {
+                if (parser.getLocalName().equals(
+                        SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME)) {
+                    if (!valuePresent) {
+                        element =
+                                factory.createSOAPFaultValue(
+                                        (SOAPFaultCode) parent, builder);
+                        valuePresent = true;
+                        codeprocessing = false;
+                    } else {
+                        throw new OMBuilderException(
+                                "Multiple value Encountered in code element");
+                    }
+
+                } else if (parser.getLocalName().equals(
+                        SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME)) {
+                    if (!subcodePresent) {
+                        if (valuePresent) {
+                            element =
+                                    factory.createSOAPFaultSubCode(
+                                            (SOAPFaultCode) parent, builder);
+                            subcodePresent = true;
+                            subCodeProcessing = true;
+                        } else {
+                            throw new OMBuilderException(
+                                    "Value should present before the subcode");
+                        }
+
+                    } else {
+                        throw new OMBuilderException(
+                                "multiple subcode Encountered in code element");
+                    }
+                } else {
+                    throw new OMBuilderException(
+                            parser.getLocalName() +
+                            " is not supported inside the code element");
+                }
+
+            } else if (parent.getLocalName().equals(
+                    SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME)) {
+                if (parser.getLocalName().equals(
+                        SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME)) {
+                    element =
+                            factory.createSOAPFaultText(
+                                    (SOAPFaultReason) parent, builder);
+                    element.setComplete(false);
+                    reasonProcessing = false;
+                    builder.setBooleanProcessingMandatoryFaultElements(false);
+                } else {
+                    throw new OMBuilderException(
+                            parser.getLocalName() +
+                            " is not supported inside the reason");
+                }
+            } else if (parent.getLocalName().equals(
+                    SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME)) {
+                element =
+                        OMAbstractFactory.getOMFactory().createOMElement(
+                                parser.getLocalName(), null, parent, builder);
+                builder.setProcessingDetailElements(true);
+                detailElementNames = new Vector();
+                detailElementNames.add(parser.getLocalName());
+
+            } else {
+                throw new OMBuilderException(
+                        parent.getLocalName() +
+                        " should not have child element");
+            }
+
+
+        } else if (elementLevel > 5) {
+            if (parent.getLocalName().equals(
+                    SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME)) {
+                if (parser.getLocalName().equals(
+                        SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME)) {
+                    if (subcodeValuePresent) {
+                        throw new OMBuilderException(
+                                "multiple subCode value encountered");
+                    } else {
+                        element =
+                                factory.createSOAPFaultValue(
+                                        (SOAPFaultSubCode) parent, builder);
+                        subcodeValuePresent = true;
+                        subSubcodePresent = false;
+                        subCodeProcessing = false;
+                    }
+                } else if (parser.getLocalName().equals(
+                        SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME)) {
+                    if (subcodeValuePresent) {
+                        if (!subSubcodePresent) {
+                            element =
+                                    factory.createSOAPFaultSubCode(
+                                            (SOAPFaultSubCode) parent,
+                                            builder);
+                            subcodeValuePresent = false;
+                            subSubcodePresent = true;
+                            subCodeProcessing = true;
+                        } else {
+                            throw new OMBuilderException(
+                                    "multiple subcode encountered");
+                        }
+                    } else {
+                        throw new OMBuilderException(
+                                "Value should present before the subcode");
+                    }
+                } else {
+                    throw new OMBuilderException(
+                            parser.getLocalName() +
+                            " is not supported inside the subCode element");
+                }
+            } else if (builder.isProcessingDetailElements()) {
+                int detailElementLevel = 0;
+                boolean localNameExist = false;
+                for (int i = 0; i < detailElementNames.size(); i++) {
+                    if (parent.getLocalName().equals(
+                            detailElementNames.get(i))) {
+                        localNameExist = true;
+                        detailElementLevel = i + 1;
+                    }
+                }
+                if (localNameExist) {
+                    detailElementNames.setSize(detailElementLevel);
+                    element =
+                            OMAbstractFactory.getOMFactory().createOMElement(
+                                    parser.getLocalName(),
+                                    null,
+                                    parent,
+                                    builder);
+                    detailElementNames.add(parser.getLocalName());
+                }
+
+            } else {
+                throw new OMBuilderException(
+                        parent.getLocalName() +
+                        " should not have child at element level " +
+                        elementLevel);
+            }
+        }
+
+        processNamespaceData(element, false);
+        processAttributes(element);
+        return element;
+    }
 }

Propchange: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAP12BuilderHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAPBuilderHelper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAPBuilderHelper.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAPBuilderHelper.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAPBuilderHelper.java Thu Sep 15 11:52:11 2005
@@ -1,103 +1,103 @@
-package org.apache.axis2.soap.impl.llom.builder;
-
-import org.apache.axis2.om.OMElement;
-import org.apache.axis2.om.OMNamespace;
-import org.apache.axis2.om.impl.llom.exception.OMBuilderException;
-import org.apache.axis2.soap.SOAP11Constants;
-import org.apache.axis2.soap.SOAP12Constants;
-import org.apache.axis2.soap.impl.llom.SOAPProcessingException;
-
-import javax.xml.stream.XMLStreamReader;
-
-/*
- * 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 abstract class SOAPBuilderHelper {
-    protected StAXSOAPModelBuilder builder;
-    protected XMLStreamReader parser;
-
-    protected SOAPBuilderHelper(StAXSOAPModelBuilder builder) {
-        this.builder = builder;
-    }
-
-    public abstract OMElement handleEvent(XMLStreamReader parser,
-                                          OMElement element,
-                                          int elementLevel) throws SOAPProcessingException;
-
-    protected void processNamespaceData(OMElement node, boolean isSOAPElement) {
-        int namespaceCount = parser.getNamespaceCount();
-        for (int i = 0; i < namespaceCount; i++) {
-            node.declareNamespace(parser.getNamespaceURI(i),
-                    parser.getNamespacePrefix(i));
-        }
-
-        // set the own namespace
-        String namespaceURI = parser.getNamespaceURI();
-        String prefix = parser.getPrefix();
-        OMNamespace namespace = null;
-        if (namespaceURI != null && namespaceURI.length() > 0) {
-            if (prefix == null) {
-                // this means, this elements has a default namespace or it has inherited a default namespace from its parent
-                namespace = node.findNamespace(namespaceURI, "");
-                if (namespace == null) {
-                    namespace = node.declareNamespace(namespaceURI, "");
-                }
-            } else {
-                namespace = node.findNamespace(namespaceURI, prefix);
-            }
-            node.setNamespace(namespace);
-        } else {
-
-        }
-
-
-
-        // TODO we got to have this to make sure OM reject mesagess that are not name space qualified
-        // But got to comment this to interop with Axis.1.x
-        // if (namespace == null) {
-        // throw new OMException("All elements must be namespace qualified!");
-        // }
-        if (isSOAPElement) {
-            if (node.getNamespace() != null &&
-                    !node.getNamespace().getName().equals(
-                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI) &&
-                    !node.getNamespace().getName().equals(
-                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
-                throw new OMBuilderException("invalid SOAP namespace URI");
-            }
-        }
-
-    }
-
-    protected void processAttributes(OMElement node) {
-        int attribCount = parser.getAttributeCount();
-        for (int i = 0; i < attribCount; i++) {
-            OMNamespace ns = null;
-            String uri = parser.getAttributeNamespace(i);
-            if (uri.hashCode() != 0) {
-                ns = node.findNamespace(uri,
-                        parser.getAttributePrefix(i));
-            }
-
-            // todo if the attributes are supposed to namespace qualified all the time
-            // todo then this should throw an exception here
-            node.addAttribute(parser.getAttributeLocalName(i),
-                    parser.getAttributeValue(i), ns);
-        }
-    }
-}
+package org.apache.axis2.soap.impl.llom.builder;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.impl.llom.exception.OMBuilderException;
+import org.apache.axis2.soap.SOAP11Constants;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.impl.llom.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamReader;
+
+/*
+ * 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 abstract class SOAPBuilderHelper {
+    protected StAXSOAPModelBuilder builder;
+    protected XMLStreamReader parser;
+
+    protected SOAPBuilderHelper(StAXSOAPModelBuilder builder) {
+        this.builder = builder;
+    }
+
+    public abstract OMElement handleEvent(XMLStreamReader parser,
+                                          OMElement element,
+                                          int elementLevel) throws SOAPProcessingException;
+
+    protected void processNamespaceData(OMElement node, boolean isSOAPElement) {
+        int namespaceCount = parser.getNamespaceCount();
+        for (int i = 0; i < namespaceCount; i++) {
+            node.declareNamespace(parser.getNamespaceURI(i),
+                    parser.getNamespacePrefix(i));
+        }
+
+        // set the own namespace
+        String namespaceURI = parser.getNamespaceURI();
+        String prefix = parser.getPrefix();
+        OMNamespace namespace = null;
+        if (namespaceURI != null && namespaceURI.length() > 0) {
+            if (prefix == null) {
+                // this means, this elements has a default namespace or it has inherited a default namespace from its parent
+                namespace = node.findNamespace(namespaceURI, "");
+                if (namespace == null) {
+                    namespace = node.declareNamespace(namespaceURI, "");
+                }
+            } else {
+                namespace = node.findNamespace(namespaceURI, prefix);
+            }
+            node.setNamespace(namespace);
+        } else {
+
+        }
+
+
+
+        // TODO we got to have this to make sure OM reject mesagess that are not name space qualified
+        // But got to comment this to interop with Axis.1.x
+        // if (namespace == null) {
+        // throw new OMException("All elements must be namespace qualified!");
+        // }
+        if (isSOAPElement) {
+            if (node.getNamespace() != null &&
+                    !node.getNamespace().getName().equals(
+                            SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI) &&
+                    !node.getNamespace().getName().equals(
+                            SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
+                throw new OMBuilderException("invalid SOAP namespace URI");
+            }
+        }
+
+    }
+
+    protected void processAttributes(OMElement node) {
+        int attribCount = parser.getAttributeCount();
+        for (int i = 0; i < attribCount; i++) {
+            OMNamespace ns = null;
+            String uri = parser.getAttributeNamespace(i);
+            if (uri.hashCode() != 0) {
+                ns = node.findNamespace(uri,
+                        parser.getAttributePrefix(i));
+            }
+
+            // todo if the attributes are supposed to namespace qualified all the time
+            // todo then this should throw an exception here
+            node.addAttribute(parser.getAttributeLocalName(i),
+                    parser.getAttributeValue(i), ns);
+        }
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/SOAPBuilderHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilder.java?rev=289289&r1=289288&r2=289289&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilder.java Thu Sep 15 11:52:11 2005
@@ -1,459 +1,459 @@
-/*
-* 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.
-*/
-package org.apache.axis2.soap.impl.llom.builder;
-
-import org.apache.axis2.om.*;
-import org.apache.axis2.om.impl.llom.OMDocumentImpl;
-import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
-import org.apache.axis2.soap.*;
-import org.apache.axis2.soap.impl.llom.SOAPConstants;
-import org.apache.axis2.soap.impl.llom.SOAPEnvelopeImpl;
-import org.apache.axis2.soap.impl.llom.SOAPProcessingException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.xml.stream.XMLStreamReader;
-
-/**
- * Class StAXSOAPModelBuilder
- */
-public class StAXSOAPModelBuilder extends StAXOMBuilder {
-
-    SOAPMessage soapMessage;
-    /**
-     * Field envelope
-     */
-    private SOAPEnvelopeImpl envelope;
-    private OMNamespace envelopeNamespace;
-
-
-    private SOAPFactory soapFactory;
-
-    /**
-     * Field headerPresent
-     */
-    private boolean headerPresent = false;
-
-    /**
-     * Field bodyPresent
-     */
-    private boolean bodyPresent = false;
-
-    /**
-     * Field log
-     */
-    private Log log = LogFactory.getLog(getClass());
-
-    /**
-     * element level 1 = envelope level element level 2 = Header or Body level
-     * element level 3 = HeaderElement or BodyElement level
-     */
-    protected int elementLevel = 0;
-
-    private boolean processingFault = false;
-
-
-
-    //added
-    /* This is used to indicate whether detail element is processing in soap 1.2 builderhelper
-    */
-    private boolean processingDetailElements = false;
-
-    private SOAPBuilderHelper builderHelper;
-    private String senderfaultCode;
-    private String receiverfaultCode;
-    private boolean processingMandatoryFaultElements;
-
-    /**
-     * Constructor StAXSOAPModelBuilder
-     * soapVersion parameter is to give the soap version from the transport. For example, in HTTP case
-     * you can identify the version of the soap message u have recd by looking at the HTTP headers. By passing that
-     * here is to check whether actually the soap message contained also of that version.
-     * If one is not creating the builder from the transport he can just pass null for this.
-     *
-     * @param parser
-     */
-    public StAXSOAPModelBuilder(XMLStreamReader parser, String soapVersion) {
-        super(parser);
-        soapFactory = OMAbstractFactory.getDefaultSOAPFactory();
-        soapMessage = soapFactory.createSOAPMessage(this);
-        identifySOAPVersion(soapVersion);
-        parseHeaders();
-    }
-
-    /**
-     * @param parser
-     * @param factory
-     * @param soapVersion parameter is to give the soap version from the transport. For example, in
-     *          HTTP case you can identify the version of the soap message u have recd by looking at
-     *          the HTTP headers. By passing that here is to check whether actually the soap message
-     *          contained also of that version. If one is not creating the builder from the transport
-     *          he can just pass null for this.
-     */
-    public StAXSOAPModelBuilder(XMLStreamReader parser, SOAPFactory factory, String soapVersion) {
-        super(parser);
-        soapFactory = factory;
-        soapMessage = soapFactory.createSOAPMessage(this);
-        identifySOAPVersion(soapVersion);
-        parseHeaders();
-    }
-
-    private void identifySOAPVersion(String soapVersionURIFromTransport) {
-
-        SOAPEnvelope soapEnvelope = getSOAPEnvelope();
-        if (soapEnvelope == null) {
-            throw new SOAPProcessingException("SOAP Message does not contain an Envelope",
-                    SOAPConstants.FAULT_CODE_VERSION_MISMATCH);
-        }
-
-        envelopeNamespace = soapEnvelope.getNamespace();
-        String namespaceName = envelopeNamespace.getName();
-        if ((soapVersionURIFromTransport != null) && !(soapVersionURIFromTransport.equals(namespaceName))) {
-            throw new SOAPProcessingException("Transport level information does not match with SOAP" +
-                    " Message namespace URI", SOAPConstants.FAULT_CODE_VERSION_MISMATCH);
-
-        }
-
-        if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(namespaceName)) {
-            soapFactory = OMAbstractFactory.getSOAP12Factory();
-            log.info("Starting Process SOAP 1.2 message");
-        } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(namespaceName)) {
-            soapFactory = OMAbstractFactory.getSOAP11Factory();
-            log.info("Starting Process SOAP 1.1 message");
-
-        } else {
-            throw new SOAPProcessingException("Only SOAP 1.1 or SOAP 1.2 messages are supported in the" +
-                    " system", SOAPConstants.FAULT_CODE_VERSION_MISMATCH);
-        }
-    }
-
-    private void parseHeaders() {
-        // by the time execution comes here the nullity of SOAPEnvelope has been cheched in the
-        // identifySOAPVersion() method. So not checking getSOAPEnvelope() == null here
-        SOAPHeader soapHeader = getSOAPEnvelope().getHeader();
-
-        if (soapHeader != null) {
-            while (!soapHeader.isComplete()) {
-                next();
-            }
-        } else {
-            log.info("No SOAPHeaders present !!");
-        }
-    }
-
-
-    /**
-     * Method getSOAPEnvelope
-     *
-     * @return
-     * @throws OMException
-     */
-    public SOAPEnvelope getSOAPEnvelope() throws OMException {
-        while ((envelope == null) && !done) {
-            next();
-        }
-        return envelope;
-    }
-
-    /**
-     * Method createOMElement
-     *
-     * @return
-     * @throws OMException
-     */
-    protected OMNode createOMElement() throws OMException {
-    	elementLevel++;
-        OMElement node;
-        String elementName = parser.getLocalName();
-        if (lastNode == null) {
-            node = constructNode(null, elementName, true);
-            soapMessage.setSOAPEnvelope((SOAPEnvelope) node);
-            soapMessage.setXMLVersion(parser.getVersion());
-            soapMessage.setCharsetEncoding(parser.getCharacterEncodingScheme());
-        } else if (lastNode.isComplete()) {
-            node =
-                    constructNode((OMElement) lastNode.getParent(),
-                            elementName,
-                            false);
-            lastNode.setNextSibling(node);
-            node.setPreviousSibling(lastNode);
-        } else {
-            OMElement e = (OMElement) lastNode;
-            node = constructNode((OMElement) lastNode, elementName, false);
-            e.setFirstChild(node);
-        }
-
-
-        log.info("Build the OMElelment " + node.getLocalName() +
-                "By the StaxSOAPModelBuilder");
-        return node;
-    }
-
-    /**
-     * Method constructNode
-     *
-     * @param parent
-     * @param elementName
-     * @param isEnvelope
-     */
-    protected OMElement constructNode(OMElement parent, String elementName,
-                                      boolean isEnvelope) {
-        OMElement element = null;
-        if (parent == null) {
-            if (!elementName.equalsIgnoreCase(SOAPConstants.SOAPENVELOPE_LOCAL_NAME)) {
-                throw new SOAPProcessingException("First Element must contain the local name, "
-                        + SOAPConstants.SOAPENVELOPE_LOCAL_NAME, SOAPConstants.FAULT_CODE_VERSION_MISMATCH);
-            }
-            envelope =
-                    (SOAPEnvelopeImpl) soapFactory.createSOAPEnvelope(this);
-            element = envelope;
-            processNamespaceData(element, true);
-// fill in the attributes
-            processAttributes(element);
-
-        } else if (elementLevel == 2) {
-
-// this is either a header or a body
-            if (elementName.equals(SOAPConstants.HEADER_LOCAL_NAME)) {
-                if (headerPresent) {
-                    throw new SOAPProcessingException("Multiple headers encountered!", getSenderFaultCode());
-                }
-                if (bodyPresent) {
-                    throw new SOAPProcessingException("Header Body wrong order!", getSenderFaultCode());
-                }
-                headerPresent = true;
-                element =
-                        soapFactory.createSOAPHeader((SOAPEnvelope) parent,
-                                this);
-
-// envelope.setHeader((SOAPHeader)element);
-                processNamespaceData(element, true);
-                processAttributes(element);
-
-            } else if (elementName.equals(SOAPConstants.BODY_LOCAL_NAME)) {
-                if (bodyPresent) {
-                    throw new SOAPProcessingException("Multiple body elements encountered", getSenderFaultCode());
-                }
-                bodyPresent = true;
-                element =
-                        soapFactory.createSOAPBody((SOAPEnvelope) parent,
-                                this);
-
-// envelope.setBody((SOAPBody)element);
-                processNamespaceData(element, true);
-                processAttributes(element);
-
-            } else {
-                throw new SOAPProcessingException(elementName
-                        +
-                        " is not supported here. Envelope can not have elements other than Header and Body.", getSenderFaultCode());
-            }
-        } else if ((elementLevel == 3)
-                &&
-                parent.getLocalName().equalsIgnoreCase(SOAPConstants.HEADER_LOCAL_NAME)) {
-
-// this is a headerblock
-            try {
-                element =
-                        soapFactory.createSOAPHeaderBlock(elementName, null,
-                                (SOAPHeader) parent, this);
-            } catch (SOAPProcessingException e) {
-                throw new SOAPProcessingException("Can not create SOAPHeader block", getReceiverFaultCode(), e);
-            }
-            processNamespaceData(element, false);
-            processAttributes(element);
-
-        } else if ((elementLevel == 3) &&
-                parent.getLocalName().equalsIgnoreCase(SOAPConstants.BODY_LOCAL_NAME) &&
-                elementName.equalsIgnoreCase(SOAPConstants.BODY_FAULT_LOCAL_NAME)) {
-
-// this is a headerblock
-            element = soapFactory.createSOAPFault((SOAPBody) parent, this);
-            processNamespaceData(element, false);
-            processAttributes(element);
-
-
-            processingFault = true;
-
-//added
-            processingMandatoryFaultElements = true;
-            if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelopeNamespace.getName())) {
-                builderHelper = new SOAP12BuilderHelper(this);
-            } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelopeNamespace.getName())) {
-                builderHelper = new SOAP11BuilderHelper(this);
-            }
-
-        } else if (elementLevel > 3 && processingFault) {
-            element = builderHelper.handleEvent(parser, parent, elementLevel);
-        } else {
-
-// this is neither of above. Just create an element
-            element = soapFactory.createOMElement(elementName, null,
-                    parent, this);
-            processNamespaceData(element, false);
-            processAttributes(element);
-
-        }
-        return element;
-    }
-
-    private String getSenderFaultCode() {
-        if(senderfaultCode == null){
-           senderfaultCode = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelopeNamespace.getName()) ? SOAP12Constants.FAULT_CODE_SENDER : SOAP11Constants.FAULT_CODE_SENDER;
-        }
-        return senderfaultCode;
-    }
-
-    private String getReceiverFaultCode() {
-        if(receiverfaultCode == null){
-           receiverfaultCode = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelopeNamespace.getName()) ? SOAP12Constants.FAULT_CODE_RECEIVER : SOAP11Constants.FAULT_CODE_RECEIVER;
-        }
-        return receiverfaultCode;
-    }
-
-    public void endElement(){
-    	 if (lastNode.isComplete()) {
-             OMElement parent = (OMElement) lastNode.getParent();
-
-//             //added
-//             /*check whether all mandatory fault elements are present
-//             */
-//             if (parent.getLocalName().equals(SOAP12Constants.SOAPFAULT_LOCAL_NAME) && processingMandatoryFaultElements) {
-//                 throw new OMBuilderException("Missing mandatory fault elements");
-//             }
-//             //added
-//             /*finish processing detail element in soap 1.2 builderhelper
-//             */
-//             if (parser.getLocalName().equals(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME)) {
-//                 this.setProcessingDetailElements(false);
-//             }
-
-             parent.setComplete(true);
-             lastNode = parent;
-         } else {
-             OMNode e = lastNode;
-             e.setComplete(true);
-         }
-         elementLevel--;
-    }
-
-    /**
-     * Method createDTD
-     * 
-     * Overriding the default behaviour as a SOAPMessage
-     *  should not have a DTD
-     */
-    protected OMNode createDTD() throws OMException {
-    	throw new OMException("SOAP message MUST NOT contain a Document Type Declaration(DTD)");
-    }
-
-    /**
-     * Method createPI
-     * 
-     * Overriding the default behaviour as a SOAP Message 
-     * should not have a PI
-     */
-    protected OMNode createPI() throws OMException {
-    	throw new OMException("SOAP message MUST NOT contain Processing Instructions(PI)");
-    }
-
-    /**
-     * Method getDocumentElement
-     *
-     * @return
-     */
-    public OMElement getDocumentElement() {
-        return getSOAPEnvelope();
-    }
-
-    /**
-     * Method processNamespaceData
-     *
-     * @param node
-     * @param isSOAPElement
-     */
-    protected void processNamespaceData(OMElement node, boolean isSOAPElement) {
-        int namespaceCount = parser.getNamespaceCount();
-        for (int i = 0; i < namespaceCount; i++) {
-            node.declareNamespace(parser.getNamespaceURI(i),
-                    parser.getNamespacePrefix(i));
-        }
-
-// set the own namespace
-        String namespaceURI = parser.getNamespaceURI();
-        String prefix = parser.getPrefix();
-        OMNamespace namespace = null;
-        if (namespaceURI != null && namespaceURI.length() > 0) {
-            if (prefix == null) {
-// this means, this elements has a default namespace or it has inherited a default namespace from its parent
-                namespace = node.findNamespace(namespaceURI, "");
-                if (namespace == null) {
-                    namespace = node.declareNamespace(namespaceURI, "");
-                }
-            } else {
-                namespace = node.findNamespace(namespaceURI, prefix);
-            }
-            node.setNamespace(namespace);
-        }
-
-
-
-// TODO we got to have this to make sure OM reject mesagess that are not name space qualified
-// But got to comment this to interop with Axis.1.x
-// if (namespace == null) {
-// throw new OMException("All elements must be namespace qualified!");
-// }
-        if (isSOAPElement) {
-            if (node.getNamespace() != null &&
-                    !node.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI) &&
-                    !node.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
-                throw new SOAPProcessingException("invalid SOAP namespace URI. " +
-                        "Only " + SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI +
-                        " and "+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI +
-                        " are supported.", SOAP12Constants.FAULT_CODE_SENDER);
-            }
-        }
-
-    }
-
-//added
-/*these three methods to set and check detail element processing or mandatory fault element are present
-*/
-    public OMNamespace getEnvelopeNamespace() {
-        return envelopeNamespace;
-    }
-
-    public void setBooleanProcessingMandatoryFaultElements(boolean value) {
-        this.processingMandatoryFaultElements = value;
-    }
-
-    public boolean isProcessingDetailElements() {
-        return processingDetailElements;
-    }
-
-    public void setProcessingDetailElements(boolean value) {
-        processingDetailElements = value;
-    }
-
-    public SOAPMessage getSoapMessage() {
-        return soapMessage;
-    }
-
-    public OMDocument getDocument() {
-        return (OMDocumentImpl) this.soapMessage;
-    }
-
-}
+/*
+* 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.
+*/
+package org.apache.axis2.soap.impl.llom.builder;
+
+import org.apache.axis2.om.*;
+import org.apache.axis2.om.impl.llom.OMDocumentImpl;
+import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.axis2.soap.*;
+import org.apache.axis2.soap.impl.llom.SOAPConstants;
+import org.apache.axis2.soap.impl.llom.SOAPEnvelopeImpl;
+import org.apache.axis2.soap.impl.llom.SOAPProcessingException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * Class StAXSOAPModelBuilder
+ */
+public class StAXSOAPModelBuilder extends StAXOMBuilder {
+
+    SOAPMessage soapMessage;
+    /**
+     * Field envelope
+     */
+    private SOAPEnvelopeImpl envelope;
+    private OMNamespace envelopeNamespace;
+
+
+    private SOAPFactory soapFactory;
+
+    /**
+     * Field headerPresent
+     */
+    private boolean headerPresent = false;
+
+    /**
+     * Field bodyPresent
+     */
+    private boolean bodyPresent = false;
+
+    /**
+     * Field log
+     */
+    private Log log = LogFactory.getLog(getClass());
+
+    /**
+     * element level 1 = envelope level element level 2 = Header or Body level
+     * element level 3 = HeaderElement or BodyElement level
+     */
+    protected int elementLevel = 0;
+
+    private boolean processingFault = false;
+
+
+
+    //added
+    /* This is used to indicate whether detail element is processing in soap 1.2 builderhelper
+    */
+    private boolean processingDetailElements = false;
+
+    private SOAPBuilderHelper builderHelper;
+    private String senderfaultCode;
+    private String receiverfaultCode;
+    private boolean processingMandatoryFaultElements;
+
+    /**
+     * Constructor StAXSOAPModelBuilder
+     * soapVersion parameter is to give the soap version from the transport. For example, in HTTP case
+     * you can identify the version of the soap message u have recd by looking at the HTTP headers. By passing that
+     * here is to check whether actually the soap message contained also of that version.
+     * If one is not creating the builder from the transport he can just pass null for this.
+     *
+     * @param parser
+     */
+    public StAXSOAPModelBuilder(XMLStreamReader parser, String soapVersion) {
+        super(parser);
+        soapFactory = OMAbstractFactory.getDefaultSOAPFactory();
+        soapMessage = soapFactory.createSOAPMessage(this);
+        identifySOAPVersion(soapVersion);
+        parseHeaders();
+    }
+
+    /**
+     * @param parser
+     * @param factory
+     * @param soapVersion parameter is to give the soap version from the transport. For example, in
+     *          HTTP case you can identify the version of the soap message u have recd by looking at
+     *          the HTTP headers. By passing that here is to check whether actually the soap message
+     *          contained also of that version. If one is not creating the builder from the transport
+     *          he can just pass null for this.
+     */
+    public StAXSOAPModelBuilder(XMLStreamReader parser, SOAPFactory factory, String soapVersion) {
+        super(parser);
+        soapFactory = factory;
+        soapMessage = soapFactory.createSOAPMessage(this);
+        identifySOAPVersion(soapVersion);
+        parseHeaders();
+    }
+
+    private void identifySOAPVersion(String soapVersionURIFromTransport) {
+
+        SOAPEnvelope soapEnvelope = getSOAPEnvelope();
+        if (soapEnvelope == null) {
+            throw new SOAPProcessingException("SOAP Message does not contain an Envelope",
+                    SOAPConstants.FAULT_CODE_VERSION_MISMATCH);
+        }
+
+        envelopeNamespace = soapEnvelope.getNamespace();
+        String namespaceName = envelopeNamespace.getName();
+        if ((soapVersionURIFromTransport != null) && !(soapVersionURIFromTransport.equals(namespaceName))) {
+            throw new SOAPProcessingException("Transport level information does not match with SOAP" +
+                    " Message namespace URI", SOAPConstants.FAULT_CODE_VERSION_MISMATCH);
+
+        }
+
+        if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(namespaceName)) {
+            soapFactory = OMAbstractFactory.getSOAP12Factory();
+            log.info("Starting Process SOAP 1.2 message");
+        } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(namespaceName)) {
+            soapFactory = OMAbstractFactory.getSOAP11Factory();
+            log.info("Starting Process SOAP 1.1 message");
+
+        } else {
+            throw new SOAPProcessingException("Only SOAP 1.1 or SOAP 1.2 messages are supported in the" +
+                    " system", SOAPConstants.FAULT_CODE_VERSION_MISMATCH);
+        }
+    }
+
+    private void parseHeaders() {
+        // by the time execution comes here the nullity of SOAPEnvelope has been cheched in the
+        // identifySOAPVersion() method. So not checking getSOAPEnvelope() == null here
+        SOAPHeader soapHeader = getSOAPEnvelope().getHeader();
+
+        if (soapHeader != null) {
+            while (!soapHeader.isComplete()) {
+                next();
+            }
+        } else {
+            log.info("No SOAPHeaders present !!");
+        }
+    }
+
+
+    /**
+     * Method getSOAPEnvelope
+     *
+     * @return
+     * @throws OMException
+     */
+    public SOAPEnvelope getSOAPEnvelope() throws OMException {
+        while ((envelope == null) && !done) {
+            next();
+        }
+        return envelope;
+    }
+
+    /**
+     * Method createOMElement
+     *
+     * @return
+     * @throws OMException
+     */
+    protected OMNode createOMElement() throws OMException {
+    	elementLevel++;
+        OMElement node;
+        String elementName = parser.getLocalName();
+        if (lastNode == null) {
+            node = constructNode(null, elementName, true);
+            soapMessage.setSOAPEnvelope((SOAPEnvelope) node);
+            soapMessage.setXMLVersion(parser.getVersion());
+            soapMessage.setCharsetEncoding(parser.getCharacterEncodingScheme());
+        } else if (lastNode.isComplete()) {
+            node =
+                    constructNode((OMElement) lastNode.getParent(),
+                            elementName,
+                            false);
+            lastNode.setNextSibling(node);
+            node.setPreviousSibling(lastNode);
+        } else {
+            OMElement e = (OMElement) lastNode;
+            node = constructNode((OMElement) lastNode, elementName, false);
+            e.setFirstChild(node);
+        }
+
+
+        log.info("Build the OMElelment " + node.getLocalName() +
+                "By the StaxSOAPModelBuilder");
+        return node;
+    }
+
+    /**
+     * Method constructNode
+     *
+     * @param parent
+     * @param elementName
+     * @param isEnvelope
+     */
+    protected OMElement constructNode(OMElement parent, String elementName,
+                                      boolean isEnvelope) {
+        OMElement element = null;
+        if (parent == null) {
+            if (!elementName.equalsIgnoreCase(SOAPConstants.SOAPENVELOPE_LOCAL_NAME)) {
+                throw new SOAPProcessingException("First Element must contain the local name, "
+                        + SOAPConstants.SOAPENVELOPE_LOCAL_NAME, SOAPConstants.FAULT_CODE_VERSION_MISMATCH);
+            }
+            envelope =
+                    (SOAPEnvelopeImpl) soapFactory.createSOAPEnvelope(this);
+            element = envelope;
+            processNamespaceData(element, true);
+// fill in the attributes
+            processAttributes(element);
+
+        } else if (elementLevel == 2) {
+
+// this is either a header or a body
+            if (elementName.equals(SOAPConstants.HEADER_LOCAL_NAME)) {
+                if (headerPresent) {
+                    throw new SOAPProcessingException("Multiple headers encountered!", getSenderFaultCode());
+                }
+                if (bodyPresent) {
+                    throw new SOAPProcessingException("Header Body wrong order!", getSenderFaultCode());
+                }
+                headerPresent = true;
+                element =
+                        soapFactory.createSOAPHeader((SOAPEnvelope) parent,
+                                this);
+
+// envelope.setHeader((SOAPHeader)element);
+                processNamespaceData(element, true);
+                processAttributes(element);
+
+            } else if (elementName.equals(SOAPConstants.BODY_LOCAL_NAME)) {
+                if (bodyPresent) {
+                    throw new SOAPProcessingException("Multiple body elements encountered", getSenderFaultCode());
+                }
+                bodyPresent = true;
+                element =
+                        soapFactory.createSOAPBody((SOAPEnvelope) parent,
+                                this);
+
+// envelope.setBody((SOAPBody)element);
+                processNamespaceData(element, true);
+                processAttributes(element);
+
+            } else {
+                throw new SOAPProcessingException(elementName
+                        +
+                        " is not supported here. Envelope can not have elements other than Header and Body.", getSenderFaultCode());
+            }
+        } else if ((elementLevel == 3)
+                &&
+                parent.getLocalName().equalsIgnoreCase(SOAPConstants.HEADER_LOCAL_NAME)) {
+
+// this is a headerblock
+            try {
+                element =
+                        soapFactory.createSOAPHeaderBlock(elementName, null,
+                                (SOAPHeader) parent, this);
+            } catch (SOAPProcessingException e) {
+                throw new SOAPProcessingException("Can not create SOAPHeader block", getReceiverFaultCode(), e);
+            }
+            processNamespaceData(element, false);
+            processAttributes(element);
+
+        } else if ((elementLevel == 3) &&
+                parent.getLocalName().equalsIgnoreCase(SOAPConstants.BODY_LOCAL_NAME) &&
+                elementName.equalsIgnoreCase(SOAPConstants.BODY_FAULT_LOCAL_NAME)) {
+
+// this is a headerblock
+            element = soapFactory.createSOAPFault((SOAPBody) parent, this);
+            processNamespaceData(element, false);
+            processAttributes(element);
+
+
+            processingFault = true;
+
+//added
+            processingMandatoryFaultElements = true;
+            if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelopeNamespace.getName())) {
+                builderHelper = new SOAP12BuilderHelper(this);
+            } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelopeNamespace.getName())) {
+                builderHelper = new SOAP11BuilderHelper(this);
+            }
+
+        } else if (elementLevel > 3 && processingFault) {
+            element = builderHelper.handleEvent(parser, parent, elementLevel);
+        } else {
+
+// this is neither of above. Just create an element
+            element = soapFactory.createOMElement(elementName, null,
+                    parent, this);
+            processNamespaceData(element, false);
+            processAttributes(element);
+
+        }
+        return element;
+    }
+
+    private String getSenderFaultCode() {
+        if(senderfaultCode == null){
+           senderfaultCode = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelopeNamespace.getName()) ? SOAP12Constants.FAULT_CODE_SENDER : SOAP11Constants.FAULT_CODE_SENDER;
+        }
+        return senderfaultCode;
+    }
+
+    private String getReceiverFaultCode() {
+        if(receiverfaultCode == null){
+           receiverfaultCode = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(envelopeNamespace.getName()) ? SOAP12Constants.FAULT_CODE_RECEIVER : SOAP11Constants.FAULT_CODE_RECEIVER;
+        }
+        return receiverfaultCode;
+    }
+
+    public void endElement(){
+    	 if (lastNode.isComplete()) {
+             OMElement parent = (OMElement) lastNode.getParent();
+
+//             //added
+//             /*check whether all mandatory fault elements are present
+//             */
+//             if (parent.getLocalName().equals(SOAP12Constants.SOAPFAULT_LOCAL_NAME) && processingMandatoryFaultElements) {
+//                 throw new OMBuilderException("Missing mandatory fault elements");
+//             }
+//             //added
+//             /*finish processing detail element in soap 1.2 builderhelper
+//             */
+//             if (parser.getLocalName().equals(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME)) {
+//                 this.setProcessingDetailElements(false);
+//             }
+
+             parent.setComplete(true);
+             lastNode = parent;
+         } else {
+             OMNode e = lastNode;
+             e.setComplete(true);
+         }
+         elementLevel--;
+    }
+
+    /**
+     * Method createDTD
+     * 
+     * Overriding the default behaviour as a SOAPMessage
+     *  should not have a DTD
+     */
+    protected OMNode createDTD() throws OMException {
+    	throw new OMException("SOAP message MUST NOT contain a Document Type Declaration(DTD)");
+    }
+
+    /**
+     * Method createPI
+     * 
+     * Overriding the default behaviour as a SOAP Message 
+     * should not have a PI
+     */
+    protected OMNode createPI() throws OMException {
+    	throw new OMException("SOAP message MUST NOT contain Processing Instructions(PI)");
+    }
+
+    /**
+     * Method getDocumentElement
+     *
+     * @return
+     */
+    public OMElement getDocumentElement() {
+        return getSOAPEnvelope();
+    }
+
+    /**
+     * Method processNamespaceData
+     *
+     * @param node
+     * @param isSOAPElement
+     */
+    protected void processNamespaceData(OMElement node, boolean isSOAPElement) {
+        int namespaceCount = parser.getNamespaceCount();
+        for (int i = 0; i < namespaceCount; i++) {
+            node.declareNamespace(parser.getNamespaceURI(i),
+                    parser.getNamespacePrefix(i));
+        }
+
+// set the own namespace
+        String namespaceURI = parser.getNamespaceURI();
+        String prefix = parser.getPrefix();
+        OMNamespace namespace = null;
+        if (namespaceURI != null && namespaceURI.length() > 0) {
+            if (prefix == null) {
+// this means, this elements has a default namespace or it has inherited a default namespace from its parent
+                namespace = node.findNamespace(namespaceURI, "");
+                if (namespace == null) {
+                    namespace = node.declareNamespace(namespaceURI, "");
+                }
+            } else {
+                namespace = node.findNamespace(namespaceURI, prefix);
+            }
+            node.setNamespace(namespace);
+        }
+
+
+
+// TODO we got to have this to make sure OM reject mesagess that are not name space qualified
+// But got to comment this to interop with Axis.1.x
+// if (namespace == null) {
+// throw new OMException("All elements must be namespace qualified!");
+// }
+        if (isSOAPElement) {
+            if (node.getNamespace() != null &&
+                    !node.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI) &&
+                    !node.getNamespace().getName().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
+                throw new SOAPProcessingException("invalid SOAP namespace URI. " +
+                        "Only " + SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI +
+                        " and "+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI +
+                        " are supported.", SOAP12Constants.FAULT_CODE_SENDER);
+            }
+        }
+
+    }
+
+//added
+/*these three methods to set and check detail element processing or mandatory fault element are present
+*/
+    public OMNamespace getEnvelopeNamespace() {
+        return envelopeNamespace;
+    }
+
+    public void setBooleanProcessingMandatoryFaultElements(boolean value) {
+        this.processingMandatoryFaultElements = value;
+    }
+
+    public boolean isProcessingDetailElements() {
+        return processingDetailElements;
+    }
+
+    public void setProcessingDetailElements(boolean value) {
+        processingDetailElements = value;
+    }
+
+    public SOAPMessage getSoapMessage() {
+        return soapMessage;
+    }
+
+    public OMDocument getDocument() {
+        return (OMDocumentImpl) this.soapMessage;
+    }
+
+}

Propchange: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/builder/StAXSOAPModelBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message