You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/12/17 22:34:13 UTC
svn commit: r1818518 [21/30] - in /axis/axis2/java/core/branches/AXIS2-4091:
./ apidocs/ databinding-tests/ etc/ legal/ modules/adb-codegen/
modules/adb-codegen/src/org/apache/axis2/schema/
modules/adb-codegen/src/org/apache/axis2/schema/template/ modu...
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPElementImpl.java Sun Dec 17 22:34:08 2017
@@ -23,11 +23,8 @@ import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.impl.OMElementEx;
-import org.apache.axiom.soap.SOAP11Version;
-import org.apache.axiom.soap.SOAP12Version;
import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPVersion;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
import org.w3c.dom.Element;
@@ -53,7 +50,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
-public class SOAPElementImpl<T extends OMElement> extends SAAJNode<Element,T> implements SOAPElement {
+public class SOAPElementImpl<T extends OMElement> extends NodeImpl<Element,T> implements SOAPElement {
private String encodingStyle;
public SOAPElementImpl(T element) {
@@ -71,7 +68,7 @@ public class SOAPElementImpl<T extends O
*/
public SOAPElement addAttribute(Name name, String value) throws SOAPException {
if (name.getURI() == null || name.getURI().trim().length() == 0) {
- target.setAttribute(name.getLocalName(), value);
+ target.setAttributeNS("", name.getLocalName(), value);
} else {
target.setAttributeNS(name.getURI(), name.getPrefix() + ":" + name.getLocalName(),
value);
@@ -98,11 +95,11 @@ public class SOAPElementImpl<T extends O
SOAPElementImpl<OMElement> childEle;
if (namespaceURI == null || namespaceURI.trim().length() == 0) {
- childEle = new SOAPElementImpl<OMElement>((OMElement)getOwnerDocument().createElement(localName));
+ childEle = new SOAPElementImpl<OMElement>((OMElement)getOwnerDocument().createElementNS(null, localName));
} else {
omTarget.declareNamespace(namespaceURI, prefix);
childEle =
- new SOAPElementImpl<OMElement>((OMElement)getOwnerDocument().createElementNS(namespaceURI,
+ new SOAPElementImpl<OMElement>((OMElement)target.getOwnerDocument().createElementNS(namespaceURI,
localName));
}
@@ -120,12 +117,10 @@ public class SOAPElementImpl<T extends O
}
}
- childEle.target.setUserData(SAAJ_NODE, childEle, null);
if (namespaceURI != null && namespaceURI.trim().length() > 0) {
childEle.omTarget.setNamespace(childEle.omTarget.declareNamespace(namespaceURI, prefix));
}
target.appendChild(childEle.target);
- childEle.target.getParentNode().setUserData(SAAJ_NODE, this, null);
childEle.setParentElement(this);
return childEle;
}
@@ -138,16 +133,13 @@ public class SOAPElementImpl<T extends O
if (prefix == null) {
prefix = "";
}
- SOAPElementImpl<OMElement> childEle =
- new SOAPElementImpl<OMElement>((OMElement)getOwnerDocument().
- createElementNS(namespaceURI, prefix.length() == 0 ? localName : prefix + ":" + localName));
+ SOAPElementImpl<OMElement> childEle = (SOAPElementImpl<OMElement>)getOwnerDocument().
+ createElementNS(namespaceURI, prefix.length() == 0 ? localName : prefix + ":" + localName);
- childEle.target.setUserData(SAAJ_NODE, childEle, null);
childEle.omTarget.setNamespace(prefix.length() == 0
? childEle.omTarget.declareDefaultNamespace(namespaceURI)
: childEle.omTarget.declareNamespace(namespaceURI, prefix));
target.appendChild(childEle.target);
- childEle.target.getParentNode().setUserData(SAAJ_NODE, this, null);
childEle.setParentElement(this);
return childEle;
}
@@ -170,10 +162,8 @@ public class SOAPElementImpl<T extends O
*/
public SOAPElement addChildElement(String localName) throws SOAPException {
SOAPElementImpl<OMElement> childEle =
- new SOAPElementImpl<OMElement>((OMElement)getOwnerDocument().createElement(localName));
- childEle.target.setUserData(SAAJ_NODE, childEle, null);
+ (SOAPElementImpl<OMElement>)getOwnerDocument().createElementNS(null, localName);
target.appendChild(childEle.target);
- childEle.target.getParentNode().setUserData(SAAJ_NODE, this, null);
childEle.setParentElement(this);
return childEle;
}
@@ -182,6 +172,9 @@ public class SOAPElementImpl<T extends O
* @see javax.xml.soap.SOAPElement#addNamespaceDeclaration(java.lang.String, java.lang.String)
*/
public SOAPElement addNamespaceDeclaration(String prefix, String uri) throws SOAPException {
+ if (uri == null) {
+ uri = "";
+ }
if (prefix == null || prefix.length() == 0) {
omTarget.declareDefaultNamespace(uri);
} else {
@@ -204,9 +197,7 @@ public class SOAPElementImpl<T extends O
//Therefore create a text node and add it
//TODO: May need to address the situation where the prev sibling of the textnode itself is a textnode
Text textNode = getOwnerDocument().createTextNode(text);
- target.appendChild(textNode);
- TextImplEx saajTextNode = new TextImplEx((OMText)textNode, this);
- textNode.setUserData(SAAJ_NODE, saajTextNode, null);
+ appendChild(textNode);
return this;
}
@@ -274,7 +265,7 @@ public class SOAPElementImpl<T extends O
*/
public Iterator getChildElements(Name name) {
QName qName = new QName(name.getURI(), name.getLocalName());
- Iterator childIter = omTarget.getChildrenWithName(qName);
+ Iterator<OMElement> childIter = omTarget.getChildrenWithName(qName);
Collection childElements = new ArrayList();
while (childIter.hasNext()) {
childElements.add(toSAAJNode((org.w3c.dom.Node)childIter.next()));
@@ -423,7 +414,7 @@ public class SOAPElementImpl<T extends O
}
public Iterator getChildElements(QName qname) {
- Iterator childIter = omTarget.getChildrenWithName(qname);
+ Iterator<OMElement> childIter = omTarget.getChildrenWithName(qname);
Collection childElements = new ArrayList();
while (childIter.hasNext()) {
childElements.add(toSAAJNode((org.w3c.dom.Node)childIter.next()));
@@ -507,7 +498,7 @@ public class SOAPElementImpl<T extends O
* the encodingStyle is invalid for this SOAPElement.
*/
public void setEncodingStyle(String encodingStyle) throws SOAPException {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
try {
URI uri = new URI(encodingStyle);
if (!(this instanceof SOAPEnvelope)) {
@@ -521,7 +512,7 @@ public class SOAPElementImpl<T extends O
throw new IllegalArgumentException("Invalid Encoding style : "
+ encodingStyle + ":" + e);
}
- } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP12Version.getSingleton()) {
+ } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP12) {
if (this instanceof SOAPHeader || this instanceof SOAPBody ||
this instanceof SOAPFault ||
this instanceof SOAPFaultElement || this instanceof SOAPEnvelope ||
@@ -645,30 +636,6 @@ public class SOAPElementImpl<T extends O
}
/**
- * Returns the parent element of this <code>Node</code> object. This method can throw an
- * <code>UnsupportedOperationException</code> if the tree is not kept in memory.
- *
- * @return the <code>SOAPElement</code> object that is the parent of this <code>Node</code>
- * object or <code>null</code> if this <code>Node</code> object is root
- * @throws UnsupportedOperationException if the whole tree is not kept in memory
- * @see #setParentElement(javax.xml.soap.SOAPElement) setParentElement(javax.xml.soap.SOAPElement)
- */
- public SOAPElement getParentElement() {
- if (this.parentElement == null) {
- javax.xml.soap.Node parentNode = toSAAJNode(target.getParentNode());
- if (parentNode instanceof SOAPElement) {
- this.parentElement = (SOAPElement) parentNode;
- }
- }
- return this.parentElement;
- }
-
- public void setParentElement(SOAPElement parent) throws SOAPException {
- this.parentElement = parent;
- ((OMElementEx)this.omTarget).setParent(((SOAPElementImpl<? extends OMElement>)parent).omTarget);
- }
-
- /**
* Returns the the value of the immediate child of this <code>Node</code> object if a child
* exists and its value is text.
*
@@ -696,28 +663,6 @@ public class SOAPElementImpl<T extends O
return super.clone();
}
- public Node getParentNode() {
- Node parentNode = null;
- if (this.parentElement == null) {
- parentNode = toSAAJNode(target.getParentNode());
- if (parentNode instanceof SOAPElement) {
- this.parentElement = (SOAPElement) parentNode;
- }
- } else {
- parentNode = this.parentElement;
- }
- return parentNode;
- }
-
- /** dom Node method */
- public org.w3c.dom.Node getNextSibling() {
- return toSAAJNode(target.getNextSibling());
- }
-
- public Node getPreviousSibling() {
- return toSAAJNode(target.getPreviousSibling());
- }
-
/**
* If this is a Text node then this method will set its value, otherwise it sets the value of
* the immediate (Text) child of this node. The value of the immediate child of this node can be
@@ -746,16 +691,6 @@ public class SOAPElementImpl<T extends O
}
}
- public void detachNode() {
- this.detach();
- }
-
- public OMNode detach() {
- OMNode omNode = this.omTarget.detach();
- this.parentElement = null;
- return omNode;
- }
-
public String toString() {
return target.toString();
}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPEnvelopeImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPEnvelopeImpl.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPEnvelopeImpl.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPEnvelopeImpl.java Sun Dec 17 22:34:08 2017
@@ -20,10 +20,9 @@
package org.apache.axis2.saaj;
import org.apache.axiom.om.OMNode;
-import org.apache.axiom.soap.SOAP11Version;
-import org.apache.axiom.soap.SOAP12Version;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPVersion;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -130,12 +129,8 @@ public class SOAPEnvelopeImpl extends SO
public SOAPHeader addHeader() throws SOAPException {
org.apache.axiom.soap.SOAPHeader header = omTarget.getHeader();
if (header == null) {
- SOAPHeaderImpl saajSOAPHeader;
header = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPHeader(omTarget);
- saajSOAPHeader = new SOAPHeaderImpl(header);
- saajSOAPHeader.setParentElement(this);
- ((Element)omTarget.getHeader()).setUserData(SAAJ_NODE, saajSOAPHeader, null);
- return saajSOAPHeader;
+ return new SOAPHeaderImpl(header);
} else {
throw new SOAPException("Header already present, can't set header again without " +
"deleting the existing header. " +
@@ -160,7 +155,6 @@ public class SOAPEnvelopeImpl extends SO
body = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPBody(omTarget);
SOAPBodyImpl saajSOAPBody = new SOAPBodyImpl(body);
saajSOAPBody.setParentElement(this);
- ((Element)omTarget.getBody()).setUserData(SAAJ_NODE, saajSOAPBody, null);
return saajSOAPBody;
} else {
throw new SOAPException("Body already present, can't set body again without " +
@@ -184,7 +178,7 @@ public class SOAPEnvelopeImpl extends SO
* on Envelop
*/
public SOAPElement addAttribute(Name name, String value) throws SOAPException {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP12Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP12) {
if ("encodingStyle".equals(name.getLocalName())) {
throw new SOAPException(
"SOAP1.2 does not allow encodingStyle attribute to be set " +
@@ -199,9 +193,9 @@ public class SOAPEnvelopeImpl extends SO
* element
*/
public SOAPElement addChildElement(Name name) throws SOAPException {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP12Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP12) {
throw new SOAPException("Cannot add elements after body element");
- } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
//Let elements to be added any where.
return super.addChildElement(name);
}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java Sun Dec 17 22:34:08 2017
@@ -23,9 +23,7 @@ import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAP11Constants;
-import org.apache.axiom.soap.SOAP11Version;
import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axiom.soap.SOAP12Version;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.soap.SOAPFaultCode;
import org.apache.axiom.soap.SOAPFaultDetail;
@@ -35,6 +33,7 @@ import org.apache.axiom.soap.SOAPFaultRo
import org.apache.axiom.soap.SOAPFaultSubCode;
import org.apache.axiom.soap.SOAPFaultText;
import org.apache.axiom.soap.SOAPFaultValue;
+import org.apache.axiom.soap.SOAPVersion;
import org.w3c.dom.Element;
import javax.xml.namespace.QName;
@@ -63,7 +62,7 @@ public class SOAPFaultImpl extends SOAPB
}
void setDefaults() throws SOAPException {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
setFaultCode(SOAP11Constants.QNAME_SENDER_FAULTCODE);
} else {
setFaultCode(SOAP12Constants.QNAME_SENDER_FAULTCODE);
@@ -111,11 +110,11 @@ public class SOAPFaultImpl extends SOAPB
// localName = faultCode.substring(faultCode.indexOf(":")+1);
// }
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
soapFactory = (SOAPFactory)this.omTarget.getOMFactory();
soapFaultCode = soapFactory.createSOAPFaultCode(omTarget);
soapFaultCode.setText(faultCode);
- } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP12Version.getSingleton()) {
+ } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP12) {
soapFactory = (SOAPFactory)this.omTarget.getOMFactory();
soapFaultCode = soapFactory.createSOAPFaultCode(omTarget);
SOAPFaultValue soapFaultValue = soapFactory.createSOAPFaultValue(soapFaultCode);
@@ -134,9 +133,9 @@ public class SOAPFaultImpl extends SOAPB
*/
public String getFaultCode() {
if (omTarget != null && omTarget.getCode() != null) {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
return omTarget.getCode().getText();
- } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP12Version.getSingleton()) {
+ } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP12) {
return omTarget.getCode().getValue().getText();
} else {
return null;
@@ -188,9 +187,9 @@ public class SOAPFaultImpl extends SOAPB
* @see #getFaultString() getFaultString()
*/
public void setFaultString(String faultString) throws SOAPException {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
setFaultString(faultString, null);
- } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP12Version.getSingleton()) {
+ } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP12) {
setFaultString(faultString, Locale.getDefault());
}
}
@@ -261,7 +260,6 @@ public class SOAPFaultImpl extends SOAPB
SOAPFactory factory = (SOAPFactory)this.omTarget.getOMFactory();
omDetail = factory.createSOAPFaultDetail(this.omTarget);
Detail saajDetail = new DetailImpl(omDetail);
- ((Element)omTarget.getDetail()).setUserData(SAAJ_NODE, saajDetail, null);
isDetailAdded = true;
return saajDetail;
}
@@ -288,17 +286,17 @@ public class SOAPFaultImpl extends SOAPB
public void setFaultString(String faultString, Locale locale) throws SOAPException {
if (this.omTarget.getReason() != null) {
SOAPFaultReason reason = this.omTarget.getReason();
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
reason.setText(faultString);
- } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP12Version.getSingleton()) {
+ } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP12) {
addFaultReasonText(faultString, locale);
}
} else {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
SOAPFaultReason reason = ((SOAPFactory)this.omTarget
.getOMFactory()).createSOAPFaultReason(this.omTarget);
reason.setText(faultString);
- } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP12Version.getSingleton()) {
+ } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP12) {
addFaultReasonText(faultString, locale);
}
}
@@ -318,9 +316,9 @@ public class SOAPFaultImpl extends SOAPB
* @since SAAJ 1.2
*/
public Locale getFaultStringLocale() {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
return this.faultReasonLocale;
- } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP12Version.getSingleton()) {
+ } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP12) {
Locale locale = null;
try {
if (getFaultReasonLocales().hasNext()) {
@@ -353,9 +351,9 @@ public class SOAPFaultImpl extends SOAPB
if (locale == null) {
throw new SOAPException("Received null for locale");
}
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
throw new UnsupportedOperationException("Not supported in SOAP 1.1");
- } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP12Version.getSingleton()) {
+ } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP12) {
removeDefaults();
String existingReasonText = getFaultReasonText(locale);
@@ -405,7 +403,7 @@ public class SOAPFaultImpl extends SOAPB
if (subcode.getNamespaceURI() == null || subcode.getNamespaceURI().trim().length() == 0) {
throw new SOAPException("Unqualified QName object : " + subcode);
}
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
throw new UnsupportedOperationException();
}
@@ -446,14 +444,7 @@ public class SOAPFaultImpl extends SOAPB
*/
public QName getFaultCodeAsQName() {
SOAPFaultCode soapFaultCode = this.omTarget.getCode();
- if (soapFaultCode != null) {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
- return soapFaultCode.getTextAsQName();
- } else {
- return soapFaultCode.getValue().getTextAsQName();
- }
- }
- return null;
+ return soapFaultCode != null ? soapFaultCode.getValueAsQName() : null;
}
/**
@@ -465,7 +456,7 @@ public class SOAPFaultImpl extends SOAPB
* - if this message does not support the SOAP 1.2 concept of Fault Node.
*/
public String getFaultNode() {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
throw new UnsupportedOperationException("Message does not support the " +
"SOAP 1.2 concept of Fault Node");
} else {
@@ -490,7 +481,7 @@ public class SOAPFaultImpl extends SOAPB
* @since SAAJ 1.3
*/
public Iterator getFaultReasonLocales() throws SOAPException {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
throw new UnsupportedOperationException("Message does not support the " +
"SOAP 1.2 concept of Fault Reason");
} else {
@@ -530,7 +521,7 @@ public class SOAPFaultImpl extends SOAPB
* @since SAAJ 1.3
*/
public String getFaultReasonText(Locale locale) throws SOAPException {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
throw new UnsupportedOperationException("Message does not support the " +
"SOAP 1.2 concept of Fault Reason");
} else {
@@ -562,7 +553,7 @@ public class SOAPFaultImpl extends SOAPB
*/
public Iterator getFaultReasonTexts() throws SOAPException {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
throw new UnsupportedOperationException();
}
@@ -585,7 +576,7 @@ public class SOAPFaultImpl extends SOAPB
* @since SAAJ 1.3
*/
public String getFaultRole() {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
throw new UnsupportedOperationException("Message does not support the " +
"SOAP 1.2 concept of Fault Reason");
} else {
@@ -607,14 +598,13 @@ public class SOAPFaultImpl extends SOAPB
* - if this message does not support the SOAP 1.2 concept of Subcode.
*/
public Iterator getFaultSubcodes() {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
throw new UnsupportedOperationException();
}
ArrayList faultSubcodes = new ArrayList();
SOAPFaultSubCode subCodeElement = this.omTarget.getCode().getSubCode();
while (subCodeElement != null) {
- QName qname = subCodeElement.getValue().getTextAsQName();
- faultSubcodes.add(qname);
+ faultSubcodes.add(subCodeElement.getValueAsQName());
subCodeElement = subCodeElement.getSubCode();
}
return faultSubcodes.iterator();
@@ -638,7 +628,7 @@ public class SOAPFaultImpl extends SOAPB
* - if this message does not support the SOAP 1.2 concept of Subcode.
*/
public void removeAllFaultSubcodes() {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
throw new UnsupportedOperationException();
} else {
omTarget.getCode().getSubCode().detach();
@@ -664,9 +654,9 @@ public class SOAPFaultImpl extends SOAPB
}
org.apache.axiom.soap.SOAPFactory soapFactory = null;
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
soapFactory = (SOAPFactory)this.omTarget.getOMFactory();
- } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP12Version.getSingleton()) {
+ } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP12) {
if (!(qname.getNamespaceURI()
.equals(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE))) {
throw new SOAPException("Incorrect URI"
@@ -683,12 +673,12 @@ public class SOAPFaultImpl extends SOAPB
.getPrefix();
OMFactory factory = omTarget.getOMFactory();
- if (((SOAPFactory)factory).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)factory).getSOAPVersion() == SOAPVersion.SOAP11) {
soapFaultCode.setText(prefix + ":" + qname.getLocalPart());
OMNamespace omNamespace = factory.createOMNamespace(qname.getNamespaceURI(),
qname.getPrefix());
soapFaultCode.declareNamespace(omNamespace);
- } else if (((SOAPFactory)factory).getSOAPVersion() == SOAP12Version.getSingleton()) {
+ } else if (((SOAPFactory)factory).getSOAPVersion() == SOAPVersion.SOAP12) {
SOAPFaultValue soapFaultValue = soapFactory.createSOAPFaultValue(soapFaultCode);
// don't just use the default prefix, use the passed one or the parent's
soapFaultValue.setText(prefix + ":" + qname.getLocalPart());
@@ -713,7 +703,7 @@ public class SOAPFaultImpl extends SOAPB
public void setFaultNode(String s) throws SOAPException {
SOAPFactory soapFactory = (SOAPFactory)this.omTarget.getOMFactory();
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
throw new UnsupportedOperationException("message does not support " +
"the SOAP 1.2 concept of Fault Node");
}
@@ -733,7 +723,7 @@ public class SOAPFaultImpl extends SOAPB
*/
public void setFaultRole(String uri) throws SOAPException {
SOAPFactory soapFactory = (SOAPFactory)this.omTarget.getOMFactory();
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
throw new UnsupportedOperationException("message does not support the " +
"SOAP 1.2 concept of Fault Role");
}
@@ -755,12 +745,10 @@ public class SOAPFaultImpl extends SOAPB
Collection childElements = new ArrayList();
while (childIter.hasNext()) {
org.w3c.dom.Node domNode = (org.w3c.dom.Node)childIter.next();
- Node saajNode = toSAAJNode(domNode);
+ org.w3c.dom.Node saajNode = toSAAJNode(domNode);
if (!(saajNode instanceof SOAPFaultElement)) {
// silently replace node, as per saaj 1.2 spec
- SOAPFaultElement bodyEle = new SOAPFaultElementImpl<OMElement>((OMElement)domNode);
- domNode.setUserData(SAAJ_NODE, bodyEle, null);
- childElements.add(bodyEle);
+ childElements.add(new SOAPFaultElementImpl<OMElement>((OMElement)domNode));
} else {
childElements.add(saajNode);
}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderElementImpl.java Sun Dec 17 22:34:08 2017
@@ -19,9 +19,9 @@
package org.apache.axis2.saaj;
-import org.apache.axiom.soap.SOAP11Version;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.soap.SOAPVersion;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
@@ -96,7 +96,7 @@ public class SOAPHeaderElementImpl exten
* - if this message does not support the SOAP 1.2 concept of Fault Role.
*/
public void setRole(String uri) throws SOAPException {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
throw new UnsupportedOperationException();
} else {
this.omTarget.setRole(uri);
@@ -104,7 +104,7 @@ public class SOAPHeaderElementImpl exten
}
public String getRole() {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
throw new UnsupportedOperationException();
} else {
return this.omTarget.getRole();
@@ -125,7 +125,7 @@ public class SOAPHeaderElementImpl exten
* support the SOAP 1.2 concept of Relay attribute.
*/
public void setRelay(boolean flag) throws SOAPException {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
throw new UnsupportedOperationException();
} else {
this.omTarget.setRelay(flag);
@@ -133,7 +133,7 @@ public class SOAPHeaderElementImpl exten
}
public boolean getRelay() {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
throw new UnsupportedOperationException();
} else {
return this.omTarget.getRelay();
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPHeaderImpl.java Sun Dec 17 22:34:08 2017
@@ -21,17 +21,14 @@ package org.apache.axis2.saaj;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMNode;
-import org.apache.axiom.soap.SOAP11Version;
-import org.apache.axiom.soap.SOAP12Version;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.soap.SOAPVersion;
import org.apache.axis2.namespace.Constants;
import org.w3c.dom.Element;
import javax.xml.namespace.QName;
import javax.xml.soap.Name;
-import javax.xml.soap.Node;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
@@ -78,8 +75,6 @@ public class SOAPHeaderImpl extends SOAP
OMNamespace ns = omTarget.getOMFactory().createOMNamespace(uri, prefix);
SOAPHeaderBlock headerBlock = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPHeaderBlock(localName, ns, omTarget);
SOAPHeaderElementImpl soapHeaderElement = new SOAPHeaderElementImpl(headerBlock);
- target.setUserData(SAAJ_NODE, this, null);
- soapHeaderElement.target.setUserData(SAAJ_NODE, soapHeaderElement, null);
soapHeaderElement.setParentElement(this);
return soapHeaderElement;
}
@@ -100,8 +95,6 @@ public class SOAPHeaderImpl extends SOAP
SOAPHeaderBlock headerBlock = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPHeaderBlock(
soapElement.getLocalName(), ns, omTarget);
SOAPHeaderElementImpl soapHeaderElement = new SOAPHeaderElementImpl(headerBlock);
- target.setUserData(SAAJ_NODE, this, null);
- soapHeaderElement.target.setUserData(SAAJ_NODE, soapHeaderElement, null);
soapHeaderElement.setParentElement(this);
return soapHeaderElement;
}
@@ -113,11 +106,8 @@ public class SOAPHeaderImpl extends SOAP
SOAPHeaderBlock headerBlock = ((SOAPFactory)this.omTarget.getOMFactory()).createSOAPHeaderBlock(
child.getLocalName(), ns, omTarget);
- target.setUserData(SAAJ_NODE, this, null);
-
SOAPHeaderElementImpl soapHeaderElement = new SOAPHeaderElementImpl(headerBlock);
copyContents(soapHeaderElement, child);
- soapHeaderElement.target.setUserData(SAAJ_NODE, soapHeaderElement, null);
soapHeaderElement.setParentElement(this);
return soapHeaderElement;
}
@@ -146,8 +136,6 @@ public class SOAPHeaderImpl extends SOAP
name.getLocalName(), ns, omTarget);
SOAPHeaderElementImpl soapHeaderElement = new SOAPHeaderElementImpl(headerBlock);
- target.setUserData(SAAJ_NODE, this, null);
- soapHeaderElement.target.setUserData(SAAJ_NODE, soapHeaderElement, null);
soapHeaderElement.setParentElement(this);
return soapHeaderElement;
}
@@ -262,7 +250,7 @@ public class SOAPHeaderImpl extends SOAP
public SOAPHeaderElement addNotUnderstoodHeaderElement(QName qname) throws SOAPException {
SOAPHeaderBlock soapHeaderBlock = null;
OMNamespace ns = omTarget.getOMFactory().createOMNamespace(qname.getNamespaceURI(), qname.getPrefix());
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
throw new UnsupportedOperationException();
} else {
soapHeaderBlock = this.omTarget.addHeaderBlock(
@@ -327,9 +315,9 @@ public class SOAPHeaderImpl extends SOAP
}
public SOAPElement addTextNode(String text) throws SOAPException {
- if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton()) {
+ if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11) {
return super.addTextNode(text);
- } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAP12Version.getSingleton()) {
+ } else if (((SOAPFactory)this.omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP12) {
throw new SOAPException("Cannot add text node to SOAPHeader");
} else {
return null;
@@ -349,28 +337,16 @@ public class SOAPHeaderImpl extends SOAP
Collection childElements = new ArrayList();
while (childIter.hasNext()) {
org.w3c.dom.Node domNode = (org.w3c.dom.Node)childIter.next();
- Node saajNode = toSAAJNode(domNode);
+ org.w3c.dom.Node saajNode = toSAAJNode(domNode);
if (saajNode instanceof javax.xml.soap.Text) {
childElements.add(saajNode);
} else if (!(saajNode instanceof SOAPHeaderElement)) {
// silently replace node, as per saaj 1.2 spec
- SOAPHeaderElement headerEle = new SOAPHeaderElementImpl((SOAPHeaderBlock)domNode);
- domNode.setUserData(SAAJ_NODE, headerEle, null);
- childElements.add(headerEle);
+ childElements.add(new SOAPHeaderElementImpl((SOAPHeaderBlock)domNode));
} else {
childElements.add(saajNode);
}
}
return childElements.iterator();
}
-
- public void detachNode() {
- this.detach();
- }
-
- public OMNode detach() {
- OMNode omNode = omTarget.detach();
- parentElement = null;
- return omNode;
- }
}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPMessageImpl.java Sun Dec 17 22:34:08 2017
@@ -20,14 +20,14 @@
package org.apache.axis2.saaj;
import org.apache.axiom.attachments.Attachments;
-import org.apache.axiom.mime.ContentTypeBuilder;
+import org.apache.axiom.mime.ContentType;
import org.apache.axiom.mime.MediaType;
import org.apache.axiom.om.OMException;
import org.apache.axiom.om.OMOutputFormat;
import org.apache.axiom.om.impl.OMMultipartWriter;
-import org.apache.axiom.soap.SOAP11Version;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPVersion;
import org.apache.axiom.util.UIDGenerator;
import org.apache.axis2.saaj.util.SAAJUtil;
import org.apache.axis2.transport.http.HTTPConstants;
@@ -270,11 +270,11 @@ public class SOAPMessageImpl extends SOA
public void saveChanges() throws SOAPException {
try {
String contentTypeValue = getSingleHeaderValue(HTTPConstants.HEADER_CONTENT_TYPE);
- ContentTypeBuilder contentType;
+ ContentType.Builder contentType;
if (isEmptyString(contentTypeValue)) {
- contentType = new ContentTypeBuilder(attachmentParts.size() > 0 ? MediaType.MULTIPART_RELATED : getMediaType());
+ contentType = ContentType.builder().setMediaType(attachmentParts.size() > 0 ? MediaType.MULTIPART_RELATED : getMediaType());
} else {
- contentType = new ContentTypeBuilder(contentTypeValue);
+ contentType = new ContentType(contentTypeValue).toBuilder();
//Use configures the baseType with multipart/related while no attachment exists or all the attachments are removed
if (contentType.getMediaType().equals(MediaType.MULTIPART_RELATED) && attachmentParts.size() == 0) {
contentType.setMediaType(getMediaType());
@@ -311,11 +311,11 @@ public class SOAPMessageImpl extends SOA
//Configure charset
String soapPartContentTypeValue = getSingleHeaderValue(soapPart.getMimeHeader(HTTPConstants.HEADER_CONTENT_TYPE));
- ContentTypeBuilder soapPartContentType = null;
+ ContentType.Builder soapPartContentType;
if (isEmptyString(soapPartContentTypeValue)) {
- soapPartContentType = new ContentTypeBuilder(soapPartContentTypeValue);
+ soapPartContentType = new ContentType(soapPartContentTypeValue).toBuilder();
} else {
- soapPartContentType = new ContentTypeBuilder(getMediaType());
+ soapPartContentType = ContentType.builder().setMediaType(getMediaType());
}
setCharsetParameter(soapPartContentType);
} else {
@@ -323,7 +323,7 @@ public class SOAPMessageImpl extends SOA
setCharsetParameter(contentType);
}
- mimeHeaders.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, contentType.toString());
+ mimeHeaders.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, contentType.build().toString());
} catch (ParseException e) {
throw new SOAPException("Invalid Content Type Field in the Mime Message", e);
}
@@ -374,7 +374,7 @@ public class SOAPMessageImpl extends SOA
if (attachmentParts.isEmpty()) {
envelope.serialize(out, format);
} else {
- ContentTypeBuilder contentType = new ContentTypeBuilder(getSingleHeaderValue(HTTPConstants.HEADER_CONTENT_TYPE));
+ ContentType.Builder contentType = new ContentType(getSingleHeaderValue(HTTPConstants.HEADER_CONTENT_TYPE)).toBuilder();
String boundary = contentType.getParameter("boundary");
if(isEmptyString(boundary)) {
boundary = UIDGenerator.generateMimeBoundary();
@@ -393,10 +393,10 @@ public class SOAPMessageImpl extends SOA
}
format.setRootContentId(rootContentId);
- format.setSOAP11(((SOAPFactory)((SOAPEnvelopeImpl) soapPart.getEnvelope()).omTarget.getOMFactory()).getSOAPVersion() == SOAP11Version.getSingleton());
+ format.setSOAP11(((SOAPFactory)((SOAPEnvelopeImpl) soapPart.getEnvelope()).omTarget.getOMFactory()).getSOAPVersion() == SOAPVersion.SOAP11);
//Double save the content-type in case anything is updated
- mimeHeaders.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, contentType.toString());
+ mimeHeaders.setHeader(HTTPConstants.HEADER_CONTENT_TYPE, contentType.build().toString());
OMMultipartWriter mpw = new OMMultipartWriter(out, format);
OutputStream rootPartOutputStream = mpw.writeRootPart();
@@ -615,7 +615,7 @@ public class SOAPMessageImpl extends SOA
* @param contentType
* @throws SOAPException
*/
- private void setCharsetParameter(ContentTypeBuilder contentType) throws SOAPException{
+ private void setCharsetParameter(ContentType.Builder contentType) throws SOAPException{
String charset = (String)getProperty(CHARACTER_SET_ENCODING);
if (!isEmptyString(charset)) {
contentType.setParameter("charset", charset);
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/SOAPPartImpl.java Sun Dec 17 22:34:08 2017
@@ -24,13 +24,9 @@ import org.apache.axiom.mime.ContentType
import org.apache.axiom.mime.MediaType;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMMetaFactory;
-import org.apache.axiom.om.impl.MTOMConstants;
-import org.apache.axiom.om.util.StAXUtils;
-import org.apache.axiom.soap.SOAP11Constants;
-import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder;
-import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
+import org.apache.axiom.soap.SOAPModelBuilder;
import org.apache.axis2.saaj.util.IDGenerator;
import org.apache.axis2.saaj.util.SAAJUtil;
import org.apache.axis2.transport.http.HTTPConstants;
@@ -61,7 +57,6 @@ import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
@@ -139,14 +134,12 @@ public class SOAPPartImpl extends SOAPPa
String charset;
boolean isMTOM;
- String soapEnvelopeNamespaceURI;
OMMetaFactory metaFactory = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM);
SOAPFactory soapFactory;
if (contentType == null) {
charset = null;
isMTOM = false;
- soapFactory = metaFactory.getSOAP11Factory();
- soapEnvelopeNamespaceURI = null;
+ soapFactory = null;
} else {
MediaType baseType = contentType.getMediaType();
MediaType soapContentType;
@@ -168,10 +161,8 @@ public class SOAPPartImpl extends SOAPPa
}
if (soapContentType.equals(MediaType.TEXT_XML)) {
- soapEnvelopeNamespaceURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
soapFactory = metaFactory.getSOAP11Factory();
} else if (soapContentType.equals(MediaType.APPLICATION_SOAP_XML)) {
- soapEnvelopeNamespaceURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
soapFactory = metaFactory.getSOAP12Factory();
} else {
throw new SOAPException("Unrecognized content type '" + soapContentType + "'");
@@ -180,31 +171,18 @@ public class SOAPPartImpl extends SOAPPa
charset = contentType.getParameter("charset");
}
- XMLStreamReader streamReader;
- try {
- if (charset != null) {
- streamReader = StAXUtils.createXMLStreamReader(inputStream, charset);
- } else {
- streamReader = StAXUtils.createXMLStreamReader(inputStream);
- }
- } catch (XMLStreamException e) {
- throw new SOAPException(e);
- }
-
- StAXSOAPModelBuilder builder;
+ SOAPModelBuilder builder;
if (isMTOM && attachments != null) {
- builder = new MTOMStAXSOAPModelBuilder(streamReader,
- soapFactory,
- attachments,
- soapEnvelopeNamespaceURI);
+ builder = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory, attachments);
} else {
- builder = new StAXSOAPModelBuilder(streamReader,
- soapFactory,
- soapEnvelopeNamespaceURI);
+ builder = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory, inputStream, charset);
}
try {
org.apache.axiom.soap.SOAPEnvelope soapEnvelope = builder.getSOAPEnvelope();
+ if (soapFactory != null && soapEnvelope.getOMFactory() != soapFactory) {
+ throw new SOAPException("SOAP version of message doesn't match Content-Type");
+ }
envelope = new SOAPEnvelopeImpl(soapEnvelope);
envelope.omTarget.build();
this.document = envelope.getOwnerDocument();
@@ -354,9 +332,8 @@ public class SOAPPartImpl extends SOAPPa
reader = inputFactory.createXMLStreamReader(is);
}
- StAXSOAPModelBuilder builder1 = new StAXSOAPModelBuilder(reader,
- (SOAPFactory)this.envelope.omTarget
- .getOMFactory(), null);
+ SOAPModelBuilder builder1 = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+ envelope.omTarget.getOMFactory().getMetaFactory(), reader);
envelope = new SOAPEnvelopeImpl(builder1.getSOAPEnvelope());
envelope.omTarget.build();
@@ -1192,7 +1169,7 @@ public class SOAPPartImpl extends SOAPPa
throw new IllegalStateException("Cannot set value of SOAPPart.");
}
- javax.xml.soap.Node toSAAJNode(org.w3c.dom.Node domNode) {
- return SAAJNode.toSAAJNode(domNode, this);
+ Node toSAAJNode(org.w3c.dom.Node domNode) {
+ return ProxyNode.toSAAJNode(domNode, this);
}
}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/TextImplEx.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/TextImplEx.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/TextImplEx.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/TextImplEx.java Sun Dec 17 22:34:08 2017
@@ -20,38 +20,18 @@
package org.apache.axis2.saaj;
import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.OMNode;
import org.w3c.dom.DOMException;
-import javax.xml.soap.SOAPElement;
import javax.xml.soap.Text;
-public class TextImplEx extends SAAJNode<org.w3c.dom.Text,OMText> implements Text {
- private org.w3c.dom.Node previousSibling;
- private org.w3c.dom.Node nextSibling;
-
- public TextImplEx(String data, SOAPElement parent) {
- this(OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM).getOMFactory().createOMText(data), parent);
- }
-
- public TextImplEx(OMText textNode, SOAPElement parent) {
- super((org.w3c.dom.Text)textNode, textNode);
- this.parentElement = parent;
- }
-
- public TextImplEx(String data, SOAPElement parent,
- org.w3c.dom.Node prevSibling, org.w3c.dom.Node nextSibling) {
- this(data, parent);
- this.previousSibling = prevSibling;
- this.nextSibling = nextSibling;
- }
-
- public void setNextSibling(org.w3c.dom.Node nextSibling) {
- this.nextSibling = nextSibling;
+public class TextImplEx extends NodeImpl<org.w3c.dom.CharacterData,OMNode> implements Text {
+ public TextImplEx(String data) {
+ this(OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM).getOMFactory().createOMText(data));
}
- public void setPreviousSibling(org.w3c.dom.Node previousSibling) {
- this.previousSibling = previousSibling;
+ public TextImplEx(OMNode textNode) {
+ super((org.w3c.dom.CharacterData)textNode, textNode);
}
/**
@@ -61,7 +41,7 @@ public class TextImplEx extends SAAJNode
* otherwise
*/
public boolean isComment() {
- String value = omTarget.getText();
+ String value = target.getData();
return value.startsWith("<!--") && value.endsWith("-->");
}
@@ -80,12 +60,11 @@ public class TextImplEx extends SAAJNode
* <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
*/
public org.w3c.dom.Text splitText(int offset) throws DOMException {
- return target.splitText(offset);
+ return ((Text)target).splitText(offset);
}
public boolean isElementContentWhitespace() {
- // TODO - Fixme.
- throw new UnsupportedOperationException("TODO");
+ return ((org.w3c.dom.Text)target).isElementContentWhitespace();
}
public String getWholeText() {
@@ -235,16 +214,6 @@ public class TextImplEx extends SAAJNode
return getValue();
}
-
- public org.w3c.dom.Node getNextSibling() {
- return toSAAJNode(nextSibling);
- }
-
-
- public org.w3c.dom.Node getPreviousSibling() {
- return toSAAJNode(previousSibling);
- }
-
public int getLength() {
return target.getLength();
}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/util/SAAJUtil.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/util/SAAJUtil.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/util/SAAJUtil.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/src/org/apache/axis2/saaj/util/SAAJUtil.java Sun Dec 17 22:34:08 2017
@@ -19,16 +19,10 @@
package org.apache.axis2.saaj.util;
-import org.apache.axiom.attachments.Attachments;
import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMAttachmentAccessor;
import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMMetaFactory;
-import org.apache.axiom.soap.SOAP11Constants;
-import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder;
-import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
+import org.apache.axiom.om.OMXMLBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -38,10 +32,13 @@ import javax.xml.soap.AttachmentPart;
import javax.xml.soap.MimeHeader;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPException;
+import javax.xml.transform.stax.StAXSource;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
/** Utility class for the Axis2-WSS4J Module */
public class SAAJUtil {
@@ -53,28 +50,9 @@ public class SAAJUtil {
* @return the DOM Document of the given SOAP Envelope
*/
public static Document getDocumentFromSOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope env) {
- env.build();
-
- //Check the namespace and find SOAP version and factory
- String nsURI;
- OMMetaFactory metaFactory = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM);
- SOAPFactory factory;
- if (env.getNamespace().getNamespaceURI()
- .equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
- nsURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
- factory = metaFactory.getSOAP11Factory();
- } else {
- nsURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
- factory = metaFactory.getSOAP12Factory();
- }
-
- StAXSOAPModelBuilder stAXSOAPModelBuilder =
- new StAXSOAPModelBuilder(env.getXMLStreamReader(), factory, nsURI);
- SOAPEnvelope envelope = (stAXSOAPModelBuilder).getSOAPEnvelope();
- envelope.build();
-
- Element envElem = (Element)envelope;
- return envElem.getOwnerDocument();
+ return (Document)OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+ OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM),
+ env.getXMLStreamReader()).getSOAPMessage();
}
/**
@@ -84,46 +62,20 @@ public class SAAJUtil {
* @return the org.apache.axis2.soap.impl.dom.SOAPEnvelopeImpl of the given SOAP Envelope
*/
public static Element toDOOMSOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope env) {
- env.build();
-
- //Check the namespace and find SOAP version and factory
- String nsURI;
- OMMetaFactory metaFactory = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM);
- SOAPFactory factory;
- if (env.getNamespace().getNamespaceURI()
- .equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
- nsURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
- factory = metaFactory.getSOAP11Factory();
- } else {
- nsURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
- factory = metaFactory.getSOAP11Factory();
- }
-
- StAXSOAPModelBuilder stAXSOAPModelBuilder =
- new StAXSOAPModelBuilder(env.getXMLStreamReader(), factory, nsURI);
- SOAPEnvelope envelope = (stAXSOAPModelBuilder).getSOAPEnvelope();
- envelope.build();
-
- return (Element)envelope;
+ return (Element)OMXMLBuilderFactory.createStAXSOAPModelBuilder(
+ OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM),
+ env.getXMLStreamReader()).getSOAPEnvelope();
}
public static org.apache.axiom.soap.SOAPEnvelope
getSOAPEnvelopeFromDOOMDocument(org.w3c.dom.Document doc) {
-
- OMElement docElem = (OMElement)doc.getDocumentElement();
- StAXSOAPModelBuilder stAXSOAPModelBuilder =
- new StAXSOAPModelBuilder(docElem.getXMLStreamReader(), null);
- return stAXSOAPModelBuilder.getSOAPEnvelope();
+ return OMXMLBuilderFactory.createStAXSOAPModelBuilder(((OMElement)doc.getDocumentElement()).getXMLStreamReader()).getSOAPEnvelope();
}
public static org.apache.axiom.soap.SOAPEnvelope
toOMSOAPEnvelope(org.w3c.dom.Element elem) {
-
- OMElement docElem = (OMElement)elem;
- StAXSOAPModelBuilder stAXSOAPModelBuilder =
- new StAXSOAPModelBuilder(docElem.getXMLStreamReader(), null);
- return stAXSOAPModelBuilder.getSOAPEnvelope();
+ return OMXMLBuilderFactory.createStAXSOAPModelBuilder(((OMElement)elem).getXMLStreamReader()).getSOAPEnvelope();
}
/**
@@ -136,8 +88,7 @@ public class SAAJUtil {
*/
public static org.apache.axiom.soap.SOAPEnvelope toOMSOAPEnvelope(
javax.xml.soap.SOAPMessage message) throws SOAPException {
-
- Attachments attachments = new Attachments();
+ final Map<String,DataHandler> attachments = new HashMap<String,DataHandler>();
for (Iterator it = message.getAttachments(); it.hasNext(); ) {
AttachmentPart attachment = (AttachmentPart)it.next();
String contentId = attachment.getContentId();
@@ -149,12 +100,18 @@ public class SAAJUtil {
if (contentId.startsWith("<") && contentId.endsWith(">")) {
contentId = contentId.substring(1, contentId.length()-1);
}
- attachments.addDataHandler(contentId, dh);
+ attachments.put(contentId, dh);
}
}
OMElement docElem = (OMElement)message.getSOAPPart().getDocumentElement();
- MTOMStAXSOAPModelBuilder builder = new MTOMStAXSOAPModelBuilder(docElem.getXMLStreamReader(), attachments);
- return builder.getSOAPEnvelope();
+ OMAttachmentAccessor attachmentAccessor = new OMAttachmentAccessor() {
+ @Override
+ public DataHandler getDataHandler(String contentID) {
+ return attachments.get(contentID);
+ }
+ };
+ return OMXMLBuilderFactory.createSOAPModelBuilder(OMAbstractFactory.getMetaFactory(),
+ new StAXSource(docElem.getXMLStreamReader()), attachmentAccessor).getSOAPEnvelope();
}
/**
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test-resources/log4j.properties
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test-resources/log4j.properties?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test-resources/log4j.properties (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test-resources/log4j.properties Sun Dec 17 22:34:08 2017
@@ -26,7 +26,6 @@ log4j.rootCategory=ERROR, CONSOLE
# Set the enterprise logger priority to FATAL
log4j.logger.org.apache.axis2.enterprise=FATAL
-log4j.logger.de.hunsicker.jalopy.io=FATAL
log4j.logger.httpclient.wire.header=FATAL
log4j.logger.org.apache.commons.httpclient=FATAL
@@ -40,4 +39,4 @@ log4j.appender.LOGFILE=org.apache.log4j.
log4j.appender.LOGFILE.File=axis2.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
-log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
\ No newline at end of file
+log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test-resources/saaj-repo/axis2.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test-resources/saaj-repo/axis2.xml?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test-resources/saaj-repo/axis2.xml (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test-resources/saaj-repo/axis2.xml Sun Dec 17 22:34:08 2017
@@ -51,7 +51,7 @@
<!-- Transport Outs -->
<!-- ================================================= -->
- <transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <transportSender name="http" class="org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender">
<parameter name="PROTOCOL">HTTP/1.1</parameter>
</transportSender>
<transportSender name="local" class="org.apache.axis2.transport.local.LocalTransportSender"/>
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/AttachmentTest.java Sun Dec 17 22:34:08 2017
@@ -321,4 +321,4 @@ public class AttachmentTest extends Asse
}
return true;
}
-}
\ No newline at end of file
+}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/SOAPEnvelopeTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/SOAPEnvelopeTest.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/SOAPEnvelopeTest.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/SOAPEnvelopeTest.java Sun Dec 17 22:34:08 2017
@@ -704,4 +704,4 @@ public class SOAPEnvelopeTest extends As
assertEquals("this is a test with a comment node", text.getData().trim());
assertFalse(iter.hasNext());
}
-}
\ No newline at end of file
+}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/SOAPHeaderTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/SOAPHeaderTest.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/SOAPHeaderTest.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/SOAPHeaderTest.java Sun Dec 17 22:34:08 2017
@@ -457,4 +457,4 @@ public class SOAPHeaderTest extends Asse
assertFalse(it.hasNext());
assertEquals(0, header.getChildNodes().getLength());
}
-}
\ No newline at end of file
+}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/saaj/test/org/apache/axis2/saaj/SOAPPartTest.java Sun Dec 17 22:34:08 2017
@@ -20,7 +20,6 @@
package org.apache.axis2.saaj;
import junit.framework.Assert;
-import org.apache.axiom.soap.impl.dom.soap11.SOAP11Factory;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.w3c.dom.Document;
@@ -196,50 +195,6 @@ public class SOAPPartTest extends Assert
assertTrue(node == null);
}
- /**
- * Check parent processing of SOAPMessage
- */
- // TODO: check why this fails with Sun's SAAJ implementation
- @Test
- public void test_parentAccess2() throws Exception {
-
- MessageFactory mf = MessageFactory.newInstance();
- SOAPMessage m = mf.createMessage();
- SOAPPart sp = m.getSOAPPart();
- SOAPEnvelope se = sp.getEnvelope();
- Node node = se.getParentNode();
- assertTrue(node == sp);
- node = node.getParentNode();
- assertTrue(node == null);
-
- SOAPElement e = se.getParentElement();
- assertTrue(node == null);
- }
-
- /**
- * Check parent processing of SOAPMessage
- */
- @Validated @Test
- public void test_parentAccess3() throws Exception {
-
- SOAP11Factory axiomSF = new SOAP11Factory();
- org.apache.axiom.soap.SOAPEnvelope axiomSE = axiomSF.createSOAPEnvelope();
- org.apache.axiom.soap.SOAPMessage axiomSM = axiomSF.createSOAPMessage();
- axiomSM.setSOAPEnvelope(axiomSE);
-
- SOAPEnvelopeImpl se = new SOAPEnvelopeImpl(axiomSE);
- SOAPMessageImpl sm = new SOAPMessageImpl(se);
- SOAPPartImpl sp = new SOAPPartImpl(sm, se);
-
- Node node = se.getParentNode();
- assertTrue(node == sp);
- node = node.getParentNode();
- assertTrue(node == null);
-
- SOAPElement e = se.getParentElement();
- assertTrue(node == null);
- }
-
// TODO: check why this fails with Sun's SAAJ implementation
@Test
public void testNodeTypes() throws Exception {
Propchange: axis/axis2/java/core/branches/AXIS2-4091/modules/samples/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Dec 17 22:34:08 2017
@@ -1 +1,4 @@
+.project
+.settings
*.iml
+target
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/samples/book/src/main/log4j.properties
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/samples/book/src/main/log4j.properties?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/samples/book/src/main/log4j.properties (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/samples/book/src/main/log4j.properties Sun Dec 17 22:34:08 2017
@@ -23,7 +23,6 @@ log4j.rootCategory=INFO, CONSOLE
# Set the enterprise logger priority to FATAL
log4j.logger.org.apache.axis2.enterprise=FATAL
-log4j.logger.de.hunsicker.jalopy.io=FATAL
log4j.logger.httpclient.wire.header=FATAL
log4j.logger.org.apache.commons.httpclient=FATAL
@@ -37,4 +36,4 @@ log4j.appender.LOGFILE=org.apache.log4j.
log4j.appender.LOGFILE.File=axis2.log
log4j.appender.LOGFILE.Append=true
log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
-log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
\ No newline at end of file
+log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/README.txt
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/README.txt?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/README.txt (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/README.txt Sun Dec 17 22:34:08 2017
@@ -14,7 +14,6 @@ Pre-Requisites
* Install Apache Ant 1.6.2 or later.
* Please create a directory named lib under the directory that contains this file.
* Download the following libraries and drop them into the new lib directory:
- * Latest stax-utils jar from https://stax-utils.dev.java.net/servlets/ProjectDocumentList?folderID=1106
* Version 1.0.4 of Castor jar from http://dist.codehaus.org/castor/1.0.4/castor-1.0.4.jar.
(The latest releases of castor are available at http://www.castor.org/download.html, but this example may not run
with versions later than 1.0.4)
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/build.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/build.xml?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/build.xml (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/build.xml Sun Dec 17 22:34:08 2017
@@ -173,13 +173,11 @@
</jar>
</target>
- <!--We are not shipping castor and stax-utils jars with the release. This target can be used to
+ <!--We are not shipping castor and Xerces jars with the release. This target can be used to
download those jars that are required to run this sample.-->
<target name="download.jars">
<mkdir dir="lib"/>
- <get src="http://ws.zones.apache.org/repository/stax-utils/jars/stax-utils-20060915.jar"
- dest="lib/stax-utils-20060915.jar" verbose="true"/>
<get src="http://dist.codehaus.org/castor/1.0.4/castor-1.0.4.jar" dest="lib/castor-1.0.4.jar"
verbose="true"/>
<get src="http://repo2.maven.org/maven2/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/client/src/samples/databinding/StockClient.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/client/src/samples/databinding/StockClient.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/client/src/samples/databinding/StockClient.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/client/src/samples/databinding/StockClient.java Sun Dec 17 22:34:08 2017
@@ -17,13 +17,16 @@
* under the License.
*/
package samples.databinding;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMDocument;
import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.SAXOMBuilder;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.UnmarshalHandler;
import org.exolab.castor.xml.Unmarshaller;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
+
import samples.databinding.data.GetStockQuote;
import samples.databinding.data.GetStockQuoteResponse;
@@ -31,7 +34,6 @@ import javax.xml.transform.TransformerEx
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXResult;
-import javanet.staxutils.StAXSource;
public final class StockClient {
public static void main(String[] args) throws Exception {
if (args.length != 2) {
@@ -49,20 +51,18 @@ public final class StockClient {
stub._getServiceClient().getOptions().setAction("getStockQuote");
GetStockQuote stockQuote = new GetStockQuote();
stockQuote.setSymbol(symbol);
- SAXOMBuilder builder = new SAXOMBuilder();
- Marshaller.marshal(stockQuote, builder);
+ OMDocument document = OMAbstractFactory.getOMFactory().createOMDocument();
+ Marshaller.marshal(stockQuote, document.getSAXResult().getHandler());
OMElement response = stub.getStockQuote(
- builder.getRootElement());
+ document.getOMDocumentElement());
- StAXSource staxSource =
- new StAXSource(response.getXMLStreamReader());
Unmarshaller unmarshaller = new Unmarshaller(GetStockQuoteResponse.class);
UnmarshalHandler unmarshalHandler = unmarshaller.createHandler();
GetStockQuoteResponse stockQuoteResponse;
try {
ContentHandler contentHandler = Unmarshaller.getContentHandler(unmarshalHandler);
- TransformerFactory.newInstance().newTransformer().transform(staxSource, new SAXResult(contentHandler));
+ TransformerFactory.newInstance().newTransformer().transform(response.getSAXSource(false), new SAXResult(contentHandler));
stockQuoteResponse = (GetStockQuoteResponse) unmarshalHandler.getObject();
} catch (SAXException e) {
throw new RuntimeException(e);
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/client/src/samples/databinding/StockClient2.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/client/src/samples/databinding/StockClient2.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/client/src/samples/databinding/StockClient2.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/client/src/samples/databinding/StockClient2.java Sun Dec 17 22:34:08 2017
@@ -17,27 +17,28 @@
* under the License.
*/
package samples.databinding;
+
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMDataSource;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.impl.builder.SAXOMBuilder;
+import org.apache.axiom.om.ds.AbstractPushOMDataSource;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.StAXBuilder;
-import org.jdom.output.SAXOutputter;
import org.jdom.output.StAXOutputter;
-import org.jdom.output.XMLOutputter;
import org.jdom.xpath.XPath;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
+
import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
+
public final class StockClient2 {
public static void main(String[] args) throws Exception {
if (args.length != 2) {
@@ -74,31 +75,13 @@ public final class StockClient2 {
System.out.println("Price = " + price.getText());
}
- private static class JDOMDataSource implements OMDataSource {
+ private static class JDOMDataSource extends AbstractPushOMDataSource {
private final Element data;
private JDOMDataSource(Element data) {
this.data = data;
}
- public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
- try {
- XMLOutputter outputter = new XMLOutputter();
- outputter.output(data, output);
- } catch (IOException e) {
- throw new XMLStreamException(e);
- }
- }
-
- public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException {
- try {
- XMLOutputter outputter = new XMLOutputter();
- outputter.output(data, writer);
- } catch (IOException e) {
- throw new XMLStreamException(e);
- }
- }
-
public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
StAXOutputter outputter = new StAXOutputter(xmlWriter);
try {
@@ -107,15 +90,5 @@ public final class StockClient2 {
throw new XMLStreamException(e);
}
}
-
- public XMLStreamReader getReader() throws XMLStreamException {
- SAXOMBuilder builder = new SAXOMBuilder();
- SAXOutputter outputter = new SAXOutputter();
- outputter.setContentHandler(builder);
- outputter.setEntityResolver(builder);
- outputter.setDTDHandler(builder);
- outputter.setEntityResolver(builder);
- return builder.getRootElement().getXMLStreamReader();
- }
}
}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/service/src/samples/databinding/StockQuoteServiceSkeleton.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/service/src/samples/databinding/StockQuoteServiceSkeleton.java?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/service/src/samples/databinding/StockQuoteServiceSkeleton.java (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/samples/databinding/service/src/samples/databinding/StockQuoteServiceSkeleton.java Sun Dec 17 22:34:08 2017
@@ -16,16 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-/**
- * StockQuoteServiceSkeleton.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis2 version: 1.1-SNAPSHOT Nov 03, 2006 (06:54:07 EST)
- */
package samples.databinding;
-import javanet.staxutils.StAXSource;
-import org.apache.axiom.om.impl.builder.SAXOMBuilder;
+
+import org.apache.axiom.om.OMDocument;
+import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.Marshaller;
@@ -34,6 +28,7 @@ import org.exolab.castor.xml.Unmarshalle
import org.exolab.castor.xml.ValidationException;
import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
+
import samples.databinding.data.Change;
import samples.databinding.data.GetStockQuote;
import samples.databinding.data.GetStockQuoteResponse;
@@ -43,6 +38,7 @@ import samples.databinding.data.Quote;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXResult;
+
import java.io.IOException;
import java.util.Calendar;
/**
@@ -54,15 +50,13 @@ public class StockQuoteServiceSkeleton {
*
* @param param0
*/
- public org.apache.axiom.om.OMElement getStockQuote(org.apache.axiom.om.OMElement param0) throws AxisFault {
- StAXSource staxSource =
- new StAXSource(param0.getXMLStreamReader());
+ public OMElement getStockQuote(OMElement param0) throws AxisFault {
Unmarshaller unmarshaller = new Unmarshaller(GetStockQuote.class);
UnmarshalHandler unmarshalHandler = unmarshaller.createHandler();
GetStockQuote stockQuote;
try {
ContentHandler contentHandler = Unmarshaller.getContentHandler(unmarshalHandler);
- TransformerFactory.newInstance().newTransformer().transform(staxSource, new SAXResult(contentHandler));
+ TransformerFactory.newInstance().newTransformer().transform(param0.getSAXSource(false), new SAXResult(contentHandler));
stockQuote = (GetStockQuote) unmarshalHandler.getObject();
} catch (SAXException e) {
throw new RuntimeException(e);
@@ -90,9 +84,10 @@ public class StockQuoteServiceSkeleton {
quote.setChange(change);
stockQuoteResponse.setQuote(quote);
- SAXOMBuilder builder = new SAXOMBuilder();
+
+ OMDocument document = param0.getOMFactory().createOMDocument();
try {
- Marshaller.marshal(stockQuoteResponse, builder);
+ Marshaller.marshal(stockQuoteResponse, document.getSAXResult().getHandler());
} catch (MarshalException e) {
throw new RuntimeException(e);
} catch (ValidationException e) {
@@ -100,7 +95,7 @@ public class StockQuoteServiceSkeleton {
} catch (IOException e) {
throw new RuntimeException(e);
}
- return builder.getRootElement();
+ return document.getOMDocumentElement();
}
}
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/samples/dynamicclient/server/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/samples/dynamicclient/server/pom.xml?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/samples/dynamicclient/server/pom.xml (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/samples/dynamicclient/server/pom.xml Sun Dec 17 22:34:08 2017
@@ -50,16 +50,6 @@
</dependencies>
<build>
<plugins>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
-
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>simple-server-maven-plugin</artifactId>
Propchange: axis/axis2/java/core/branches/AXIS2-4091/modules/samples/java_first_jaxws/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Dec 17 22:34:08 2017
@@ -1,2 +1,5 @@
+.classpath
+.project
+.settings
*.iml
target
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/samples/java_first_jaxws/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/samples/java_first_jaxws/pom.xml?rev=1818518&r1=1818517&r2=1818518&view=diff
==============================================================================
--- axis/axis2/java/core/branches/AXIS2-4091/modules/samples/java_first_jaxws/pom.xml (original)
+++ axis/axis2/java/core/branches/AXIS2-4091/modules/samples/java_first_jaxws/pom.xml Sun Dec 17 22:34:08 2017
@@ -17,14 +17,15 @@
~ under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.axis2.examples</groupId>
+ <parent>
+ <groupId>org.apache.axis2.examples</groupId>
+ <artifactId>samples</artifactId>
+ <version>1.8.0-SNAPSHOT</version>
+ </parent>
<artifactId>java_first_jaxws</artifactId>
<name>JAXWS - Starting from Java Example</name>
- <version>1.7.0-SNAPSHOT</version>
<packaging>war</packaging>
<inceptionYear>2004</inceptionYear>
@@ -38,22 +39,22 @@
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
- <version>1.7.0-SNAPSHOT</version>
+ <version>1.8.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-jaxws</artifactId>
- <version>1.7.0-SNAPSHOT</version>
+ <version>1.8.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-codegen</artifactId>
- <version>1.7.0-SNAPSHOT</version>
+ <version>1.8.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
- <version>1.7.0-SNAPSHOT</version>
+ <version>1.8.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
@@ -99,15 +100,6 @@
<build>
<plugins>
<plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.2</version>
- <configuration>
- <compilerVersion>1.5</compilerVersion>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
@@ -158,14 +150,4 @@
</testResource>
</testResources>
</build>
- <repositories>
- <repository>
- <id>apache.snapshots</id>
- <name>Apache Snapshot Repository</name>
- <url>http://repository.apache.org/snapshots</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- </repositories>
</project>