You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ch...@apache.org on 2006/02/01 11:36:10 UTC
svn commit: r374036 [8/15] - in /webservices/commons/trunk/axiom:
src/org/apache/ws/ src/org/apache/ws/commons/
src/org/apache/ws/commons/attachments/
src/org/apache/ws/commons/attachments/utils/ src/org/apache/ws/commons/om/
src/org/apache/ws/commons/...
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/builder/SOAP12BuilderHelper.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/builder/SOAP12BuilderHelper.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/builder/SOAP12BuilderHelper.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/builder/SOAP12BuilderHelper.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,321 @@
+/*
+ * 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.ws.commons.soap.impl.llom.builder;
+
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.impl.OMNodeEx;
+import org.apache.ws.commons.om.impl.llom.exception.OMBuilderException;
+import org.apache.ws.commons.soap.SOAP12Constants;
+import org.apache.ws.commons.soap.SOAPFactory;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPFaultCode;
+import org.apache.ws.commons.soap.SOAPFaultReason;
+import org.apache.ws.commons.soap.SOAPFaultSubCode;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamReader;
+import java.util.Vector;
+
+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 = builder.getSoapFactory();
+ }
+
+ 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);
+ ((OMNodeEx)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 =
+ this.factory.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 =
+ this.factory.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;
+ }
+}
\ No newline at end of file
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/builder/SOAPBuilderHelper.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/builder/SOAPBuilderHelper.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/builder/SOAPBuilderHelper.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/builder/SOAPBuilderHelper.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,101 @@
+/*
+ * 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.ws.commons.soap.impl.llom.builder;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMNamespace;
+import org.apache.ws.commons.om.impl.llom.exception.OMBuilderException;
+import org.apache.ws.commons.soap.SOAP11Constants;
+import org.apache.ws.commons.soap.SOAP12Constants;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+
+import javax.xml.stream.XMLStreamReader;
+
+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);
+ }
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/builder/StAXSOAPModelBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/builder/StAXSOAPModelBuilder.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/builder/StAXSOAPModelBuilder.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/builder/StAXSOAPModelBuilder.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,427 @@
+/*
+ * 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.ws.commons.soap.impl.llom.builder;
+
+import org.apache.ws.commons.om.OMAbstractFactory;
+import org.apache.ws.commons.om.OMDocument;
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMException;
+import org.apache.ws.commons.om.OMNamespace;
+import org.apache.ws.commons.om.OMNode;
+import org.apache.ws.commons.om.impl.OMNodeEx;
+import org.apache.ws.commons.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.ws.commons.soap.SOAP11Constants;
+import org.apache.ws.commons.soap.SOAP12Constants;
+import org.apache.ws.commons.soap.SOAPBody;
+import org.apache.ws.commons.soap.SOAPConstants;
+import org.apache.ws.commons.soap.SOAPEnvelope;
+import org.apache.ws.commons.soap.SOAPFactory;
+import org.apache.ws.commons.soap.SOAPHeader;
+import org.apache.ws.commons.soap.SOAPMessage;
+import org.apache.ws.commons.soap.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 SOAPEnvelope 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;
+
+ // We need to have soap factory, temporary, until we find out the correct SOAP version. If user has not provided
+ // a SOAP factory, internally we are creating a default one. This flag will be set if we create one internally, to
+ // warn that this should be replaced later.
+ private boolean isTempSOAPFactory = true;
+
+ /**
+ * 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.
+ * It is used to check whether the actual soap message contained is of that version.
+ * If one is creates the builder from the transport, then can just pass null for version.
+ *
+ * @param parser
+ * @param soapVersion parameter is to give the soap version for the transport.
+ */
+ public StAXSOAPModelBuilder(XMLStreamReader parser, String soapVersion) {
+ super(parser);
+ soapFactory = OMAbstractFactory.getDefaultSOAPFactory();
+ isTempSOAPFactory = true;
+ soapMessage = soapFactory.createSOAPMessage(this);
+ this.document = soapMessage;
+ if(parser.getCharacterEncodingScheme() != null) {
+ document.setCharsetEncoding(parser.getCharacterEncodingScheme());
+ }
+ identifySOAPVersion(soapVersion);
+ }
+
+ /**
+ * @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. It is used to check whether the actual soap message
+ * contained is of that version.If one is creates the builder from the transport,
+ * then can just pass null for version.
+ */
+ public StAXSOAPModelBuilder(XMLStreamReader parser, SOAPFactory factory, String soapVersion) {
+ super(factory, parser);
+ soapFactory = factory;
+ isTempSOAPFactory = false;
+ soapMessage = soapFactory.createSOAPMessage(this);
+ this.document = soapMessage;
+ identifySOAPVersion(soapVersion);
+ }
+
+ protected 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(isTempSOAPFactory) {
+ if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(namespaceName)) {
+ soapFactory = OMAbstractFactory.getSOAP12Factory();
+ log.debug("Starting to process SOAP 1.2 message");
+ } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(namespaceName)) {
+ soapFactory = OMAbstractFactory.getSOAP11Factory();
+ log.debug("Starting to 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);
+ }
+ }
+ }
+
+ /**
+ * Method getSOAPEnvelope.
+ *
+ * @return Returns SOAPEnvelope.
+ * @throws OMException
+ */
+ public SOAPEnvelope getSOAPEnvelope() throws OMException {
+ while ((envelope == null) && !done) {
+ next();
+ }
+ return envelope;
+ }
+
+ /**
+ * Method createOMElement.
+ *
+ * @return Returns OMNode.
+ * @throws OMException
+ */
+ protected OMNode createOMElement() throws OMException {
+ elementLevel++;
+ OMElement node;
+ String elementName = parser.getLocalName();
+ if (lastNode == null) {
+ node = constructNode(null, elementName, true);
+ setSOAPEnvelope(node);
+ } else if (lastNode.isComplete()) {
+ node =
+ constructNode((OMElement) lastNode.getParent(),
+ elementName,
+ false);
+ ((OMNodeEx) lastNode).setNextOMSibling(node);
+ ((OMNodeEx) node).setPreviousOMSibling(lastNode);
+ } else {
+ OMElement e = (OMElement) lastNode;
+ node = constructNode((OMElement) lastNode, elementName, false);
+ e.setFirstChild(node);
+ }
+
+
+ log.debug("Build the OMElelment " + node.getLocalName() +
+ "By the StaxSOAPModelBuilder");
+ return node;
+ }
+
+ protected void setSOAPEnvelope(OMElement node) {
+ soapMessage.setSOAPEnvelope((SOAPEnvelope) node);
+ soapMessage.setXMLVersion(parser.getVersion());
+ soapMessage.setCharsetEncoding(parser.getCharacterEncodingScheme());
+ }
+
+ /**
+ * 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 = 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);
+
+ 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);
+
+ 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;
+ 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();
+ ((OMNodeEx) parent).setComplete(true);
+ lastNode = parent;
+ } else {
+ OMNode e = lastNode;
+ ((OMNodeEx) 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 Returns OMElement.
+ */
+ public OMElement getDocumentElement() {
+ return getSOAPEnvelope();
+ }
+
+ /**
+ * Method processNamespaceData.
+ *
+ * @param node
+ * @param isSOAPElement
+ */
+ protected void processNamespaceData(OMElement node, boolean isSOAPElement) {
+
+ super.processNamespaceData(node, isSOAPElement);
+
+ 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);
+ }
+ }
+
+ }
+
+/*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 (OMDocument) this.soapMessage;
+ }
+
+ /**
+ * @return Returns the soapFactory.
+ */
+ protected SOAPFactory getSoapFactory() {
+ return soapFactory;
+ }
+
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/factory/SOAPLinkedListImplFactory.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/factory/SOAPLinkedListImplFactory.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/factory/SOAPLinkedListImplFactory.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/factory/SOAPLinkedListImplFactory.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,235 @@
+/*
+ * 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.ws.commons.soap.impl.llom.factory;
+
+import org.apache.ws.commons.om.OMNamespace;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.om.impl.llom.factory.OMLinkedListImplFactory;
+import org.apache.ws.commons.soap.SOAPBody;
+import org.apache.ws.commons.soap.SOAPEnvelope;
+import org.apache.ws.commons.soap.SOAPFactory;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPFaultCode;
+import org.apache.ws.commons.soap.SOAPFaultDetail;
+import org.apache.ws.commons.soap.SOAPFaultNode;
+import org.apache.ws.commons.soap.SOAPFaultReason;
+import org.apache.ws.commons.soap.SOAPFaultRole;
+import org.apache.ws.commons.soap.SOAPFaultSubCode;
+import org.apache.ws.commons.soap.SOAPFaultText;
+import org.apache.ws.commons.soap.SOAPFaultValue;
+import org.apache.ws.commons.soap.SOAPHeader;
+import org.apache.ws.commons.soap.SOAPHeaderBlock;
+import org.apache.ws.commons.soap.SOAPMessage;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPEnvelopeImpl;
+import org.apache.ws.commons.soap.impl.llom.SOAPMessageImpl;
+
+public class SOAPLinkedListImplFactory extends OMLinkedListImplFactory implements SOAPFactory {
+ public String getSoapVersionURI() {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPMessage createSOAPMessage(OMXMLParserWrapper builder) {
+ return new SOAPMessageImpl(builder);
+ }
+
+
+ public SOAPMessage createSOAPMessage(SOAPEnvelope envelope, OMXMLParserWrapper parserWrapper) {
+ return new SOAPMessageImpl(envelope, parserWrapper);
+ }
+
+ /**
+ * Eran Chinthaka (chinthaka@apache.org)
+ */
+
+ public SOAPEnvelope createSOAPEnvelope(OMXMLParserWrapper builder) {
+ return new SOAPEnvelopeImpl(builder, this);
+ }
+
+ public SOAPEnvelope createSOAPEnvelope() {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPHeader createSOAPHeader(SOAPEnvelope envelope,
+ OMXMLParserWrapper builder) {
+ throw new UnsupportedOperationException();
+
+ }
+
+ public SOAPHeaderBlock createSOAPHeaderBlock(String localName,
+ OMNamespace ns,
+ SOAPHeader parent) throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+
+ }
+
+ public SOAPHeaderBlock createSOAPHeaderBlock(String localName,
+ OMNamespace ns,
+ SOAPHeader parent,
+ OMXMLParserWrapper builder) throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+
+ }
+
+
+ public SOAPFault createSOAPFault(SOAPBody parent, Exception e) throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFault createSOAPFault(SOAPBody parent) throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFault createSOAPFault(SOAPBody parent,
+ OMXMLParserWrapper builder) {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPBody createSOAPBody(SOAPEnvelope envelope) throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPBody createSOAPBody(SOAPEnvelope envelope,
+ OMXMLParserWrapper builder) {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFaultCode createSOAPFaultCode(SOAPFault parent) throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFaultCode createSOAPFaultCode(SOAPFault parent,
+ OMXMLParserWrapper builder) {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent) throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent,
+ OMXMLParserWrapper builder) {
+ throw new UnsupportedOperationException();
+ }
+
+ //added
+ public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent) throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
+ //added
+ public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent,
+ OMXMLParserWrapper builder) {
+ throw new UnsupportedOperationException();
+ }
+
+ //changed
+ public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent) throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
+ //changed
+ public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent,
+ OMXMLParserWrapper builder) {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent) throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent,
+ OMXMLParserWrapper builder) {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFaultReason createSOAPFaultReason(SOAPFault parent) throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFaultReason createSOAPFaultReason(SOAPFault parent,
+ OMXMLParserWrapper builder) {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent) throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent,
+ OMXMLParserWrapper builder) {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFaultNode createSOAPFaultNode(SOAPFault parent) throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFaultNode createSOAPFaultNode(SOAPFault parent,
+ OMXMLParserWrapper builder) {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFaultRole createSOAPFaultRole(SOAPFault parent) throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFaultRole createSOAPFaultRole(SOAPFault parent,
+ OMXMLParserWrapper builder) {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent) throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent,
+ OMXMLParserWrapper builder) {
+ throw new UnsupportedOperationException();
+ }
+
+
+ /**
+ * Method getDefaultEnvelope
+ *
+ * @return Returns SOAPEnvelope.
+ */
+ public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException {
+ throw new UnsupportedOperationException();
+ }
+
+ public SOAPEnvelope getDefaultFaultEnvelope() throws SOAPProcessingException {
+ SOAPEnvelope defaultEnvelope = getDefaultEnvelope();
+ SOAPFault fault = createSOAPFault(defaultEnvelope.getBody());
+
+ SOAPFaultCode faultCode = createSOAPFaultCode(fault);
+ SOAPFaultValue value = createSOAPFaultValue(faultCode);
+
+ SOAPFaultReason reason = createSOAPFaultReason(fault);
+ SOAPFaultText faultText = createSOAPFaultText(reason);
+
+ SOAPFaultNode faultNode = createSOAPFaultNode(fault);
+ SOAPFaultRole faultRole = createSOAPFaultRole(fault);
+ SOAPFaultDetail faultDetail = createSOAPFaultDetail(fault);
+
+ return defaultEnvelope;
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11BodyImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11BodyImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11BodyImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11BodyImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,47 @@
+/*
+ * 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.ws.commons.soap.impl.llom.soap11;
+
+import org.apache.ws.commons.om.OMException;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAPEnvelope;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPBodyImpl;
+
+public class SOAP11BodyImpl extends SOAPBodyImpl {
+ /**
+ * @param envelope
+ */
+ public SOAP11BodyImpl(SOAPEnvelope envelope) throws SOAPProcessingException {
+ super(envelope);
+ }
+
+ /**
+ * Constructor SOAPBodyImpl
+ *
+ * @param envelope
+ * @param builder
+ */
+ public SOAP11BodyImpl(SOAPEnvelope envelope, OMXMLParserWrapper builder) {
+ super(envelope, builder);
+ }
+
+ public SOAPFault addFault(Exception e) throws OMException {
+ return new SOAP11Factory().createSOAPFault(this, e);
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11Factory.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11Factory.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11Factory.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11Factory.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,207 @@
+/*
+ * 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.ws.commons.soap.impl.llom.soap11;
+
+import org.apache.ws.commons.om.OMNamespace;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.om.impl.llom.OMNamespaceImpl;
+import org.apache.ws.commons.soap.SOAP11Constants;
+import org.apache.ws.commons.soap.SOAPBody;
+import org.apache.ws.commons.soap.SOAPEnvelope;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPFaultCode;
+import org.apache.ws.commons.soap.SOAPFaultDetail;
+import org.apache.ws.commons.soap.SOAPFaultNode;
+import org.apache.ws.commons.soap.SOAPFaultReason;
+import org.apache.ws.commons.soap.SOAPFaultRole;
+import org.apache.ws.commons.soap.SOAPFaultSubCode;
+import org.apache.ws.commons.soap.SOAPFaultText;
+import org.apache.ws.commons.soap.SOAPFaultValue;
+import org.apache.ws.commons.soap.SOAPHeader;
+import org.apache.ws.commons.soap.SOAPHeaderBlock;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPEnvelopeImpl;
+import org.apache.ws.commons.soap.impl.llom.factory.SOAPLinkedListImplFactory;
+
+public class SOAP11Factory extends SOAPLinkedListImplFactory {
+ /**
+ * Eran Chinthaka (chinthaka@apache.org)
+ */
+
+ public String getSoapVersionURI() {
+ return SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+ }
+
+ public SOAPEnvelope createSOAPEnvelope() {
+ return new SOAPEnvelopeImpl(
+ new OMNamespaceImpl(
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+ SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX),
+ this);
+ }
+
+ public SOAPHeader createSOAPHeader(SOAPEnvelope envelope) throws SOAPProcessingException {
+ return new SOAP11HeaderImpl(envelope);
+ }
+
+ public SOAPHeader createSOAPHeader(SOAPEnvelope envelope,
+ OMXMLParserWrapper builder) {
+ return new SOAP11HeaderImpl(envelope, builder);
+ }
+
+ public SOAPHeaderBlock createSOAPHeaderBlock(String localName,
+ OMNamespace ns,
+ SOAPHeader parent) throws SOAPProcessingException {
+ return new SOAP11HeaderBlockImpl(localName, ns, parent);
+ }
+
+ public SOAPHeaderBlock createSOAPHeaderBlock(String localName,
+ OMNamespace ns,
+ SOAPHeader parent,
+ OMXMLParserWrapper builder) throws SOAPProcessingException {
+ return new SOAP11HeaderBlockImpl(localName, ns, parent, builder);
+ }
+
+ public SOAPFault createSOAPFault(SOAPBody parent, Exception e) throws SOAPProcessingException {
+ return new SOAP11FaultImpl(parent, e);
+ }
+
+ public SOAPFault createSOAPFault(SOAPBody parent) throws SOAPProcessingException {
+ return new SOAP11FaultImpl(parent);
+ }
+
+ public SOAPFault createSOAPFault(SOAPBody parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP11FaultImpl(parent, builder);
+ }
+
+ public SOAPBody createSOAPBody(SOAPEnvelope envelope) throws SOAPProcessingException {
+ return new SOAP11BodyImpl(envelope);
+ }
+
+ public SOAPBody createSOAPBody(SOAPEnvelope envelope,
+ OMXMLParserWrapper builder) {
+ return new SOAP11BodyImpl(envelope, builder);
+ }
+
+ public SOAPFaultCode createSOAPFaultCode(SOAPFault parent) throws SOAPProcessingException {
+ return new SOAP11FaultCodeImpl(parent);
+ }
+
+ public SOAPFaultCode createSOAPFaultCode(SOAPFault parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP11FaultCodeImpl(parent, builder);
+ }
+
+ public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent) throws SOAPProcessingException {
+ return new SOAP11FaultValueImpl(parent);
+ }
+
+ public SOAPFaultValue createSOAPFaultValue(SOAPFaultCode parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP11FaultValueImpl(parent, builder);
+ }
+
+ //added
+ public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent) throws SOAPProcessingException {
+ return new SOAP11FaultValueImpl(parent);
+ }
+
+ //added
+ public SOAPFaultValue createSOAPFaultValue(SOAPFaultSubCode parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP11FaultValueImpl(parent, builder);
+ }
+
+ //changed
+ public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent) throws SOAPProcessingException {
+ return new SOAP11FaultSubCodeImpl(parent);
+ }
+
+ //changed
+ public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultCode parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP11FaultSubCodeImpl(parent, builder);
+ }
+
+ public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent) throws SOAPProcessingException {
+ return new SOAP11FaultSubCodeImpl(parent);
+ }
+
+ public SOAPFaultSubCode createSOAPFaultSubCode(SOAPFaultSubCode parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP11FaultSubCodeImpl(parent, builder);
+ }
+
+ public SOAPFaultReason createSOAPFaultReason(SOAPFault parent) throws SOAPProcessingException {
+ return new SOAP11FaultReasonImpl(parent);
+ }
+
+ public SOAPFaultReason createSOAPFaultReason(SOAPFault parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP11FaultReasonImpl(parent, builder);
+ }
+
+ public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent) throws SOAPProcessingException {
+ return new SOAP11FaultTextImpl(parent);
+ }
+
+ public SOAPFaultText createSOAPFaultText(SOAPFaultReason parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP11FaultTextImpl(parent, builder);
+ }
+
+ public SOAPFaultNode createSOAPFaultNode(SOAPFault parent) throws SOAPProcessingException {
+ return new SOAP11FaultNodeImpl(parent);
+ }
+
+ public SOAPFaultNode createSOAPFaultNode(SOAPFault parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP11FaultNodeImpl(parent, builder);
+ }
+
+ public SOAPFaultRole createSOAPFaultRole(SOAPFault parent) throws SOAPProcessingException {
+ return new SOAP11FaultRoleImpl(parent);
+ }
+
+ public SOAPFaultRole createSOAPFaultRole(SOAPFault parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP11FaultRoleImpl(parent, builder);
+ }
+
+ public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent) throws SOAPProcessingException {
+ return new SOAP11FaultDetailImpl(parent);
+ }
+
+ public SOAPFaultDetail createSOAPFaultDetail(SOAPFault parent,
+ OMXMLParserWrapper builder) {
+ return new SOAP11FaultDetailImpl(parent, builder);
+ }
+
+ public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException {
+ OMNamespace ns =
+ new OMNamespaceImpl(
+ SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
+ SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);
+ SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this);
+ createSOAPHeader(env);
+ createSOAPBody(env);
+ return env;
+ }
+
+
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultCodeImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,109 @@
+/*
+ * 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.ws.commons.soap.impl.llom.soap11;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.om.impl.llom.OMSerializerUtil;
+import org.apache.ws.commons.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.ws.commons.soap.SOAP11Constants;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPFaultSubCode;
+import org.apache.ws.commons.soap.SOAPFaultValue;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultCodeImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAP11FaultCodeImpl extends SOAPFaultCodeImpl {
+ /**
+ * Constructor OMElementImpl
+ *
+ * @param parent
+ * @param builder
+ */
+ public SOAP11FaultCodeImpl(SOAPFault parent, OMXMLParserWrapper builder) {
+ super(parent, builder);
+ }
+
+ /**
+ * @param parent
+ */
+ public SOAP11FaultCodeImpl(SOAPFault parent) throws SOAPProcessingException {
+ super(parent, false);
+ }
+
+
+ public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException {
+ if (!(subCode instanceof SOAP11FaultSubCodeImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP Fault Sub Code. But received some other implementation");
+ }
+ super.setSubCode(subCode);
+ }
+
+ public void setValue(SOAPFaultValue value) throws SOAPProcessingException {
+ if (!(value instanceof SOAP11FaultValueImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP Fault Value. But received some other implementation");
+ }
+ super.setValue(value);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP11FaultImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP Fault as the parent. But received some other implementation");
+ }
+ }
+
+ protected void serialize(org.apache.ws.commons.om.impl.OMOutputImpl omOutput, boolean cache) throws XMLStreamException {
+
+ // select the builder
+ short builderType = PULL_TYPE_BUILDER; // default is pull type
+ if (builder != null) {
+ builderType = this.builder.getBuilderType();
+ }
+ if ((builderType == PUSH_TYPE_BUILDER)
+ && (builder.getRegisteredContentHandler() == null)) {
+ builder.registerExternalContentHandler(
+ new StreamWriterToContentHandlerConverter(omOutput));
+ }
+
+ XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+ if (this.getNamespace() != null) {
+ String prefix = this.getNamespace().getPrefix();
+ String nameSpaceName = this.getNamespace().getName();
+ writer.writeStartElement(prefix, SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME,
+ nameSpaceName);
+ } else {
+ writer.writeStartElement(
+ SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME);
+ }
+
+ OMSerializerUtil.serializeAttributes(this, omOutput);
+ OMSerializerUtil.serializeNamespaces(this, omOutput);
+
+
+ String text = this.getValue().getText();
+ writer.writeCharacters(text);
+ writer.writeEndElement();
+ }
+
+
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultDetailImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultDetailImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultDetailImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultDetailImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,85 @@
+/*
+ * 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.ws.commons.soap.impl.llom.soap11;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.om.impl.OMNodeEx;
+import org.apache.ws.commons.om.impl.llom.OMSerializerUtil;
+import org.apache.ws.commons.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.ws.commons.soap.SOAP11Constants;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultDetailImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAP11FaultDetailImpl extends SOAPFaultDetailImpl {
+ public SOAP11FaultDetailImpl(SOAPFault parent) throws SOAPProcessingException {
+ super(parent, false);
+ }
+
+ public SOAP11FaultDetailImpl(SOAPFault parent, OMXMLParserWrapper builder) {
+ super(parent, builder);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP11FaultImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP Fault as the parent. But received some other implementation");
+ }
+ }
+
+ public void serialize(org.apache.ws.commons.om.impl.OMOutputImpl omOutput, boolean cache) throws XMLStreamException {
+
+ // select the builder
+ short builderType = PULL_TYPE_BUILDER; // default is pull type
+ if (builder != null) {
+ builderType = this.builder.getBuilderType();
+ }
+ if ((builderType == PUSH_TYPE_BUILDER)
+ && (builder.getRegisteredContentHandler() == null)) {
+ builder.registerExternalContentHandler(
+ new StreamWriterToContentHandlerConverter(omOutput));
+ }
+ XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+ if (this.getNamespace() != null) {
+ String prefix = this.getNamespace().getPrefix();
+ String nameSpaceName = this.getNamespace().getName();
+ writer.writeStartElement(prefix, SOAP11Constants.SOAP_FAULT_DETAIL_LOCAL_NAME,
+ nameSpaceName);
+ } else {
+ writer.writeStartElement(
+ SOAP11Constants.SOAP_FAULT_DETAIL_LOCAL_NAME);
+ }
+ OMSerializerUtil.serializeAttributes(this, omOutput);
+ OMSerializerUtil.serializeNamespaces(this, omOutput);
+
+
+ String text = this.getText();
+ writer.writeCharacters(text);
+
+
+ if (firstChild != null) {
+ ((OMNodeEx)firstChild).serializeAndConsume(omOutput);
+ }
+ writer.writeEndElement();
+ }
+
+
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,120 @@
+/*
+ * 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.ws.commons.soap.impl.llom.soap11;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAPBody;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPFaultCode;
+import org.apache.ws.commons.soap.SOAPFaultDetail;
+import org.apache.ws.commons.soap.SOAPFaultNode;
+import org.apache.ws.commons.soap.SOAPFaultReason;
+import org.apache.ws.commons.soap.SOAPFaultRole;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultImpl;
+
+import javax.xml.stream.XMLStreamException;
+
+
+public class SOAP11FaultImpl extends SOAPFaultImpl {
+ /**
+ * Eran Chinthaka (chinthaka@apache.org)
+ */
+
+ public SOAP11FaultImpl(SOAPBody parent, Exception e) throws SOAPProcessingException {
+ super(parent, e);
+ }
+
+ public SOAP11FaultImpl(SOAPBody parent, OMXMLParserWrapper builder) {
+ super(parent, builder);
+ }
+
+ /**
+ * This is a convenience method for the SOAP Fault Impl.
+ *
+ * @param parent
+ */
+ public SOAP11FaultImpl(SOAPBody parent) throws SOAPProcessingException {
+ super(parent);
+
+ }
+
+ protected SOAPFaultDetail getNewSOAPFaultDetail(SOAPFault fault) throws SOAPProcessingException {
+ return new SOAP11FaultDetailImpl(fault);
+ }
+
+ public void serialize(org.apache.ws.commons.om.impl.OMOutputImpl omOutput) throws XMLStreamException {
+ super.serialize(omOutput);
+ }
+
+ public void serializeAndConsume(org.apache.ws.commons.om.impl.OMOutputImpl omOutput) throws XMLStreamException {
+ super.serializeAndConsume(omOutput);
+ }
+
+ public void setCode(SOAPFaultCode soapFaultCode) throws SOAPProcessingException {
+ if (!(soapFaultCode instanceof SOAP11FaultCodeImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP Fault Code. But received some other implementation");
+ }
+ super.setCode(soapFaultCode);
+ }
+
+ public void setReason(SOAPFaultReason reason) throws SOAPProcessingException {
+ if (!(reason instanceof SOAP11FaultReasonImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP Fault Reason. But received some other implementation");
+ }
+ super.setReason(reason);
+ }
+
+ public void setNode(SOAPFaultNode node) throws SOAPProcessingException {
+ if (!(node instanceof SOAP11FaultNodeImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP Fault Node. But received some other implementation");
+ }
+ super.setNode(node);
+ }
+
+ public void setRole(SOAPFaultRole role) throws SOAPProcessingException {
+ if (!(role instanceof SOAP11FaultRoleImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP Fault Role. But received some other implementation");
+ }
+ super.setRole(role);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP11BodyImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP Body as the parent. But received some other implementation");
+ }
+ }
+
+ public void setDetail(SOAPFaultDetail detail) throws SOAPProcessingException {
+ if (!(detail instanceof SOAP11FaultDetailImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP Fault Detail. But received some other implementation");
+ }
+ super.setDetail(detail);
+ }
+
+ protected void serializeFaultNode(org.apache.ws.commons.om.impl.OMOutputImpl omOutput) throws XMLStreamException {
+
+ }
+
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultNodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultNodeImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultNodeImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultNodeImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,42 @@
+/*
+ * 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.ws.commons.soap.impl.llom.soap11;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultNodeImpl;
+
+
+public class SOAP11FaultNodeImpl extends SOAPFaultNodeImpl {
+
+ public SOAP11FaultNodeImpl(SOAPFault parent) throws SOAPProcessingException {
+ super(parent);
+ }
+
+ public SOAP11FaultNodeImpl(SOAPFault parent, OMXMLParserWrapper builder) {
+ super(parent, builder);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP11FaultImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP Fault as the parent. But received some other implementation");
+ }
+ }
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultReasonImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultReasonImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultReasonImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultReasonImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,96 @@
+/*
+ * 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.ws.commons.soap.impl.llom.soap11;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.om.impl.OMOutputImpl;
+import org.apache.ws.commons.om.impl.llom.OMSerializerUtil;
+import org.apache.ws.commons.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.ws.commons.soap.SOAP11Constants;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPFaultText;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultReasonImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAP11FaultReasonImpl extends SOAPFaultReasonImpl {
+ /**
+ * Eran Chinthaka (chinthaka@apache.org)
+ */
+
+ public SOAP11FaultReasonImpl(SOAPFault parent, OMXMLParserWrapper builder) {
+ super(parent, builder);
+ }
+
+ /**
+ * @param parent
+ */
+ public SOAP11FaultReasonImpl(SOAPFault parent) throws SOAPProcessingException {
+ super(parent, false);
+ }
+
+ public void setSOAPText(SOAPFaultText soapFaultText) throws SOAPProcessingException {
+ if (!(soapFaultText instanceof SOAP11FaultTextImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP Fault Text. But received some other implementation");
+ }
+ super.setSOAPText(soapFaultText);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP11FaultImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP Fault as the parent. But received some other implementation");
+ }
+ }
+
+ protected void serialize(OMOutputImpl omOutput, boolean cache) throws XMLStreamException {
+
+ // select the builder
+ short builderType = PULL_TYPE_BUILDER; // default is pull type
+ if (builder != null) {
+ builderType = this.builder.getBuilderType();
+ }
+ if ((builderType == PUSH_TYPE_BUILDER)
+ && (builder.getRegisteredContentHandler() == null)) {
+ builder.registerExternalContentHandler(
+ new StreamWriterToContentHandlerConverter(omOutput));
+ }
+
+ XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+ if (this.getNamespace() != null) {
+ String prefix = this.getNamespace().getPrefix();
+ String nameSpaceName = this.getNamespace().getName();
+ writer.writeStartElement(prefix, SOAP11Constants.SOAP_FAULT_STRING_LOCAL_NAME,
+ nameSpaceName);
+ } else {
+ writer.writeStartElement(
+ SOAP11Constants.SOAP_FAULT_STRING_LOCAL_NAME);
+ }
+ OMSerializerUtil.serializeAttributes(this, omOutput);
+ OMSerializerUtil.serializeNamespaces(this, omOutput);
+
+ String text = this.getSOAPText().getText();
+ writer.writeCharacters(text);
+ writer.writeEndElement();
+ }
+
+
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultRoleImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultRoleImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultRoleImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultRoleImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,79 @@
+/*
+ * 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.ws.commons.soap.impl.llom.soap11;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.om.impl.llom.OMSerializerUtil;
+import org.apache.ws.commons.om.impl.llom.serialize.StreamWriterToContentHandlerConverter;
+import org.apache.ws.commons.soap.SOAP11Constants;
+import org.apache.ws.commons.soap.SOAPFault;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultRoleImpl;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+public class SOAP11FaultRoleImpl extends SOAPFaultRoleImpl {
+ public SOAP11FaultRoleImpl(SOAPFault parent) throws SOAPProcessingException {
+ super(parent, false);
+ }
+
+ public SOAP11FaultRoleImpl(SOAPFault parent, OMXMLParserWrapper builder) {
+ super(parent, builder);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP11FaultImpl)) {
+ throw new SOAPProcessingException(
+ "Expecting SOAP 1.1 implementation of SOAP Fault as the parent. But received some other implementation");
+ }
+ }
+
+ protected void serialize(org.apache.ws.commons.om.impl.OMOutputImpl omOutput, boolean cache) throws XMLStreamException {
+
+ // select the builder
+ short builderType = PULL_TYPE_BUILDER; // default is pull type
+ if (builder != null) {
+ builderType = this.builder.getBuilderType();
+ }
+ if ((builderType == PUSH_TYPE_BUILDER)
+ && (builder.getRegisteredContentHandler() == null)) {
+ builder.registerExternalContentHandler(
+ new StreamWriterToContentHandlerConverter(omOutput));
+ }
+
+ XMLStreamWriter writer = omOutput.getXmlStreamWriter();
+ if (this.getNamespace() != null) {
+ String prefix = this.getNamespace().getPrefix();
+ String nameSpaceName = this.getNamespace().getName();
+ writer.writeStartElement(prefix, SOAP11Constants.SOAP_FAULT_ACTOR_LOCAL_NAME,
+ nameSpaceName);
+ } else {
+ writer.writeStartElement(
+ SOAP11Constants.SOAP_FAULT_ACTOR_LOCAL_NAME);
+ }
+ OMSerializerUtil.serializeAttributes(this, omOutput);
+ OMSerializerUtil.serializeNamespaces(this, omOutput);
+
+ String text = this.getText();
+ writer.writeCharacters(text);
+ writer.writeEndElement();
+ }
+
+
+}
Added: webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java?rev=374036&view=auto
==============================================================================
--- webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java (added)
+++ webservices/commons/trunk/axiom/src/org/apache/ws/commons/soap/impl/llom/soap11/SOAP11FaultSubCodeImpl.java Wed Feb 1 02:33:37 2006
@@ -0,0 +1,71 @@
+/*
+ * 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.ws.commons.soap.impl.llom.soap11;
+
+import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMXMLParserWrapper;
+import org.apache.ws.commons.soap.SOAP12Constants;
+import org.apache.ws.commons.soap.SOAPFaultCode;
+import org.apache.ws.commons.soap.SOAPFaultSubCode;
+import org.apache.ws.commons.soap.SOAPFaultValue;
+import org.apache.ws.commons.soap.SOAPProcessingException;
+import org.apache.ws.commons.soap.impl.llom.SOAPFaultSubCodeImpl;
+
+public class SOAP11FaultSubCodeImpl extends SOAPFaultSubCodeImpl {
+ //changed
+ public SOAP11FaultSubCodeImpl(SOAPFaultCode parent) throws SOAPProcessingException {
+ super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
+ }
+
+ //changed
+ public SOAP11FaultSubCodeImpl(SOAPFaultCode parent,
+ OMXMLParserWrapper builder) {
+ super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder);
+ }
+
+ public SOAP11FaultSubCodeImpl(SOAPFaultSubCode parent) throws SOAPProcessingException {
+ super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME);
+ }
+
+ public SOAP11FaultSubCodeImpl(SOAPFaultSubCode parent,
+ OMXMLParserWrapper builder) {
+ super(parent, SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME, builder);
+ }
+
+ protected void checkParent(OMElement parent) throws SOAPProcessingException {
+ if (!(parent instanceof SOAP11FaultSubCodeImpl) ||
+ (parent instanceof SOAP11FaultCodeImpl)) {
+ throw new SOAPProcessingException("Expecting SOAP 1.1 implementation of SOAP FaultSubCode or SOAP FaultCode as the parent. But received some other implementation");
+ }
+ }
+
+ public void setSubCode(SOAPFaultSubCode subCode) throws SOAPProcessingException {
+ if (!((parent instanceof SOAP11FaultSubCodeImpl) || (parent instanceof SOAP11FaultCodeImpl))) {
+ throw new SOAPProcessingException("Expecting SOAP 1.1 implementation of SOAP Fault Sub Code. But received some other implementation");
+ }
+ super.setSubCode(subCode);
+ }
+
+ public void setValue(SOAPFaultValue soapFaultSubCodeValue) throws SOAPProcessingException {
+ if (!(soapFaultSubCodeValue instanceof SOAP11FaultValueImpl)) {
+ throw new SOAPProcessingException("Expecting SOAP 1.1 implementation of SOAP Fault Value. But received some other implementation");
+ }
+ super.setValue(soapFaultSubCodeValue);
+ }
+
+
+}