001: /*
002: * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003: *
004: * This file is part of Resin(R) Open Source
005: *
006: * Each copy or derived work must preserve the copyright notice and this
007: * notice unmodified.
008: *
009: * Resin Open Source is free software; you can redistribute it and/or modify
010: * it under the terms of the GNU General Public License as published by
011: * the Free Software Foundation; either version 2 of the License, or
012: * (at your option) any later version.
013: *
014: * Resin Open Source is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017: * of NON-INFRINGEMENT. See the GNU General Public License for more
018: * details.
019: *
020: * You should have received a copy of the GNU General Public License
021: * along with Resin Open Source; if not, write to the
022: *
023: * Free Software Foundation, Inc.
024: * 59 Temple Place, Suite 330
025: * Boston, MA 02111-1307 USA
026: *
027: * @author Emil Ong
028: */
029:
030: package com.caucho.xml.saaj;
031:
032: import javax.xml.XMLConstants;
033: import javax.xml.namespace.*;
034: import javax.xml.soap.*;
035:
036: import com.caucho.xml.QNode;
037:
038: public class SOAP12EnvelopeImpl extends SOAPEnvelopeImpl {
039: static final NameImpl ENCODING_STYLE_NAME = new NameImpl(
040: SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, "encodingStyle",
041: SOAPConstants.SOAP_ENV_PREFIX);
042:
043: SOAP12EnvelopeImpl(SOAPFactory factory) throws SOAPException {
044: super (factory, SOAP_1_2_ENVELOPE_NAME);
045: }
046:
047: protected Name getBodyName() {
048: return SOAP_1_2_BODY_NAME;
049: }
050:
051: protected Name getHeaderName() {
052: return SOAP_1_2_HEADER_NAME;
053: }
054:
055: public String getEncodingStyle() {
056: // optimization
057: return null;
058: }
059:
060: public void setEncodingStyle(String encodingStyle)
061: throws SOAPException {
062: throw new SOAPException(
063: "encodingStyle illegal for this element");
064: }
065:
066: public SOAPElement addAttribute(Name name, String value)
067: throws SOAPException {
068: if (name.equals(ENCODING_STYLE_NAME))
069: throw new SOAPException(
070: "encodingStyle illegal for this element");
071:
072: return super .addAttribute(name, value);
073: }
074:
075: public SOAPElement addAttribute(QName qname, String value)
076: throws SOAPException {
077: if (qname.equals(ENCODING_STYLE_NAME))
078: throw new SOAPException(
079: "encodingStyle illegal for this element");
080:
081: return super .addAttribute(qname, value);
082: }
083:
084: public SOAPElement addChildElement(Name name) throws SOAPException {
085: if (_body != null)
086: throw new SOAPException(
087: "SOAP 1.2 does not allow elements after the body");
088:
089: return super .addChildElement(name);
090: }
091:
092: public SOAPElement addChildElement(QName qname)
093: throws SOAPException {
094: if (_body != null)
095: throw new SOAPException(
096: "SOAP 1.2 does not allow elements after the body");
097:
098: return super .addChildElement(qname);
099: }
100:
101: public SOAPElement addChildElement(SOAPElement element)
102: throws SOAPException {
103: if (_body != null)
104: throw new SOAPException(
105: "SOAP 1.2 does not allow elements after the body");
106:
107: return super .addChildElement(element);
108: }
109:
110: public SOAPElement addChildElement(String localName)
111: throws SOAPException {
112: if (_body != null)
113: throw new SOAPException(
114: "SOAP 1.2 does not allow elements after the body");
115:
116: return super .addChildElement(localName);
117: }
118:
119: public SOAPElement addChildElement(String localName, String prefix)
120: throws SOAPException {
121: if (_body != null)
122: throw new SOAPException(
123: "SOAP 1.2 does not allow elements after the body");
124:
125: return super .addChildElement(localName, prefix);
126: }
127:
128: public SOAPElement addChildElement(String localName, String prefix,
129: String uri) throws SOAPException {
130: if (_body != null)
131: throw new SOAPException(
132: "SOAP 1.2 does not allow elements after the body");
133:
134: return super.addChildElement(localName, prefix, uri);
135: }
136: }
|