You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2007/03/04 19:17:07 UTC
svn commit: r514453 [2/26] - in
/webservices/axis2/trunk/java/modules/kernel: src/org/apache/axis2/
src/org/apache/axis2/addressing/ src/org/apache/axis2/addressing/wsdl/
src/org/apache/axis2/builder/ src/org/apache/axis2/client/
src/org/apache/axis2/c...
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java Sun Mar 4 10:16:54 2007
@@ -46,54 +46,61 @@
private static final Log log = LogFactory.getLog(EndpointReferenceHelper.class);
- private final static Map finalQNames = new IdentityHashMap();
+ private final static Map finalQNames = new IdentityHashMap();
private final static Map submissionQNames = new IdentityHashMap();
-
+
/**
* Populates an endpoint reference based on the <code>OMElement</code> and
* WS-Addressing namespace that is passed in. If the string passed in is not
* recognized as a valid WS-Addressing namespace then this method behaves as
* if http://www.w3.org/2005/08/addressing has been passed in.
- *
- * @param epr an endpoint reference instance to hold the info.
- * @param eprOMElement an element of endpoint reference type
+ *
+ * @param epr an endpoint reference instance to hold the info.
+ * @param eprOMElement an element of endpoint reference type
* @param addressingNamespace the namespace of the WS-Addressing spec to comply with.
* @throws AxisFault if unable to locate an address element
* @see #fromOM(OMElement)
*/
- public static void fromOM(EndpointReference epr, OMElement eprOMElement, String addressingNamespace) throws AxisFault {
+ public static void fromOM(EndpointReference epr, OMElement eprOMElement,
+ String addressingNamespace) throws AxisFault {
boolean isFinalAddressingNamespace = false;
Map map = null;
//First pass, identify the addressing namespace.
if (AddressingConstants.Submission.WSA_NAMESPACE.equals(addressingNamespace)) {
- OMElement address = eprOMElement.getFirstChildWithName((QName) submissionQNames.get(AddressingConstants.EPR_ADDRESS));
-
+ OMElement address = eprOMElement.getFirstChildWithName(
+ (QName) submissionQNames.get(AddressingConstants.EPR_ADDRESS));
+
if (address != null) {
map = submissionQNames;
isFinalAddressingNamespace = false;
-
- if (log.isDebugEnabled()){
- log.debug("fromOM: Found address element for namespace, " + AddressingConstants.Submission.WSA_NAMESPACE);
+
+ if (log.isDebugEnabled()) {
+ log.debug("fromOM: Found address element for namespace, " +
+ AddressingConstants.Submission.WSA_NAMESPACE);
}
} else {
- throw new AxisFault("Unable to locate an address element for the endpoint reference type.");
+ throw new AxisFault(
+ "Unable to locate an address element for the endpoint reference type.");
}
} else {
- OMElement address = eprOMElement.getFirstChildWithName((QName) finalQNames.get(AddressingConstants.EPR_ADDRESS));
-
+ OMElement address = eprOMElement.getFirstChildWithName(
+ (QName) finalQNames.get(AddressingConstants.EPR_ADDRESS));
+
if (address != null) {
map = finalQNames;
isFinalAddressingNamespace = true;
-
- if (log.isDebugEnabled()){
- log.debug("fromOM: Found address element for namespace, " + AddressingConstants.Final.WSA_NAMESPACE);
+
+ if (log.isDebugEnabled()) {
+ log.debug("fromOM: Found address element for namespace, " +
+ AddressingConstants.Final.WSA_NAMESPACE);
}
} else {
- throw new AxisFault("Unable to locate an address element for the endpoint reference type.");
+ throw new AxisFault(
+ "Unable to locate an address element for the endpoint reference type.");
}
}
-
+
//Second pass, identify the properties.
fromOM(epr, eprOMElement, map, isFinalAddressingNamespace);
}
@@ -110,57 +117,64 @@
*/
public static EndpointReference fromOM(String eprString) throws AxisFault {
try {
- return fromOM(new StAXOMBuilder(new ByteArrayInputStream(eprString.getBytes())).getDocumentElement());
+ return fromOM(new StAXOMBuilder(
+ new ByteArrayInputStream(eprString.getBytes())).getDocumentElement());
} catch (XMLStreamException e) {
throw new AxisFault(e);
}
}
+
/**
* Populates an endpoint reference based on the <code>OMElement</code> that is
* passed in. If the http://schemas.xmlsoap.org/ws/2004/08/addressing namespace
* is in effect then any reference properties will be saved as reference parameters.
* Regardless of the addressing namespace in effect, any elements present in the
* <code>OMElement</code> that are not recognised are saved as extensibility elements.
- *
- * @param eprOMElement an element of endpoint reference type
+ *
+ * @param eprOMElement an element of endpoint reference type
* @throws AxisFault if unable to locate an address element
*/
public static EndpointReference fromOM(OMElement eprOMElement) throws AxisFault {
EndpointReference epr = new EndpointReference("");
boolean isFinalAddressingNamespace = false;
Map map = null;
-
+
//First pass, identify the addressing namespace.
- OMElement address = eprOMElement.getFirstChildWithName((QName) finalQNames.get(AddressingConstants.EPR_ADDRESS));
-
+ OMElement address = eprOMElement
+ .getFirstChildWithName((QName) finalQNames.get(AddressingConstants.EPR_ADDRESS));
+
if (address != null) {
map = finalQNames;
isFinalAddressingNamespace = true;
-
- if (log.isDebugEnabled()){
- log.debug("fromOM: Found address element for namespace, " + AddressingConstants.Final.WSA_NAMESPACE);
+
+ if (log.isDebugEnabled()) {
+ log.debug("fromOM: Found address element for namespace, " +
+ AddressingConstants.Final.WSA_NAMESPACE);
}
} else {
- address = eprOMElement.getFirstChildWithName((QName) submissionQNames.get(AddressingConstants.EPR_ADDRESS));
-
+ address = eprOMElement.getFirstChildWithName(
+ (QName) submissionQNames.get(AddressingConstants.EPR_ADDRESS));
+
if (address != null) {
map = submissionQNames;
isFinalAddressingNamespace = false;
-
- if (log.isDebugEnabled()){
- log.debug("fromOM: Found address element for namespace, " + AddressingConstants.Submission.WSA_NAMESPACE);
+
+ if (log.isDebugEnabled()) {
+ log.debug("fromOM: Found address element for namespace, " +
+ AddressingConstants.Submission.WSA_NAMESPACE);
}
} else {
- throw new AxisFault("Unable to locate an address element for the endpoint reference type.");
+ throw new AxisFault(
+ "Unable to locate an address element for the endpoint reference type.");
}
}
-
+
//Second pass, identify the properties.
fromOM(epr, eprOMElement, map, isFinalAddressingNamespace);
-
+
return epr;
}
-
+
/**
* Creates an <code>OMElement</code> based on the properties of the endpoint
* reference. The output may differ based on the addressing namespace that is
@@ -170,7 +184,7 @@
* property in the output. If the http://schemas.xmlsoap.org/ws/2004/08/addressing
* namespace is in effect, however, then no metadata element will be included
* in the output, even if a metadata property element has been defined.
- *
+ *
* @param factory
* @param epr
* @param qname
@@ -178,33 +192,38 @@
* @return
* @throws AxisFault
*/
- public static OMElement toOM(OMFactory factory, EndpointReference epr, QName qname, String addressingNamespace) throws AxisFault {
+ public static OMElement toOM(OMFactory factory, EndpointReference epr, QName qname,
+ String addressingNamespace) throws AxisFault {
OMElement eprElement = null;
-
+
if (log.isDebugEnabled()) {
log.debug("toOM: Factory, " + factory);
log.debug("toOM: Endpoint reference, " + epr);
log.debug("toOM: Element qname, " + qname);
log.debug("toOM: Addressing namespace, " + addressingNamespace);
}
-
+
if (addressingNamespace == null) {
throw new AxisFault("Addressing namespace cannot be null.");
}
-
+
if (qname.getPrefix() != null) {
- OMNamespace wrapNs = factory.createOMNamespace(qname.getNamespaceURI(), qname.getPrefix());
- if (factory instanceof SOAPFactory){
- eprElement = ((SOAPFactory) factory).createSOAPHeaderBlock(qname.getLocalPart(), wrapNs);
- }else{
+ OMNamespace wrapNs =
+ factory.createOMNamespace(qname.getNamespaceURI(), qname.getPrefix());
+ if (factory instanceof SOAPFactory) {
+ eprElement =
+ ((SOAPFactory) factory).createSOAPHeaderBlock(qname.getLocalPart(), wrapNs);
+ } else {
eprElement = factory.createOMElement(qname.getLocalPart(), wrapNs);
}
-
- OMNamespace wsaNS = factory.createOMNamespace(addressingNamespace, AddressingConstants.WSA_DEFAULT_PREFIX);
- OMElement addressE = factory.createOMElement(AddressingConstants.EPR_ADDRESS, wsaNS, eprElement);
+
+ OMNamespace wsaNS = factory.createOMNamespace(addressingNamespace,
+ AddressingConstants.WSA_DEFAULT_PREFIX);
+ OMElement addressE =
+ factory.createOMElement(AddressingConstants.EPR_ADDRESS, wsaNS, eprElement);
String address = epr.getAddress();
addressE.setText(address);
-
+
ArrayList addressAttributes = epr.getAddressAttributes();
if (addressAttributes != null) {
Iterator attrIter = addressAttributes.iterator();
@@ -213,15 +232,17 @@
addressE.addAttribute(omAttributes);
}
}
-
+
List metaData = epr.getMetaData();
- if (metaData != null && AddressingConstants.Final.WSA_NAMESPACE.equals(addressingNamespace)) {
- OMElement metadataE = factory.createOMElement(AddressingConstants.Final.WSA_METADATA, wsaNS, eprElement);
+ if (metaData != null &&
+ AddressingConstants.Final.WSA_NAMESPACE.equals(addressingNamespace)) {
+ OMElement metadataE = factory.createOMElement(
+ AddressingConstants.Final.WSA_METADATA, wsaNS, eprElement);
for (int i = 0, size = metaData.size(); i < size; i++) {
OMElement omElement = (OMElement) metaData.get(i);
metadataE.addChild(ElementHelper.importOMElement(omElement, factory));
}
-
+
ArrayList metadataAttributes = epr.getMetadataAttributes();
if (metadataAttributes != null) {
Iterator attrIter = metadataAttributes.iterator();
@@ -232,18 +253,18 @@
}
}
-
-
+
Map referenceParameters = epr.getAllReferenceParameters();
if (referenceParameters != null) {
- OMElement refParameterElement = factory.createOMElement(AddressingConstants.EPR_REFERENCE_PARAMETERS, wsaNS, eprElement);
+ OMElement refParameterElement = factory.createOMElement(
+ AddressingConstants.EPR_REFERENCE_PARAMETERS, wsaNS, eprElement);
Iterator iterator = referenceParameters.values().iterator();
while (iterator.hasNext()) {
OMElement omElement = (OMElement) iterator.next();
refParameterElement.addChild(ElementHelper.importOMElement(omElement, factory));
}
}
-
+
List attributes = epr.getAttributes();
if (attributes != null) {
for (int i = 0, size = attributes.size(); i < size; i++) {
@@ -251,7 +272,7 @@
AttributeHelper.importOMAttribute(omAttribute, eprElement);
}
}
-
+
// add xs:any
List extensibleElements = epr.getExtensibleElements();
if (extensibleElements != null) {
@@ -263,17 +284,18 @@
} else {
throw new AxisFault("prefix must be specified");
}
-
+
return eprElement;
}
-
- private static void fromOM(EndpointReference epr, OMElement eprOMElement, Map map, boolean isFinalAddressingNamespace) {
+
+ private static void fromOM(EndpointReference epr, OMElement eprOMElement, Map map,
+ boolean isFinalAddressingNamespace) {
Iterator childElements = eprOMElement.getChildElements();
-
+
while (childElements.hasNext()) {
OMElement eprChildElement = (OMElement) childElements.next();
QName qname = eprChildElement.getQName();
-
+
if (map.get(AddressingConstants.EPR_ADDRESS).equals(qname)) {
//We need to identify the address element again in order to ensure
//that it is not included with the extensibility elements.
@@ -306,7 +328,8 @@
}
epr.setMetadataAttributes(metadataAttributes);
} else if (!isFinalAddressingNamespace &&
- map.get(AddressingConstants.Submission.EPR_REFERENCE_PROPERTIES).equals(qname)) {
+ map.get(AddressingConstants.Submission.EPR_REFERENCE_PROPERTIES).equals(qname))
+ {
// since we have the model for WS-Final, we don't have a place to keep this reference properties.
// The only compatible place is reference properties
Iterator iterator = eprChildElement.getChildElements();
@@ -324,19 +347,28 @@
OMAttribute attribute = (OMAttribute) attributes.next();
epr.addAttribute(attribute);
}
-
+
if (log.isDebugEnabled()) {
log.debug("fromOM: Endpoint reference, " + epr);
}
}
static {
- finalQNames.put(AddressingConstants.EPR_ADDRESS, new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_ADDRESS));
- finalQNames.put(AddressingConstants.EPR_REFERENCE_PARAMETERS, new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_REFERENCE_PARAMETERS));
- finalQNames.put(AddressingConstants.Final.WSA_METADATA, new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.Final.WSA_METADATA));
-
- submissionQNames.put(AddressingConstants.EPR_ADDRESS, new QName(AddressingConstants.Submission.WSA_NAMESPACE, AddressingConstants.EPR_ADDRESS));
- submissionQNames.put(AddressingConstants.EPR_REFERENCE_PARAMETERS, new QName(AddressingConstants.Submission.WSA_NAMESPACE, AddressingConstants.EPR_REFERENCE_PARAMETERS));
- submissionQNames.put(AddressingConstants.Submission.EPR_REFERENCE_PROPERTIES, new QName(AddressingConstants.Submission.WSA_NAMESPACE, AddressingConstants.Submission.EPR_REFERENCE_PROPERTIES));
+ finalQNames.put(AddressingConstants.EPR_ADDRESS, new QName(
+ AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_ADDRESS));
+ finalQNames.put(AddressingConstants.EPR_REFERENCE_PARAMETERS, new QName(
+ AddressingConstants.Final.WSA_NAMESPACE,
+ AddressingConstants.EPR_REFERENCE_PARAMETERS));
+ finalQNames.put(AddressingConstants.Final.WSA_METADATA, new QName(
+ AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.Final.WSA_METADATA));
+
+ submissionQNames.put(AddressingConstants.EPR_ADDRESS, new QName(
+ AddressingConstants.Submission.WSA_NAMESPACE, AddressingConstants.EPR_ADDRESS));
+ submissionQNames.put(AddressingConstants.EPR_REFERENCE_PARAMETERS, new QName(
+ AddressingConstants.Submission.WSA_NAMESPACE,
+ AddressingConstants.EPR_REFERENCE_PARAMETERS));
+ submissionQNames.put(AddressingConstants.Submission.EPR_REFERENCE_PROPERTIES, new QName(
+ AddressingConstants.Submission.WSA_NAMESPACE,
+ AddressingConstants.Submission.EPR_REFERENCE_PROPERTIES));
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/RelatesTo.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/RelatesTo.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/RelatesTo.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/RelatesTo.java Sun Mar 4 10:16:54 2007
@@ -51,10 +51,10 @@
private static final long serialVersionUID = -1120384315333414960L;
/**
- * @serial Tracks the revision level of a class to identify changes to the
+ * @serial Tracks the revision level of a class to identify changes to the
* class definition that are compatible to serialization/externalization.
* If a class definition changes, then the serialization/externalization
- * of the class is affected.
+ * of the class is affected.
* Refer to the writeExternal() and readExternal() methods.
*/
// supported revision levels, add a new level to manage compatible changes
@@ -62,7 +62,6 @@
// current revision level of this object
private static final int revisionID = REVISION_1;
-
/**
* Field relationshipType
@@ -75,7 +74,7 @@
private String value;
private ArrayList extensibilityAttributes = null;
-
+
/**
* Constructor RelatesTo
*/
@@ -107,9 +106,9 @@
* the default value {@link AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE}
*/
public String getRelationshipType() {
- return (relationshipType != null && !"".equals(relationshipType)?
- relationshipType :
- AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE);
+ return (relationshipType != null && !"".equals(relationshipType) ?
+ relationshipType :
+ AddressingConstants.Final.WSA_DEFAULT_RELATIONSHIP_TYPE);
}
/**
@@ -136,7 +135,7 @@
public void setValue(String value) {
this.value = value;
}
-
+
public ArrayList getExtensibilityAttributes() {
return extensibilityAttributes;
}
@@ -144,28 +143,27 @@
public void setExtensibilityAttributes(ArrayList extensibilityAttributes) {
this.extensibilityAttributes = extensibilityAttributes;
}
-
+
/*
- * (non-Javadoc)
- * @see java.lang.Object#toString()
- */
+ * (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
public String toString() {
return "Identifier: " + value
- + ", Relationship type: " + relationshipType;
+ + ", Relationship type: " + relationshipType;
}
-
/* ===============================================================
- * Externalizable support
- * ===============================================================
- */
-
+ * Externalizable support
+ * ===============================================================
+ */
+
/**
* Save the contents of this object.
* <p/>
* NOTE: Transient fields and static fields are not saved.
*
- * @param out The stream to write the object contents to
+ * @param out The stream to write the object contents to
* @throws IOException
*/
public void writeExternal(ObjectOutput out) throws IOException {
@@ -203,20 +201,21 @@
// collections and lists
//---------------------------------------------------------
- ObjectStateUtils.writeArrayList(out, extensibilityAttributes, "RelatesTo.extensibilityAttributes");
+ ObjectStateUtils
+ .writeArrayList(out, extensibilityAttributes, "RelatesTo.extensibilityAttributes");
}
/**
- * Restore the contents of the object that was
- * previously saved.
+ * Restore the contents of the object that was
+ * previously saved.
* <p/>
* NOTE: The field data must read back in the same order and type
- * as it was written. Some data will need to be validated when
+ * as it was written. Some data will need to be validated when
* resurrected.
*
- * @param in The stream to read the object contents from
+ * @param in The stream to read the object contents from
* @throws IOException
* @throws ClassNotFoundException
*/
@@ -225,7 +224,7 @@
long suid = in.readLong();
// revision ID
- int revID = in.readInt();
+ int revID = in.readInt();
// make sure the object data is in a version we can handle
if (suid != serialVersionUID) {
@@ -237,13 +236,12 @@
throw new ClassNotFoundException(ObjectStateUtils.UNSUPPORTED_REVID);
}
-
//---------------------------------------------------------
// various strings
//---------------------------------------------------------
// String relationshipType
- relationshipType = ObjectStateUtils.readString(in,"RelatesTo.relationshipType");
+ relationshipType = ObjectStateUtils.readString(in, "RelatesTo.relationshipType");
// String value
value = ObjectStateUtils.readString(in, "RelatesTo.value");
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/ServiceName.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/ServiceName.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/ServiceName.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/ServiceName.java Sun Mar 4 10:16:54 2007
@@ -21,7 +21,7 @@
/**
* @deprecated I don't think this class is used anywhere. Shout if this is not the case.
- * Class ServiceName
+ * Class ServiceName
*/
public class ServiceName {
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11ActionHelper.java Sun Mar 4 10:16:54 2007
@@ -36,117 +36,144 @@
* Default Action Pattern for WSDL1.1 at http://www.w3.org/TR/2006/WD-ws-addr-wsdl-20060216/#defactionwsdl11
*/
public class WSDL11ActionHelper {
-
+
private static final Log log = LogFactory.getLog(WSDL11ActionHelper.class);
- private static final QName submissionWSAWNS = new QName(AddressingConstants.Submission.WSA_NAMESPACE, AddressingConstants.WSA_ACTION);
- private static final QName finalWSANS = new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_ACTION);
- private static final QName finalWSAWNS = new QName(AddressingConstants.Final.WSAW_NAMESPACE, AddressingConstants.WSA_ACTION);
-
+ private static final QName submissionWSAWNS =
+ new QName(AddressingConstants.Submission.WSA_NAMESPACE, AddressingConstants.WSA_ACTION);
+ private static final QName finalWSANS =
+ new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_ACTION);
+ private static final QName finalWSAWNS =
+ new QName(AddressingConstants.Final.WSAW_NAMESPACE, AddressingConstants.WSA_ACTION);
+
/**
* getActionFromInputElement
*
- * @param def the wsdl:definitions which contains the wsdl:portType
+ * @param def the wsdl:definitions which contains the wsdl:portType
* @param wsdl4jPortType the wsdl:portType which contains the wsdl:operation
- * @param op the wsdl:operation which contains the input element
- * @param input the input element to be examined to generate the wsa:Action
+ * @param op the wsdl:operation which contains the input element
+ * @param input the input element to be examined to generate the wsa:Action
* @return either the wsaw:Action from the input element or an action generated using the DefaultActionPattern
*/
- public static String getActionFromInputElement(Definition def, PortType wsdl4jPortType, Operation op, Input input){
+ public static String getActionFromInputElement(Definition def, PortType wsdl4jPortType,
+ Operation op, Input input) {
String result = getWSAWActionExtensionAttribute(input);
- if(result == null){
- result = WSDL11DefaultActionPatternHelper.generateActionFromInputElement(def, wsdl4jPortType, op, input);
+ if (result == null) {
+ result = WSDL11DefaultActionPatternHelper
+ .generateActionFromInputElement(def, wsdl4jPortType, op, input);
}
log.trace(result);
return result;
}
-
+
/**
* getActionFromOutputElement
*
- * @param def the wsdl:definitions which contains the wsdl:portType
+ * @param def the wsdl:definitions which contains the wsdl:portType
* @param wsdl4jPortType the wsdl:portType which contains the wsdl:operation
- * @param op the wsdl:operation which contains the output element
- * @param output the input element to be examined to generate the wsa:Action
+ * @param op the wsdl:operation which contains the output element
+ * @param output the input element to be examined to generate the wsa:Action
* @return either the wsaw:Action from the output element or an action generated using the DefaultActionPattern
*/
- public static String getActionFromOutputElement(Definition def, PortType wsdl4jPortType, Operation op, Output output){
+ public static String getActionFromOutputElement(Definition def, PortType wsdl4jPortType,
+ Operation op, Output output) {
String result = getWSAWActionExtensionAttribute(output);
- if(result == null){
- result = WSDL11DefaultActionPatternHelper.generateActionFromOutputElement(def, wsdl4jPortType, op, output);
+ if (result == null) {
+ result = WSDL11DefaultActionPatternHelper
+ .generateActionFromOutputElement(def, wsdl4jPortType, op, output);
}
log.trace(result);
return result;
}
-
+
/**
* getActionFromFaultElement
*
- * @param def the wsdl:definitions which contains the wsdl:portType
+ * @param def the wsdl:definitions which contains the wsdl:portType
* @param wsdl4jPortType the wsdl:portType which contains the wsdl:operation
- * @param op the wsdl:operation which contains the fault element
- * @param fault the fault element to be examined to generate the wsa:Action
+ * @param op the wsdl:operation which contains the fault element
+ * @param fault the fault element to be examined to generate the wsa:Action
* @return either the wsaw:Action from the fault element or an action generated using the DefaultActionPattern
*/
- public static String getActionFromFaultElement(Definition def, PortType wsdl4jPortType, Operation op, Fault fault){
+ public static String getActionFromFaultElement(Definition def, PortType wsdl4jPortType,
+ Operation op, Fault fault) {
String result = getWSAWActionExtensionAttribute(fault);
- if(result == null){
- result = WSDL11DefaultActionPatternHelper.generateActionFromFaultElement(def, wsdl4jPortType, op, fault);
+ if (result == null) {
+ result = WSDL11DefaultActionPatternHelper
+ .generateActionFromFaultElement(def, wsdl4jPortType, op, fault);
}
log.trace(result);
return result;
}
-
- private static String getWSAWActionExtensionAttribute(AttributeExtensible ae){
+
+ private static String getWSAWActionExtensionAttribute(AttributeExtensible ae) {
// Search first for a wsaw:Action using the submission namespace
Object attribute = ae.getExtensionAttribute(submissionWSAWNS);
// Then if that did not exist one using the w3c namespace
- if(attribute == null){
+ if (attribute == null) {
attribute = ae.getExtensionAttribute(finalWSAWNS);
}
// Then finally if that did not exist, try the 2005/08 NS
// (Included here because it's needed for Apache Muse)
- if(attribute == null){
+ if (attribute == null) {
attribute = ae.getExtensionAttribute(finalWSANS);
}
-
+
// wsdl4j may return a String, QName or a List of either
// If it is a list, extract the first element
- if(attribute instanceof List){
- List l = (List)attribute;
- if(l.size()>0){
+ if (attribute instanceof List) {
+ List l = (List) attribute;
+ if (l.size() > 0) {
attribute = l.get(0);
- }else{
+ } else {
attribute = null;
}
}
-
+
// attribute must now be a QName or String or null
// If it is a QName, take the LocalPart as a String
- if(attribute instanceof QName){
- QName qn = (QName)attribute;
+ if (attribute instanceof QName) {
+ QName qn = (QName) attribute;
attribute = qn.getLocalPart();
}
-
- if((attribute instanceof String)) {
- String result = (String)attribute;
+
+ if ((attribute instanceof String)) {
+ String result = (String) attribute;
log.trace(result);
return result;
} else {
- if(log.isTraceEnabled()){
+ if (log.isTraceEnabled()) {
log.trace("No wsaw:Action attribute found");
}
return null;
}
}
-
- public static String getInputActionFromStringInformation(String messageExchangePattern, String targetNamespace, String portTypeName, String operationName, String inputName){
- return WSDL11DefaultActionPatternHelper.getInputActionFromStringInformation(messageExchangePattern, targetNamespace, portTypeName, operationName, inputName);
+
+ public static String getInputActionFromStringInformation(String messageExchangePattern,
+ String targetNamespace,
+ String portTypeName,
+ String operationName,
+ String inputName) {
+ return WSDL11DefaultActionPatternHelper.getInputActionFromStringInformation(
+ messageExchangePattern, targetNamespace, portTypeName, operationName, inputName);
+ }
+
+ public static String getOutputActionFromStringInformation(String messageExchangePattern,
+ String targetNamespace,
+ String portTypeName,
+ String operationName,
+ String outputName) {
+ return WSDL11DefaultActionPatternHelper.getOutputActionFromStringInformation(
+ messageExchangePattern, targetNamespace, portTypeName, operationName, outputName);
+ }
+
+ public static String getFaultActionFromStringInformation(String targetNamespace,
+ String portTypeName,
+ String operationName,
+ String faultName) {
+ return WSDL11DefaultActionPatternHelper.getFaultActionFromStringInformation(targetNamespace,
+ portTypeName,
+ operationName,
+ faultName);
}
- public static String getOutputActionFromStringInformation(String messageExchangePattern, String targetNamespace, String portTypeName, String operationName, String outputName){
- return WSDL11DefaultActionPatternHelper.getOutputActionFromStringInformation(messageExchangePattern, targetNamespace, portTypeName, operationName, outputName);
- }
- public static String getFaultActionFromStringInformation(String targetNamespace, String portTypeName, String operationName, String faultName){
- return WSDL11DefaultActionPatternHelper.getFaultActionFromStringInformation(targetNamespace, portTypeName, operationName, faultName);
- }
-
+
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/wsdl/WSDL11DefaultActionPatternHelper.java Sun Mar 4 10:16:54 2007
@@ -31,9 +31,9 @@
* http://www.w3.org/TR/2006/WD-ws-addr-wsdl-20060216/#defactionwsdl11
*/
public class WSDL11DefaultActionPatternHelper {
-
+
private static final Log log = LogFactory.getLog(WSDL11DefaultActionPatternHelper.class);
-
+
// String constants used extensively in this class
private static final String URN = "urn";
private static final String SLASH = "/";
@@ -42,57 +42,58 @@
private static final String RESPONSE = "Response";
private static final String SOLICIT = "Solicit";
private static final String FAULT = "Fault";
-
+
/**
* Generate the Action for an Input using the Default Action Pattern
* <p/>
* Pattern is defined as [target namespace][delimiter][port type name][delimiter][input name]
- *
- * @param def is required to obtain the targetNamespace
+ *
+ * @param def is required to obtain the targetNamespace
* @param wsdl4jPortType is required to obtain the portType name
- * @param op is required to generate the input name if not explicitly specified
- * @param input is required for its name if specified
+ * @param op is required to generate the input name if not explicitly specified
+ * @param input is required for its name if specified
* @return a wsa:Action value based on the Default Action Pattern and the provided objects
*/
- public static String generateActionFromInputElement(Definition def, PortType wsdl4jPortType, Operation op, Input input){
+ public static String generateActionFromInputElement(Definition def, PortType wsdl4jPortType,
+ Operation op, Input input) {
// Get the targetNamespace of the wsdl:definitions
String targetNamespace = def.getTargetNamespace();
-
+
// Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/".
// Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/"
// character), the default action value may not conform to the rules of the IRI scheme. Authors
// are advised to specify explicit values in the WSDL in this case.'
String delimiter = SLASH;
- if(targetNamespace.toLowerCase().startsWith(URN)){
+ if (targetNamespace.toLowerCase().startsWith(URN)) {
delimiter = COLON;
}
-
+
// Get the portType name (as a string to be included in the action)
String portTypeName = wsdl4jPortType.getQName().getLocalPart();
// Get the name of the input element (and generate one if none explicitly specified)
String inputName = getNameFromInputElement(op, input);
-
+
// Append the bits together
StringBuffer sb = new StringBuffer();
sb.append(targetNamespace);
// Deal with the problem that the targetNamespace may or may not have a trailing delimiter
- if(!targetNamespace.endsWith(delimiter)){
+ if (!targetNamespace.endsWith(delimiter)) {
sb.append(delimiter);
}
sb.append(portTypeName);
sb.append(delimiter);
sb.append(inputName);
-
+
// Resolve the action from the StringBuffer
String result = sb.toString();
-
- if(log.isTraceEnabled()){
- log.trace("generateActionFromInputElement result: "+result);
+
+ if (log.isTraceEnabled()) {
+ log.trace("generateActionFromInputElement result: " + result);
}
-
+
return result;
}
-
+
/**
* Get the name of the specified Input element using the rules defined in WSDL 1.1
* Section 2.4.5 http://www.w3.org/TR/wsdl#_names
@@ -100,119 +101,125 @@
private static String getNameFromInputElement(Operation op, Input input) {
// Get the name from the input element if specified.
String result = input.getName();
-
+
// If not we'll have to generate it.
if (result == null) {
// If Request-Response or Solicit-Response do something special per
// WSDL 1.1 Section 2.4.5
OperationType operationType = op.getStyle();
if (null != operationType) {
- if (operationType.equals(OperationType.REQUEST_RESPONSE)){
+ if (operationType.equals(OperationType.REQUEST_RESPONSE)) {
result = op.getName() + REQUEST;
- }else if (operationType.equals(OperationType.SOLICIT_RESPONSE)){
+ } else if (operationType.equals(OperationType.SOLICIT_RESPONSE)) {
result = op.getName() + RESPONSE;
}
}
// If the OperationType was not available for some reason, assume on-way or notification
- if(result == null){
+ if (result == null) {
result = op.getName();
}
}
return result;
}
-
- protected static String getInputActionFromStringInformation(String messageExchangePattern, String targetNamespace, String portTypeName, String operationName, String inputName){
- if(messageExchangePattern == null && inputName == null){
- throw new IllegalArgumentException("One of messageExchangePattern or inputName must the non-null to generate an action.");
+
+ protected static String getInputActionFromStringInformation(String messageExchangePattern,
+ String targetNamespace,
+ String portTypeName,
+ String operationName,
+ String inputName) {
+ if (messageExchangePattern == null && inputName == null) {
+ throw new IllegalArgumentException(
+ "One of messageExchangePattern or inputName must the non-null to generate an action.");
}
-
+
// Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/".
// Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/"
// character), the default action value may not conform to the rules of the IRI scheme. Authors
// are advised to specify explicit values in the WSDL in this case.'
String delimiter = SLASH;
- if(targetNamespace.toLowerCase().startsWith(URN)){
+ if (targetNamespace.toLowerCase().startsWith(URN)) {
delimiter = COLON;
}
-
- if(inputName == null){
+
+ if (inputName == null) {
inputName = operationName;
- if(messageExchangePattern.indexOf("in-out")>=0){
- inputName+=REQUEST;
+ if (messageExchangePattern.indexOf("in-out") >= 0) {
+ inputName += REQUEST;
}
}
-
+
// Append the bits together
StringBuffer sb = new StringBuffer();
sb.append(targetNamespace);
// Deal with the problem that the targetNamespace may or may not have a trailing delimiter
- if(!targetNamespace.endsWith(delimiter)){
+ if (!targetNamespace.endsWith(delimiter)) {
sb.append(delimiter);
}
sb.append(portTypeName);
sb.append(delimiter);
sb.append(inputName);
-
+
// Resolve the action from the StringBuffer
String result = sb.toString();
-
- if(log.isTraceEnabled()){
- log.trace("getInputActionFromStringInformation result: "+result);
+
+ if (log.isTraceEnabled()) {
+ log.trace("getInputActionFromStringInformation result: " + result);
}
-
+
return result;
}
-
+
/**
* Generate the Action for an Output using the Default Action Pattern
* <p/>
* Pattern is defined as [target namespace][delimiter][port type name][delimiter][output name]
- *
- * @param def is required to obtain the targetNamespace
+ *
+ * @param def is required to obtain the targetNamespace
* @param wsdl4jPortType is required to obtain the portType name
- * @param op is required to generate the output name if not explicitly specified
- * @param output is required for its name if specified
+ * @param op is required to generate the output name if not explicitly specified
+ * @param output is required for its name if specified
* @return a wsa:Action value based on the Default Action Pattern and the provided objects
*/
- public static String generateActionFromOutputElement(Definition def, PortType wsdl4jPortType, Operation op, Output output){
+ public static String generateActionFromOutputElement(Definition def, PortType wsdl4jPortType,
+ Operation op, Output output) {
// Get the targetNamespace of the wsdl:definition
String targetNamespace = def.getTargetNamespace();
-
+
// Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/".
// Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/"
// character), the default action value may not conform to the rules of the IRI scheme. Authors
// are advised to specify explicit values in the WSDL in this case.'
String delimiter = SLASH;
- if(targetNamespace.toLowerCase().startsWith(URN)){
+ if (targetNamespace.toLowerCase().startsWith(URN)) {
delimiter = COLON;
}
-
+
// Get the portType name (as a string to be included in the action)
String portTypeName = wsdl4jPortType.getQName().getLocalPart();
// Get the name of the output element (and generate one if none explicitly specified)
String outputName = getNameFromOutputElement(op, output);
-
+
// Append the bits together
StringBuffer sb = new StringBuffer();
sb.append(targetNamespace);
// Deal with the problem that the targetNamespace may or may not have a trailing delimiter
- if(!targetNamespace.endsWith(delimiter)){
+ if (!targetNamespace.endsWith(delimiter)) {
sb.append(delimiter);
}
sb.append(portTypeName);
sb.append(delimiter);
sb.append(outputName);
-
+
// Resolve the action from the StringBuffer
String result = sb.toString();
-
- if(log.isTraceEnabled()){
- log.trace("generateActionFromOutputElement result: "+result);
+
+ if (log.isTraceEnabled()) {
+ log.trace("generateActionFromOutputElement result: " + result);
}
-
+
return result;
}
-
+
/**
* Get the name of the specified Output element using the rules defined in WSDL 1.1
* Section 2.4.5 http://www.w3.org/TR/wsdl#_names
@@ -220,81 +227,87 @@
private static String getNameFromOutputElement(Operation op, Output output) {
// Get the name from the output element if specified.
String result = output.getName();
-
+
// If not we'll have to generate it.
if (result == null) {
// If Request-Response or Solicit-Response do something special per
// WSDL 1.1 Section 2.4.5
OperationType operationType = op.getStyle();
if (null != operationType) {
- if (operationType.equals(OperationType.REQUEST_RESPONSE)){
+ if (operationType.equals(OperationType.REQUEST_RESPONSE)) {
return op.getName() + RESPONSE;
- }else if (operationType.equals(OperationType.SOLICIT_RESPONSE)){
+ } else if (operationType.equals(OperationType.SOLICIT_RESPONSE)) {
return op.getName() + SOLICIT;
}
}
// If the OperationType was not available for some reason, assume on-way or notification
- if(result == null){
+ if (result == null) {
result = op.getName();
}
}
return result;
}
-
- protected static String getOutputActionFromStringInformation(String messageExchangePattern, String targetNamespace, String portTypeName, String operationName, String outputName){
- if(messageExchangePattern == null && outputName == null){
- throw new IllegalArgumentException("One of messageExchangePattern or outputName must the non-null to generate an action.");
+
+ protected static String getOutputActionFromStringInformation(String messageExchangePattern,
+ String targetNamespace,
+ String portTypeName,
+ String operationName,
+ String outputName) {
+ if (messageExchangePattern == null && outputName == null) {
+ throw new IllegalArgumentException(
+ "One of messageExchangePattern or outputName must the non-null to generate an action.");
}
-
+
// Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/".
// Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/"
// character), the default action value may not conform to the rules of the IRI scheme. Authors
// are advised to specify explicit values in the WSDL in this case.'
String delimiter = SLASH;
- if(targetNamespace.toLowerCase().startsWith(URN)){
+ if (targetNamespace.toLowerCase().startsWith(URN)) {
delimiter = COLON;
}
-
- if(outputName == null){
+
+ if (outputName == null) {
outputName = operationName;
- if(messageExchangePattern.indexOf("in-out")>=0){
- outputName+=RESPONSE;
+ if (messageExchangePattern.indexOf("in-out") >= 0) {
+ outputName += RESPONSE;
}
}
-
+
// Append the bits together
StringBuffer sb = new StringBuffer();
sb.append(targetNamespace);
// Deal with the problem that the targetNamespace may or may not have a trailing delimiter
- if(!targetNamespace.endsWith(delimiter)){
+ if (!targetNamespace.endsWith(delimiter)) {
sb.append(delimiter);
}
sb.append(portTypeName);
sb.append(delimiter);
sb.append(outputName);
-
+
// Resolve the action from the StringBuffer
String result = sb.toString();
-
- if(log.isTraceEnabled()){
- log.trace("getOutputActionFromStringInformation result: "+result);
+
+ if (log.isTraceEnabled()) {
+ log.trace("getOutputActionFromStringInformation result: " + result);
}
-
+
return result;
}
-
+
/**
* Generate the Action for a Fault using the Default Action Pattern
* <p/>
* Pattern is defined as [target namespace][delimiter][port type name][delimiter][operation name][delimiter]Fault[delimiter][fault name]
- *
- * @param def is required to obtain the targetNamespace
+ *
+ * @param def is required to obtain the targetNamespace
* @param wsdl4jPortType is required to obtain the portType name
- * @param op is required to obtain the operation name
- * @param fault is required to obtain the fault name
+ * @param op is required to obtain the operation name
+ * @param fault is required to obtain the fault name
* @return a wsa:Action value based on the Default Action Pattern and the provided objects
*/
- public static String generateActionFromFaultElement(Definition def, PortType wsdl4jPortType, Operation op, Fault fault){
+ public static String generateActionFromFaultElement(Definition def, PortType wsdl4jPortType,
+ Operation op, Fault fault) {
// Get the targetNamespace of the wsdl:definition
String targetNamespace = def.getTargetNamespace();
@@ -303,23 +316,23 @@
// character), the default action value may not conform to the rules of the IRI scheme. Authors
// are advised to specify explicit values in the WSDL in this case.'
String delimiter = SLASH;
- if(targetNamespace.toLowerCase().startsWith(URN)){
+ if (targetNamespace.toLowerCase().startsWith(URN)) {
delimiter = COLON;
}
-
+
// Get the portType name (as a string to be included in the action)
String portTypeName = wsdl4jPortType.getQName().getLocalPart();
// Get the operation name (as a string to be included in the action)
String operationName = op.getName();
-
+
// Get the name of the fault element (name is mandatory on fault elements)
String faultName = fault.getName();
-
+
// Append the bits together
StringBuffer sb = new StringBuffer();
sb.append(targetNamespace);
// Deal with the problem that the targetNamespace may or may not have a trailing delimiter
- if(!targetNamespace.endsWith(delimiter)){
+ if (!targetNamespace.endsWith(delimiter)) {
sb.append(delimiter);
}
sb.append(portTypeName);
@@ -329,32 +342,35 @@
sb.append(FAULT);
sb.append(delimiter);
sb.append(faultName);
-
+
// Resolve the action from the StringBuffer
String result = sb.toString();
-
- if(log.isTraceEnabled()){
- log.trace("generateActionFromFaultElement result: "+result);
+
+ if (log.isTraceEnabled()) {
+ log.trace("generateActionFromFaultElement result: " + result);
}
-
+
return result;
}
-
- protected static String getFaultActionFromStringInformation(String targetNamespace, String portTypeName, String operationName, String faultName){
+
+ protected static String getFaultActionFromStringInformation(String targetNamespace,
+ String portTypeName,
+ String operationName,
+ String faultName) {
// Determine the delimiter. Per the spec: 'is ":" when the [target namespace] is a URN, otherwise "/".
// Note that for IRI schemes other than URNs which aren't path-based (i.e. those that outlaw the "/"
// character), the default action value may not conform to the rules of the IRI scheme. Authors
// are advised to specify explicit values in the WSDL in this case.'
String delimiter = SLASH;
- if(targetNamespace.toLowerCase().startsWith(URN)){
+ if (targetNamespace.toLowerCase().startsWith(URN)) {
delimiter = COLON;
}
-
+
// Append the bits together
StringBuffer sb = new StringBuffer();
sb.append(targetNamespace);
// Deal with the problem that the targetNamespace may or may not have a trailing delimiter
- if(!targetNamespace.endsWith(delimiter)){
+ if (!targetNamespace.endsWith(delimiter)) {
sb.append(delimiter);
}
sb.append(portTypeName);
@@ -364,14 +380,14 @@
sb.append(FAULT);
sb.append(delimiter);
sb.append(faultName);
-
+
// Resolve the action from the StringBuffer
String result = sb.toString();
-
- if(log.isTraceEnabled()){
- log.trace("getFaultActionFromStringInformation result: "+result);
+
+ if (log.isTraceEnabled()) {
+ log.trace("getFaultActionFromStringInformation result: " + result);
}
-
+
return result;
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/ApplicationXMLBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/ApplicationXMLBuilder.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/ApplicationXMLBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/ApplicationXMLBuilder.java Sun Mar 4 10:16:54 2007
@@ -25,8 +25,6 @@
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
-import org.apache.axis2.builder.Builder;
-import org.apache.axis2.builder.BuilderUtil;
import org.apache.axis2.context.MessageContext;
import javax.xml.stream.XMLStreamException;
@@ -54,8 +52,8 @@
pushbackInputStream.unread(b);
StAXBuilder builder =
BuilderUtil.getPOXBuilder(pushbackInputStream,
- (String) messageContext.getProperty(
- Constants.Configuration.CHARACTER_SET_ENCODING));
+ (String) messageContext.getProperty(
+ Constants.Configuration.CHARACTER_SET_ENCODING));
OMNodeEx documentElement = (OMNodeEx) builder.getDocumentElement();
documentElement.setParent(null);
SOAPBody body = soapEnvelope.getBody();
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/Builder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/Builder.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/Builder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/Builder.java Sun Mar 4 10:16:54 2007
@@ -16,16 +16,17 @@
package org.apache.axis2.builder;
-import java.io.InputStream;
-
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.MessageContext;
+import java.io.InputStream;
+
public interface Builder {
-
+
/**
* @return Returns the document element.
*/
- public OMElement processDocument(InputStream inputStream, String contentType, MessageContext messageContext) throws AxisFault;
+ public OMElement processDocument(InputStream inputStream, String contentType,
+ MessageContext messageContext) throws AxisFault;
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java Sun Mar 4 10:16:54 2007
@@ -16,24 +16,11 @@
package org.apache.axis2.builder;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.PushbackInputStream;
-import java.io.Reader;
-import java.util.Iterator;
-
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.namespace.QName;
-
import org.apache.axiom.attachments.Attachments;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMException;
import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.impl.MTOMConstants;
import org.apache.axiom.om.impl.builder.StAXBuilder;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
@@ -41,32 +28,44 @@
import org.apache.axiom.om.util.StAXUtils;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.SOAPConstants;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.soap.SOAPProcessingException;
-import org.apache.axiom.soap.SOAPBody;
import org.apache.axiom.soap.impl.builder.MTOMStAXSOAPModelBuilder;
import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.axis2.util.MultipleEntryHashMap;
import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisMessage;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.Parameter;
import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.ws.commons.schema.XmlSchemaElement;
-import org.apache.ws.commons.schema.XmlSchemaType;
+import org.apache.axis2.util.MultipleEntryHashMap;
+import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
import org.apache.ws.commons.schema.XmlSchemaParticle;
import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.XmlSchemaType;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PushbackInputStream;
+import java.io.Reader;
+import java.util.Iterator;
public class BuilderUtil {
public static final int BOM_SIZE = 4;
- public static SOAPEnvelope buildsoapMessage(MessageContext messageContext,
+ public static SOAPEnvelope buildsoapMessage(MessageContext messageContext,
MultipleEntryHashMap requestParameterMap,
SOAPFactory soapFactory) throws AxisFault {
@@ -74,11 +73,11 @@
SOAPBody body = soapEnvelope.getBody();
XmlSchemaElement xmlSchemaElement = null;
AxisOperation axisOperation = messageContext.getAxisOperation();
- if (axisOperation != null) {
- AxisMessage axisMessage =
- axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
- xmlSchemaElement = axisMessage.getSchemaElement();
- }
+ if (axisOperation != null) {
+ AxisMessage axisMessage =
+ axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ xmlSchemaElement = axisMessage.getSchemaElement();
+ }
if (xmlSchemaElement == null) {
// if there is no schema its piece of cake !! add these to the soap body in any order you like.
@@ -173,15 +172,16 @@
}
return soapEnvelope;
}
-
- public static StAXBuilder getPOXBuilder(InputStream inStream, String charSetEnc) throws XMLStreamException {
+
+ public static StAXBuilder getPOXBuilder(InputStream inStream, String charSetEnc)
+ throws XMLStreamException {
StAXBuilder builder;
XMLStreamReader xmlreader =
- StAXUtils.createXMLStreamReader(inStream, charSetEnc);
+ StAXUtils.createXMLStreamReader(inStream, charSetEnc);
builder = new StAXOMBuilder(xmlreader);
return builder;
}
-
+
/**
* Use the BOM Mark to identify the encoding to be used. Fall back to
* default encoding specified
@@ -195,9 +195,9 @@
String encoding;
byte bom[] = new byte[BOM_SIZE];
int n, unread;
-
+
n = is2.read(bom, 0, bom.length);
-
+
if ((bom[0] == (byte) 0xEF) && (bom[1] == (byte) 0xBB) && (bom[2] == (byte) 0xBF)) {
encoding = "UTF-8";
unread = n - 3;
@@ -216,23 +216,23 @@
encoding = "UTF-32LE";
unread = n - 4;
} else {
-
+
// Unicode BOM mark not found, unread all bytes
encoding = charSetEncoding;
unread = n;
}
-
+
if (unread > 0) {
is2.unread(bom, (n - unread), unread);
}
-
+
return new BufferedReader(new InputStreamReader(is2, encoding));
}
-
-
+
+
public static String getEnvelopeNamespace(String contentType) {
String soapNS = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
- if(contentType != null) {
+ if (contentType != null) {
if (contentType.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) > -1) {
// it is SOAP 1.2
soapNS = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
@@ -243,7 +243,7 @@
}
return soapNS;
}
-
+
/**
* Extracts and returns the character set encoding from the
* Content-type header
@@ -257,85 +257,85 @@
// Using the default UTF-8
return MessageContext.DEFAULT_CHAR_SET_ENCODING;
}
-
+
int index = contentType.indexOf(HTTPConstants.CHAR_SET_ENCODING);
-
+
if (index == -1) { // Charset encoding not found in the content-type header
// Using the default UTF-8
return MessageContext.DEFAULT_CHAR_SET_ENCODING;
}
-
+
// If there are spaces around the '=' sign
int indexOfEq = contentType.indexOf("=", index);
-
+
// There can be situations where "charset" is not the last parameter of the Content-Type header
int indexOfSemiColon = contentType.indexOf(";", indexOfEq);
String value;
-
+
if (indexOfSemiColon > 0) {
value = (contentType.substring(indexOfEq + 1, indexOfSemiColon));
} else {
value = (contentType.substring(indexOfEq + 1, contentType.length())).trim();
}
-
+
// There might be "" around the value - if so remove them
- if(value.indexOf('\"')!=-1){
+ if (value.indexOf('\"') != -1) {
value = value.replaceAll("\"", "");
}
-
+
return value.trim();
}
-
+
public static StAXBuilder getAttachmentsBuilder(MessageContext msgContext,
- InputStream inStream, String contentTypeString, boolean isSOAP)
- throws OMException, XMLStreamException, FactoryConfigurationError {
+ InputStream inStream, String contentTypeString,
+ boolean isSOAP)
+ throws OMException, XMLStreamException, FactoryConfigurationError {
StAXBuilder builder = null;
XMLStreamReader streamReader;
-
+
Attachments attachments = createAttachmentsMap(msgContext, inStream, contentTypeString);
String charSetEncoding = getCharSetEncoding(attachments.getSOAPPartContentType());
-
+
if ((charSetEncoding == null)
|| "null".equalsIgnoreCase(charSetEncoding)) {
charSetEncoding = MessageContext.UTF_8;
}
msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
- charSetEncoding);
-
+ charSetEncoding);
+
try {
streamReader = StAXUtils.createXMLStreamReader(getReader(
attachments.getSOAPPartInputStream(), charSetEncoding));
} catch (IOException e) {
throw new XMLStreamException(e);
}
-
-
+
// Put a reference to Attachments Map in to the message context For
// backword compatibility with Axis2 1.0
msgContext.setProperty(MTOMConstants.ATTACHMENTS, attachments);
-
+
// Setting the Attachments map to new SwA API
msgContext.setAttachmentMap(attachments);
-
+
String soapEnvelopeNamespaceURI = getEnvelopeNamespace(contentTypeString);
-
+
if (isSOAP) {
if (attachments.getAttachmentSpecType().equals(
MTOMConstants.MTOM_TYPE)) {
//Creates the MTOM specific MTOMStAXSOAPModelBuilder
builder = new MTOMStAXSOAPModelBuilder(streamReader,
- attachments, soapEnvelopeNamespaceURI);
+ attachments, soapEnvelopeNamespaceURI);
msgContext.setDoingMTOM(true);
} else if (attachments.getAttachmentSpecType().equals(
MTOMConstants.SWA_TYPE)) {
builder = new StAXSOAPModelBuilder(streamReader,
- soapEnvelopeNamespaceURI);
+ soapEnvelopeNamespaceURI);
} else if (attachments.getAttachmentSpecType().equals(
- MTOMConstants.SWA_TYPE_12) ) {
+ MTOMConstants.SWA_TYPE_12)) {
builder = new StAXSOAPModelBuilder(streamReader,
- soapEnvelopeNamespaceURI);
+ soapEnvelopeNamespaceURI);
}
-
+
}
// To handle REST XOP case
else {
@@ -344,25 +344,27 @@
XOPAwareStAXOMBuilder stAXOMBuilder = new XOPAwareStAXOMBuilder(
streamReader, attachments);
builder = stAXOMBuilder;
-
+
} else if (attachments.getAttachmentSpecType().equals(
MTOMConstants.SWA_TYPE)) {
builder = new StAXOMBuilder(streamReader);
} else if (attachments.getAttachmentSpecType().equals(
- MTOMConstants.SWA_TYPE_12) ) {
+ MTOMConstants.SWA_TYPE_12)) {
builder = new StAXOMBuilder(streamReader);
}
}
-
+
return builder;
}
-
- protected static Attachments createAttachmentsMap(MessageContext msgContext, InputStream inStream, String contentTypeString) {
+
+ protected static Attachments createAttachmentsMap(MessageContext msgContext,
+ InputStream inStream,
+ String contentTypeString) {
Object cacheAttachmentProperty = msgContext
- .getProperty(Constants.Configuration.CACHE_ATTACHMENTS);
+ .getProperty(Constants.Configuration.CACHE_ATTACHMENTS);
String cacheAttachmentString = null;
boolean fileCacheForAttachments;
-
+
if (cacheAttachmentProperty != null
&& cacheAttachmentProperty instanceof String) {
cacheAttachmentString = (String) cacheAttachmentProperty;
@@ -370,66 +372,67 @@
.equals(cacheAttachmentString));
} else {
Parameter parameter_cache_attachment = msgContext
- .getParameter(Constants.Configuration.CACHE_ATTACHMENTS);
- cacheAttachmentString = (parameter_cache_attachment != null) ? (String) parameter_cache_attachment
- .getValue()
- : null;
+ .getParameter(Constants.Configuration.CACHE_ATTACHMENTS);
+ cacheAttachmentString =
+ (parameter_cache_attachment != null) ? (String) parameter_cache_attachment
+ .getValue()
+ : null;
}
fileCacheForAttachments = (Constants.VALUE_TRUE
.equals(cacheAttachmentString));
-
+
String attachmentRepoDir = null;
String attachmentSizeThreshold = null;
-
+
if (fileCacheForAttachments) {
Object attachmentRepoDirProperty = msgContext
- .getProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR);
-
+ .getProperty(Constants.Configuration.ATTACHMENT_TEMP_DIR);
+
if (attachmentRepoDirProperty != null) {
attachmentRepoDir = (String) attachmentRepoDirProperty;
} else {
Parameter attachmentRepoDirParameter = msgContext
- .getParameter(Constants.Configuration.ATTACHMENT_TEMP_DIR);
- attachmentRepoDir = (attachmentRepoDirParameter != null) ? (String) attachmentRepoDirParameter
- .getValue()
- : null;
+ .getParameter(Constants.Configuration.ATTACHMENT_TEMP_DIR);
+ attachmentRepoDir =
+ (attachmentRepoDirParameter != null) ? (String) attachmentRepoDirParameter
+ .getValue()
+ : null;
}
-
+
Object attachmentSizeThresholdProperty = msgContext
- .getProperty(Constants.Configuration.FILE_SIZE_THRESHOLD);
+ .getProperty(Constants.Configuration.FILE_SIZE_THRESHOLD);
if (attachmentSizeThresholdProperty != null
&& attachmentSizeThresholdProperty instanceof String) {
attachmentSizeThreshold = (String) attachmentSizeThresholdProperty;
} else {
Parameter attachmentSizeThresholdParameter = msgContext
- .getParameter(Constants.Configuration.FILE_SIZE_THRESHOLD);
+ .getParameter(Constants.Configuration.FILE_SIZE_THRESHOLD);
attachmentSizeThreshold = attachmentSizeThresholdParameter
- .getValue().toString();
+ .getValue().toString();
}
}
-
+
Attachments attachments = new Attachments(inStream, contentTypeString,
- fileCacheForAttachments, attachmentRepoDir,
- attachmentSizeThreshold);
+ fileCacheForAttachments, attachmentRepoDir,
+ attachmentSizeThreshold);
return attachments;
}
-
+
/**
- * @deprecated If some one really need this method, please shout.
- *
* @param in
* @return
* @throws XMLStreamException
+ * @deprecated If some one really need this method, please shout.
*/
public static StAXBuilder getBuilder(Reader in) throws XMLStreamException {
XMLStreamReader xmlreader = StAXUtils.createXMLStreamReader(in);
StAXBuilder builder = new StAXSOAPModelBuilder(xmlreader, null);
return builder;
}
-
+
/**
* Creates an OMBuilder for a plain XML message. Default character set encording is used.
- *
+ *
* @param inStream InputStream for a XML message
* @return Handler to a OMBuilder implementation instance
* @throws XMLStreamException
@@ -438,23 +441,24 @@
XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(inStream);
return new StAXOMBuilder(xmlReader);
}
-
+
/**
* Creates an OMBuilder for a plain XML message.
- *
- * @param inStream InputStream for a XML message
+ *
+ * @param inStream InputStream for a XML message
* @param charSetEnc Character set encoding to be used
* @return Handler to a OMBuilder implementation instance
* @throws XMLStreamException
*/
- public static StAXBuilder getBuilder(InputStream inStream, String charSetEnc) throws XMLStreamException {
+ public static StAXBuilder getBuilder(InputStream inStream, String charSetEnc)
+ throws XMLStreamException {
XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(inStream, charSetEnc);
return new StAXOMBuilder(xmlReader);
}
-
+
/**
* Creates an OMBuilder for a SOAP message. Default character set encording is used.
- *
+ *
* @param inStream InputStream for a SOAP message
* @return Handler to a OMBuilder implementation instance
* @throws XMLStreamException
@@ -463,41 +467,44 @@
XMLStreamReader xmlreader = StAXUtils.createXMLStreamReader(inStream);
return new StAXSOAPModelBuilder(xmlreader);
}
-
+
/**
* Creates an OMBuilder for a SOAP message.
- *
- * @param inStream InputStream for a SOAP message
+ *
+ * @param inStream InputStream for a SOAP message
* @param charSetEnc Character set encoding to be used
* @return Handler to a OMBuilder implementation instance
* @throws XMLStreamException
*/
- public static StAXBuilder getSOAPBuilder(InputStream inStream, String charSetEnc) throws XMLStreamException {
+ public static StAXBuilder getSOAPBuilder(InputStream inStream, String charSetEnc)
+ throws XMLStreamException {
XMLStreamReader xmlreader = StAXUtils.createXMLStreamReader(inStream, charSetEnc);
return new StAXSOAPModelBuilder(xmlreader);
}
-
- public static StAXBuilder getBuilder(SOAPFactory soapFactory, InputStream in, String charSetEnc) throws XMLStreamException {
+
+ public static StAXBuilder getBuilder(SOAPFactory soapFactory, InputStream in, String charSetEnc)
+ throws XMLStreamException {
StAXBuilder builder;
XMLStreamReader xmlreader = StAXUtils.createXMLStreamReader(in, charSetEnc);
builder = new StAXOMBuilder(soapFactory, xmlreader);
return builder;
}
-
+
/**
* Initial work for a builder selector which selects the builder for a given
* message format based on the the content type of the recieved message.
* content-type to builder mapping can be specified through the Axis2.xml.
- *
+ *
* @param type
* @param msgContext
* @return the builder registered against the given content-type
* @throws AxisFault
*/
- public static Builder getBuilderFromSelector(String type,MessageContext msgContext) throws AxisFault {
-
+ public static Builder getBuilderFromSelector(String type, MessageContext msgContext)
+ throws AxisFault {
+
Builder builder = msgContext.getConfigurationContext().getAxisConfiguration()
- .getMessageBuilder(type);
+ .getMessageBuilder(type);
if (builder != null) {
// Setting the received content-type as the messageType to make
// sure that we respond using the received message serialisation
@@ -506,31 +513,37 @@
}
return builder;
}
-
- public static void validateSOAPVersion(String soapNamespaceURIFromTransport, SOAPEnvelope envelope)
- {
+
+ public static void validateSOAPVersion(String soapNamespaceURIFromTransport,
+ SOAPEnvelope envelope) {
if (soapNamespaceURIFromTransport != null) {
OMNamespace envelopeNamespace = envelope.getNamespace();
String namespaceName = envelopeNamespace.getNamespaceURI();
- if (!(soapNamespaceURIFromTransport.equals(namespaceName))){
- throw new SOAPProcessingException("Transport level information does not match with SOAP" +
- " Message namespace URI", envelopeNamespace.getPrefix() + ":" + SOAPConstants.FAULT_CODE_VERSION_MISMATCH);
+ if (!(soapNamespaceURIFromTransport.equals(namespaceName))) {
+ throw new SOAPProcessingException(
+ "Transport level information does not match with SOAP" +
+ " Message namespace URI", envelopeNamespace.getPrefix() + ":" +
+ SOAPConstants.FAULT_CODE_VERSION_MISMATCH);
}
}
}
- public static void validateCharSetEncoding(String charsetEncodingFromTransport,String charsetEncodingFromXML, String soapNamespaceURI) throws AxisFault {
+
+ public static void validateCharSetEncoding(String charsetEncodingFromTransport,
+ String charsetEncodingFromXML,
+ String soapNamespaceURI) throws AxisFault {
if ((charsetEncodingFromXML != null)
&& !"".equals(charsetEncodingFromXML)
&& (charsetEncodingFromTransport != null)
- && !charsetEncodingFromXML.equalsIgnoreCase((String) charsetEncodingFromTransport)) {
+ && !charsetEncodingFromXML.equalsIgnoreCase((String) charsetEncodingFromTransport))
+ {
String faultCode;
-
+
if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapNamespaceURI)) {
faultCode = SOAP12Constants.FAULT_CODE_SENDER;
} else {
faultCode = SOAP11Constants.FAULT_CODE_SENDER;
}
-
+
throw new AxisFault("Character Set Encoding from "
+ "transport information do not match with "
+ "character set encoding in the received SOAP message", faultCode);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/MIMEBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/MIMEBuilder.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/MIMEBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/MIMEBuilder.java Sun Mar 4 10:16:54 2007
@@ -16,10 +16,6 @@
package org.apache.axis2.builder;
-import java.io.InputStream;
-
-import javax.xml.stream.XMLStreamReader;
-
import org.apache.axiom.attachments.Attachments;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.impl.MTOMConstants;
@@ -27,32 +23,40 @@
import org.apache.axis2.Constants;
import org.apache.axis2.context.MessageContext;
+import javax.xml.stream.XMLStreamReader;
+import java.io.InputStream;
+
public class MIMEBuilder implements Builder {
-
- public OMElement processDocument(InputStream inputStream, String contentType, MessageContext msgContext)
- throws AxisFault {
+
+ public OMElement processDocument(InputStream inputStream, String contentType,
+ MessageContext msgContext)
+ throws AxisFault {
XMLStreamReader streamReader;
- Attachments attachments = BuilderUtil.createAttachmentsMap(msgContext, inputStream, contentType);
- String charSetEncoding = BuilderUtil.getCharSetEncoding(attachments.getSOAPPartContentType());
-
+ Attachments attachments =
+ BuilderUtil.createAttachmentsMap(msgContext, inputStream, contentType);
+ String charSetEncoding =
+ BuilderUtil.getCharSetEncoding(attachments.getSOAPPartContentType());
+
if ((charSetEncoding == null)
|| "null".equalsIgnoreCase(charSetEncoding)) {
charSetEncoding = MessageContext.UTF_8;
}
msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
- charSetEncoding);
-
+ charSetEncoding);
+
// Put a reference to Attachments Map in to the message context For
// backword compatibility with Axis2 1.0
msgContext.setProperty(MTOMConstants.ATTACHMENTS, attachments);
-
+
// Setting the Attachments map to new SwA API
msgContext.setAttachmentMap(attachments);
-
+
// if (isSOAP) {
- Builder builder = BuilderUtil.getBuilderFromSelector(attachments.getAttachmentSpecType(),msgContext);
- OMElement element = builder.processDocument(attachments.getSOAPPartInputStream(),contentType,msgContext);
-
+ Builder builder =
+ BuilderUtil.getBuilderFromSelector(attachments.getAttachmentSpecType(), msgContext);
+ OMElement element = builder.processDocument(attachments.getSOAPPartInputStream(),
+ contentType, msgContext);
+
// }
// // To handle REST XOP case
// else {
@@ -70,8 +74,8 @@
// builder = new StAXOMBuilder(streamReader);
// }
// }
-
+
return element;
}
-
+
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/MTOMBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/MTOMBuilder.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/MTOMBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/MTOMBuilder.java Sun Mar 4 10:16:54 2007
@@ -16,12 +16,6 @@
package org.apache.axis2.builder;
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
import org.apache.axiom.attachments.Attachments;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.impl.builder.StAXBuilder;
@@ -32,21 +26,28 @@
import org.apache.axis2.Constants;
import org.apache.axis2.context.MessageContext;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.IOException;
+import java.io.InputStream;
+
public class MTOMBuilder implements Builder {
-
- public OMElement processDocument(InputStream inputStream, String contentType,MessageContext messageContext)
- throws AxisFault {
+
+ public OMElement processDocument(InputStream inputStream, String contentType,
+ MessageContext messageContext)
+ throws AxisFault {
XMLStreamReader streamReader;
try {
Attachments attachments = messageContext.getAttachmentMap();
String charSetEncoding = (String) messageContext
- .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
+ .getProperty(Constants.Configuration.CHARACTER_SET_ENCODING);
streamReader = StAXUtils.createXMLStreamReader(BuilderUtil.getReader(inputStream,
- charSetEncoding));
+ charSetEncoding));
StAXBuilder builder = new MTOMStAXSOAPModelBuilder(streamReader,
- attachments);
+ attachments);
SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
- BuilderUtil.validateSOAPVersion(BuilderUtil.getEnvelopeNamespace(contentType), envelope);
+ BuilderUtil
+ .validateSOAPVersion(BuilderUtil.getEnvelopeNamespace(contentType), envelope);
BuilderUtil.validateCharSetEncoding(charSetEncoding, builder.getDocument()
.getCharsetEncoding(), envelope.getNamespace().getNamespaceURI());
return envelope;
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/MultipartFormDataBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/MultipartFormDataBuilder.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/MultipartFormDataBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/MultipartFormDataBuilder.java Sun Mar 4 10:16:54 2007
@@ -19,10 +19,8 @@
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.axis2.builder.BuilderUtil;
-import org.apache.axis2.builder.Builder;
import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.util.MultipleEntryHashMap;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.FileUploadException;
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org