src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java

Print this page
rev 472 : 8036030: Update JAX-WS RI integration to latest version
   1 /*
   2  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  25 
  26 package com.sun.xml.internal.ws.api.message.saaj;
  27 
  28 import java.util.Arrays;
  29 import java.util.Iterator;
  30 
  31 import javax.xml.namespace.NamespaceContext;
  32 import javax.xml.namespace.QName;
  33 import javax.xml.soap.SOAPElement;
  34 import javax.xml.soap.SOAPException;
  35 import javax.xml.soap.SOAPMessage;
  36 import javax.xml.stream.XMLStreamException;
  37 import javax.xml.stream.XMLStreamWriter;
  38 
  39 import org.w3c.dom.Comment;
  40 import org.w3c.dom.Node;
  41 
  42 /**
  43  * SaajStaxWriter builds a SAAJ SOAPMessage by using XMLStreamWriter interface.
  44  *


  45  * @author shih-chang.chen@oracle.com
  46  */
  47 public class SaajStaxWriter implements XMLStreamWriter {
  48 
  49     protected SOAPMessage soap;
  50     protected String envURI;
  51     protected SOAPElement currentElement;
  52 
  53     static final protected String Envelope = "Envelope";
  54     static final protected String Header = "Header";
  55     static final protected String Body = "Body";
  56     static final protected String xmlns = "xmlns";
  57 
  58     public SaajStaxWriter(final SOAPMessage msg) throws SOAPException {
  59         soap = msg;
  60         currentElement = soap.getSOAPPart().getEnvelope();
  61         envURI = currentElement.getNamespaceURI();
  62     }
  63 
  64     public SOAPMessage getSOAPMessage() {


   1 /*
   2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  25 
  26 package com.sun.xml.internal.ws.api.message.saaj;
  27 
  28 import java.util.Arrays;
  29 import java.util.Iterator;
  30 
  31 import javax.xml.namespace.NamespaceContext;
  32 import javax.xml.namespace.QName;
  33 import javax.xml.soap.SOAPElement;
  34 import javax.xml.soap.SOAPException;
  35 import javax.xml.soap.SOAPMessage;
  36 import javax.xml.stream.XMLStreamException;
  37 import javax.xml.stream.XMLStreamWriter;
  38 
  39 import org.w3c.dom.Comment;
  40 import org.w3c.dom.Node;
  41 
  42 /**
  43  * SaajStaxWriter builds a SAAJ SOAPMessage by using XMLStreamWriter interface.
  44  *
  45  * @deprecated use com.sun.xml.internal.org.jvnet.staxex.util.SaajStaxWriter
  46  *
  47  * @author shih-chang.chen@oracle.com
  48  */
  49 public class SaajStaxWriter implements XMLStreamWriter {
  50 
  51     protected SOAPMessage soap;
  52     protected String envURI;
  53     protected SOAPElement currentElement;
  54 
  55     static final protected String Envelope = "Envelope";
  56     static final protected String Header = "Header";
  57     static final protected String Body = "Body";
  58     static final protected String xmlns = "xmlns";
  59 
  60     public SaajStaxWriter(final SOAPMessage msg) throws SOAPException {
  61         soap = msg;
  62         currentElement = soap.getSOAPPart().getEnvelope();
  63         envURI = currentElement.getNamespaceURI();
  64     }
  65 
  66     public SOAPMessage getSOAPMessage() {