1 /* |
1 /* |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
125 public SOAPElement addChildElement(QName qname) throws SOAPException { |
125 public SOAPElement addChildElement(QName qname) throws SOAPException { |
126 return addElement(qname); |
126 return addElement(qname); |
127 } |
127 } |
128 |
128 |
129 public SOAPElement addChildElement(String localName) throws SOAPException { |
129 public SOAPElement addChildElement(String localName) throws SOAPException { |
130 return (SOAPElement) addChildElement( |
130 String nsUri = getNamespaceURI(""); |
131 NameImpl.createFromUnqualifiedName(localName)); |
131 Name name = (nsUri == null || nsUri.isEmpty()) |
|
132 ? NameImpl.createFromUnqualifiedName(localName) |
|
133 : NameImpl.createFromQualifiedName(localName, nsUri); |
|
134 return addChildElement(name); |
132 } |
135 } |
133 |
136 |
134 public SOAPElement addChildElement(String localName, String prefix) |
137 public SOAPElement addChildElement(String localName, String prefix) |
135 throws SOAPException { |
138 throws SOAPException { |
136 String uri = getNamespaceURI(prefix); |
139 String uri = getNamespaceURI(prefix); |
370 } |
373 } |
371 |
374 |
372 protected SOAPElement addElement(Name name) throws SOAPException { |
375 protected SOAPElement addElement(Name name) throws SOAPException { |
373 SOAPElement newElement = createElement(name); |
376 SOAPElement newElement = createElement(name); |
374 addNode(newElement); |
377 addNode(newElement); |
375 return circumventBug5034339(newElement); |
378 return newElement; |
376 } |
379 } |
377 |
380 |
378 protected SOAPElement addElement(QName name) throws SOAPException { |
381 protected SOAPElement addElement(QName name) throws SOAPException { |
379 SOAPElement newElement = createElement(name); |
382 SOAPElement newElement = createElement(name); |
380 addNode(newElement); |
383 addNode(newElement); |
381 return circumventBug5034339(newElement); |
384 return newElement; |
382 } |
385 } |
383 |
386 |
384 protected SOAPElement createElement(Name name) { |
387 protected SOAPElement createElement(Name name) { |
385 |
388 |
386 if (isNamespaceQualified(name)) { |
389 if (isNamespaceQualified(name)) { |
1199 |
1202 |
1200 protected boolean isNamespaceQualified(QName name) { |
1203 protected boolean isNamespaceQualified(QName name) { |
1201 return !"".equals(name.getNamespaceURI()); |
1204 return !"".equals(name.getNamespaceURI()); |
1202 } |
1205 } |
1203 |
1206 |
1204 protected SOAPElement circumventBug5034339(SOAPElement element) { |
|
1205 |
|
1206 Name elementName = element.getElementName(); |
|
1207 if (!isNamespaceQualified(elementName)) { |
|
1208 String prefix = elementName.getPrefix(); |
|
1209 String defaultNamespace = getNamespaceURI(prefix); |
|
1210 if (defaultNamespace != null) { |
|
1211 Name newElementName = |
|
1212 NameImpl.create( |
|
1213 elementName.getLocalName(), |
|
1214 elementName.getPrefix(), |
|
1215 defaultNamespace); |
|
1216 SOAPElement newElement = createElement(newElementName); |
|
1217 replaceChild(newElement, element); |
|
1218 return newElement; |
|
1219 } |
|
1220 } |
|
1221 return element; |
|
1222 } |
|
1223 |
|
1224 //TODO: This is a temporary SAAJ workaround for optimizing XWS |
1207 //TODO: This is a temporary SAAJ workaround for optimizing XWS |
1225 // should be removed once the corresponding JAXP bug is fixed |
1208 // should be removed once the corresponding JAXP bug is fixed |
1226 // It appears the bug will be fixed in JAXP 1.4 (not by Appserver 9 timeframe) |
1209 // It appears the bug will be fixed in JAXP 1.4 (not by Appserver 9 timeframe) |
1227 public void setAttributeNS( |
1210 public void setAttributeNS( |
1228 String namespaceURI,String qualifiedName, String value) { |
1211 String namespaceURI,String qualifiedName, String value) { |