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 ru...@apache.org on 2005/11/01 08:58:01 UTC
svn commit: r330005 [2/2] - in
/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom:
soap11/ soap12/
Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12FaultTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12FaultTextImpl.java?rev=330005&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12FaultTextImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12FaultTextImpl.java Mon Oct 31 23:57:42 2005
@@ -0,0 +1,41 @@
+/*
+ * 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.dom.soap12;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.soap.SOAPFaultReason;
+import org.apache.axis2.soap.SOAPProcessingException;
+import org.apache.axis2.soap.impl.dom.SOAPFaultTextImpl;
+
+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");
+ }
+ }
+}
\ No newline at end of file
Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12FaultValueImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12FaultValueImpl.java?rev=330005&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12FaultValueImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12FaultValueImpl.java Mon Oct 31 23:57:42 2005
@@ -0,0 +1,40 @@
+/*
+ * 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.dom.soap12;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.soap.SOAPProcessingException;
+import org.apache.axis2.soap.impl.dom.SOAPFaultValueImpl;
+
+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/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12HeaderBlockImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12HeaderBlockImpl.java?rev=330005&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12HeaderBlockImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12HeaderBlockImpl.java Mon Oct 31 23:57:42 2005
@@ -0,0 +1,122 @@
+/*
+ * 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.dom.soap12;
+
+import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPConstants;
+import org.apache.axis2.soap.SOAPHeader;
+import org.apache.axis2.soap.SOAPProcessingException;
+import org.apache.axis2.soap.impl.dom.SOAPHeaderBlockImpl;
+
+public class SOAP12HeaderBlockImpl extends SOAPHeaderBlockImpl {
+ /**
+ * @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",
+ SOAP12Constants.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() throws SOAPProcessingException {
+ String mustUnderstand = "";
+ if ((mustUnderstand =
+ getAttribute(SOAPConstants.ATTR_MUSTUNDERSTAND,
+ SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI))
+ != null) {
+ if (SOAPConstants.ATTR_MUSTUNDERSTAND_TRUE.equalsIgnoreCase(
+ mustUnderstand) ||
+ SOAPConstants.ATTR_MUSTUNDERSTAND_1.equalsIgnoreCase(
+ mustUnderstand)) {
+ return true;
+ } else if (SOAPConstants.ATTR_MUSTUNDERSTAND_FALSE.equalsIgnoreCase(
+ mustUnderstand) ||
+ SOAPConstants.ATTR_MUSTUNDERSTAND_0.equalsIgnoreCase(
+ mustUnderstand)) {
+ return false;
+ } else {
+ throw new SOAPProcessingException(
+ "Invalid value found in mustUnderstand value of " +
+ this.getLocalName() +
+ " header block");
+ }
+ }
+ return false;
+
+ }
+}
Added: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12HeaderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12HeaderImpl.java?rev=330005&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12HeaderImpl.java (added)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/soap/impl/dom/soap12/SOAP12HeaderImpl.java Mon Oct 31 23:57:42 2005
@@ -0,0 +1,81 @@
+/*
+ * 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.dom.soap12;
+
+import org.apache.axis2.om.OMException;
+import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.OMNodeEx;
+import org.apache.axis2.om.impl.llom.traverse.OMChildrenWithSpecificAttributeIterator;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPHeaderBlock;
+import org.apache.axis2.soap.SOAPProcessingException;
+import org.apache.axis2.soap.impl.dom.SOAPHeaderImpl;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+public class SOAP12HeaderImpl extends SOAPHeaderImpl {
+ /**
+ * @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);
+ }
+ ((OMNodeEx)soapHeaderBlock).setComplete(true);
+ return soapHeaderBlock;
+ }
+
+
+ public Iterator extractHeaderBlocks(String role) {
+ return new OMChildrenWithSpecificAttributeIterator(getFirstOMChild(),
+ new QName(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+ SOAP12Constants.SOAP_ROLE),
+ role,
+ true);
+ }
+}