Save This Page
Home » openjdk-7 » com.sun.xml.internal.messaging » saaj » soap » ver1_2 » [javadoc | source]
    1   /*
    2    * $Id: SOAPPart1_2Impl.java,v 1.1.1.1 2006/01/27 13:10:57 kumarjayanti Exp $
    3    */
    4   
    5   /*
    6    * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
    7    * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    8    *
    9    * This code is free software; you can redistribute it and/or modify it
   10    * under the terms of the GNU General Public License version 2 only, as
   11    * published by the Free Software Foundation.  Sun designates this
   12    * particular file as subject to the "Classpath" exception as provided
   13    * by Sun in the LICENSE file that accompanied this code.
   14    *
   15    * This code is distributed in the hope that it will be useful, but WITHOUT
   16    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   17    * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   18    * version 2 for more details (a copy is included in the LICENSE file that
   19    * accompanied this code).
   20    *
   21    * You should have received a copy of the GNU General Public License version
   22    * 2 along with this work; if not, write to the Free Software Foundation,
   23    * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   24    *
   25    * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   26    * CA 95054 USA or visit www.sun.com if you need additional information or
   27    * have any questions.
   28    */
   29   
   30   /**
   31   *
   32   * @author SAAJ RI Development Team
   33   */
   34   package com.sun.xml.internal.messaging.saaj.soap.ver1_2;
   35   
   36   import java.util.logging.Level;
   37   import java.util.logging.Logger;
   38   
   39   import javax.xml.soap.SOAPConstants;
   40   import javax.xml.soap.SOAPException;
   41   import javax.xml.transform.Source;
   42   
   43   import com.sun.xml.internal.messaging.saaj.soap;
   44   import com.sun.xml.internal.messaging.saaj.soap.impl.EnvelopeImpl;
   45   import com.sun.xml.internal.messaging.saaj.util.XMLDeclarationParser;
   46   
   47   public class SOAPPart1_2Impl extends SOAPPartImpl implements SOAPConstants{
   48   
   49       protected static Logger log =
   50           Logger.getLogger(SOAPPart1_2Impl.class.getName(),
   51                            "com.sun.xml.internal.messaging.saaj.soap.ver1_2.LocalStrings");
   52   
   53       public SOAPPart1_2Impl() {
   54           super();
   55       }
   56   
   57       public SOAPPart1_2Impl(MessageImpl message) {
   58           super(message);
   59       }
   60   
   61       protected String getContentType() {
   62           return "application/soap+xml";
   63       }
   64   
   65       protected Envelope createEmptyEnvelope(String prefix) throws SOAPException {
   66           return new Envelope1_2Impl(getDocument(), prefix, true, true);
   67       }
   68   
   69       protected Envelope createEnvelopeFromSource() throws SOAPException {
   70           XMLDeclarationParser parser = lookForXmlDecl();
   71           Source tmp = source;
   72           source = null;
   73           EnvelopeImpl envelope = (EnvelopeImpl)EnvelopeFactory.createEnvelope(tmp, this);
   74           if (!envelope.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE)) {
   75               log.severe("SAAJ0415.ver1_2.msg.invalid.soap1.2");
   76               throw new SOAPException("InputStream does not represent a valid SOAP 1.2 Message");
   77           }
   78   
   79           if (!omitXmlDecl) {
   80               envelope.setOmitXmlDecl("no");
   81               envelope.setXmlDecl(parser.getXmlDeclaration());
   82               envelope.setCharsetEncoding(parser.getEncoding());
   83           }
   84           return envelope;
   85   
   86       }
   87   
   88       protected SOAPPartImpl duplicateType() {
   89           return new SOAPPart1_2Impl();
   90       }
   91   
   92   }

Save This Page
Home » openjdk-7 » com.sun.xml.internal.messaging » saaj » soap » ver1_2 » [javadoc | source]